App | Version |
---|---|
Celery | 4.2.1 |
Django | 1.11 |
Nginx | 1.15.5 |
Python | 3.6.6 |
Redis | 4.0.11 |
- Celery as a way of running async tasks
- Django as the main Python application
- Nginx as a web server
- PostgreSQL as a Django database
- Redis as a queue for Celery
- db (Django PostgreSQL database)
- django (Django application)
- redis (Redis result backend for Celery)
- web-nginx (Web server)
- worker (Celery worker)
-
Change the envirorment variables in the
Dockerfile
as you see fit -
Generate SSL certificates for nginx (Self Signed or Let's encrypt)
- Self signed express lane
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout cert.key -out cert.crt
- Self signed express lane
-
Place the certificate files in the root folder (
./cert.crt
and./cert.key
) -
(Optional) Use ngrok to debug webhooks locally
docker-compose build
docker-compose up
Run in the background
docker-compose up -d
docker-compose exec [container] bash -l
docker-compose run django python manage.py test
docker-compose logs [container]
# Install requirements
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
# Set the envirorment variables described in Dockerfile
# Temporary:
export VARIABLE=VALUE
# Static:
echo 'export VARIABLE=VALUE' >> ~/.bashrc
# Move to 'src' folder
cd src
# Run worker
celery -A mercury_app worker
# Start application on another console
python manage.py runserver