This repository contains the configuration information required to bring up a development environment for the Permanent Legacy Foundation website.
Note: Many of the shared folders required to bring up the complete environment are not yet publicly available. This will change. We are in the process of moving more code into public view, publishing it as open source, and streamlining our repository structure.
Our current development environment is a VirtualBox VM managed by Vagrant.
We use the latest Debian build published here for our development.
-
Prerequisites
- Access to AWS
- Install AWS CLI
- Install Docker
- Install npm and node (most packages require node 18)
- Access to Fusionauth OR the values of the env variables that need to be set up for Fusionauth to work.
- Access to repositories
back-end
,infrastructure
,notification-service
,upload-service
,web-app
,stela
-
Create three AWS SQS queues (type: Standard) with the following names:
- Local_Low_Priority_YourName
- Local_Video_YourName
- Local_High_Priority_YourName
-
Set up directory structure. If you have access to the Permanent repositories, navigate to the parent directory of this directory and clone the needed repositories.
cd .. for r in back-end infrastructure notification-service upload-service web-app stela; do git clone [email protected]:PermanentOrg/$r.git; done
-
create log folder next to the repo folders. where the backend container's logs folder will be mounted for easy access.
mkdir log
-
cp .env.template .env
and define the required environment variables in.env
using your preferred file editor. You will need to do this for both this repo and thestela
andweb-app
repos, as they both have the.env
file referenced in the docker compose file.- Create an AWS Access Key here and download the credentials.
- Add values for the following variables associated with the key:
AWS_REGION
,AWS_ACCESS_KEY_ID
,AWS_ACCESS_SECRET
. SQS_IDENT
will be the name you you selected above when creating the SQS queues, preceded by an underscore.UPLOAD_SERVICE_SENTRY_DSN
is optional and allows sentry configuration for the upload service.NOTIFICATION_DATABASE_URL
andNOTIFICATION_FIREBASE_CREDENTIALS
are required for the notification service
-
Download the SSL certs for the nginx load balancer to use inside the docker network. It's important that the AWS env vars have been set for the CLI command to work
source .env && aws s3 cp --recursive s3:https://permanent-local/certs ./certs
-
Edit your local host file (e.g.
/etc/hosts
) to connect to the host with the correct domain name.printf "\n127.0.0.1 local.permanent.org" | sudo tee -a /etc/hosts
-
Return to
devenv
and run the following command to bring a development environment for the first time, or to start up a halted VMs.docker-compose up -d
-
Load the website at https://local.permanent.org/app.
-
When you're done working on the dev environment, bring it down.
docker-compose down
The repo sync script essentially helps you stay up to date with work going on across the multiple devenv repos.
-
Run
./bin/repo-sync.sh
to pull the latest updates from all devenv repos at once. -
Observe the terminal and see what repositories actually recieve updates, this is important to know whether you might need an environment rebuild as in the case of changes in the Infrastructure repository.
-
Usage In Debugging: It's also a good first thing to do if something goes wrong with your environment; as you would need ensure that you are using the latest copy of each repository.
-
If the
stela
container claims to be missing dependencies that are stated in thepackage.json
file, you may need to delete yourstela
image and rebuild it. You can find the image withdocker image ls
and delete it withdocker rmi <image_tag>
, or you can rundocker compose down
followed bydocker system prune --all
to remove all images not currently in use. In either case,docker compose up -d
will rebuild the image. -
If running
docker compose up
results in an error due to port 80 being in use already, you likely need to turn off apache, which runs by default on many distros. -
local.permanent.org/app
redirects the way we're used to, except thatlocal.permanent.org
gets replaced with the IP where the web app is running in the URL. You'll have to change this back tolocal.permanent.org
or things won't work properly.local.permanent.org/app/
avoids this. If you are getting a CORS error, then the above redirection could have caused it. -
Be sure you're accessing
https://local.permanent.org
, nothttps://local.permanent.org
; the latter will not work
Contributors to this repository agree to adhere to the Contributor Covenant Code of Conduct. To report violations, get in touch with [email protected].
Found a vulnerability? Report this and any other security concerns to [email protected].
This code is free software licensed as AGPLv3, or at your option, any final, later version published by the Free Software Foundation.