CMS for the WDRforyou bot
Our CMS is based on Django and hosted on AWS Lambda using Zappa. It provides a REST-API for wdrforyou-bot.
We don't advise you to deploy to AWS for local development, as it is quite time consuming to set up.
Copy .env.sample
to .env
and make adjustments if necessary.
Enable pipenv shell:
$ pipenv sync --dev
$ pipenv shell
$ app/manage.py migrate
$ app/manage.py createsuperuser
To run local development server:
$ app/manage.py runserver
For database migrations use:
$ app/manage.py makemigrations
$ app/manage.py migrate
Alternatively you can run commands without enabling pipenv shell, for example:
$ pipenv run app/manage.py runserver
- Set up an S3 bucket for static files and an IAM user with access to that bucket
- Create Zappa deployment bucket and update the
s3_bucket
key inzappa_settings.json
- Follow this guide to set up an SQL database (Postgres)
- Follow this guide to give your Lambda functions general internet access
- Optional: Create an S3 endpoint in your VPC to specifically set up S3 connectivity for your Lambda functions
- Run
zappa deploy <stage>
,zappa manage <stage> migrate
and./manage.py collectstatic
for initial deployment andzappa update <stage>
for updating
- Follow this guide
You can use the s3-env-config
npm package to configure the environment variables in an S3 bucket.
The following environment variables are required:
{
"DEBUG": "", // Can be True or False
"SECRET_KEY": "", // If DEBUG=False
"S3_BUCKET_NAME": "", // S3 bucket for static files
"AWS_ACCESS_KEY_ID": "", // Credentials for the bucket
"AWS_SECRET_ACCESS_KEY": "",
"DB_NAME": "",
"DB_USER": "",
"DB_PASSWORD": "",
"DB_HOST": "",
"BOT_SERVICE_ENDPOINT": "", // With trailing slash
"SLACK_BOT_TOKEN": "",
"SLACK_CHANNEL": ""
}