Install Docker first before starting the docker engine and run this command on the terminal -
docker-compose -f docker/docker-compose.yml up
This will set up a docker stack with test data which the frontend app will be able to connect to. If you make changes to the code you will need to run a build
command (replacing the up
command) before doing another up
. Another useful docker-compose
command is down
in place of up
which clears down the docker stack.
If you want to make code changes directly on the docker container then you can run a docker exec -it na_api bash
and then locate the file that you want to change and edit it using vi
, please note that if you want to keep any changes you will have to copy them to the source code.
Finally to clear out docker images and other resource files that you don't need run a docker system prune
.
Celery workers process tasks in the background so that the main app can continue processing requests without blocking.
make start-local-celery
A Virtual Environment is an isolated working copy of Python which allows you to work on a specific project without worry of affecting other projects
Follow this guide to set up your virtualenv for this project; https://virtualenvwrapper.readthedocs.io/en/latest/
Run make dependencies
to install dependencies
Run Make
to list available commands
Copy environment_sample.sh
and create an environment.sh
file and fill in the env vars
export DATABASE_URL_development=<postgres url>
export API_development=<development endpoint, defaults to localhost:5001>
export ADMIN_CLIENT_ID=<admin client id>
export ADMIN_CLIENT_SECRET=<admin client secret>
export JWT_SECRET=<secret key>
export PROJECT=<google project name>
export FRONTEND_ADMIN_URL=<URL for the frontend admin>
export API_BASE_URL=<URL for API>
export FRONTEND_URL=<URL for the frontend>
export IMAGES_URL=<URL for images>
# optional below
export EMAIL_DOMAIN=<email domain for admin users>
export ADMIN_USERS=<super admin emails comma separated>
export GOOGLE_APPLICATION_CREDENTIALS=<location of google credentials>
export GOOGLE_STORE=<name of google storage>
export PAYPAL_URL=<paypal url>
export PAYPAL_USER=<paypal seller account>
export PAYPAL_PASSWORD=<paypal password>
export PAYPAL_SIG=<paypal signature>
export EMAIL_PROVIDER_URL=<email provider url>
export EMAIL_PROVIDER_APIKEY=<email provider api key>
export CELERY_BROKER_URL=<celery broker URL, normally redis>
Run source environment.sh
to make the parameters available
On project path -
./scripts/run_tests.sh
Run the api make run
While the application is running, run the ./integration_test.sh
On project path -
./scripts/run_app.sh [ENV]
Where ENV is -
development - port 5001
https://<new acropolis url>/dev/
preview
https://<new acropolis url>/preview/
live
https://<new acropolis url>/
Imports can be run via integration_test.sh
# import venues
./integration_test.sh -iv
# import speakers
./integration_test.sh -is
# import event types
./integration_test.sh -iet
# import events
./integration_test.sh -ie
# import articles
./integration_test.sh -ia
# import marketing
./integration_test.sh -ima
# import members
./integration_test.sh -ime
# import emails
./integration_test.sh -iem
# import email to members
./integration_test.sh -ie2m <local|preview|live> emailmailings_0-10000.json
# import magazines
python app_start.py upload_magazines data/pdfs
Images have to be uploaded from the dev machine, after which they can be copied to other storage buckets using gsutil
and rsync
:
gsutil -m rsync -r -d -p gs://<dev storage name> gs://<target storage name>
Generate web images by running this command:
python app_start.py generate_web_images --year=2019
python app_start.py upload_magazines --folder=<folder path>
Logs are stored under the logs
folder