Create docker-compose config for deploy
Create a new
docker-compose.prod.yml) (at the root of the project), to be used in the production environment,
It should make use of the
Dockerfilewe already have for the backend,
For the frontend, it should be built (with production settings:
npm run build) on startup, and then container will not be required. You can reuse what we currently have.
All client requests should go through an Nginx container
Nginx should be configured to serve the static files properly (with
gzipconfiguration if possible)
The Django app should be through Uwsgi with 4 workers (for now)
The database stays the same,
You should have one persistent volume for the database (just like currently)
Only nginx (exposed on port 80) must be visible from outside; you can make use of private network where it makes sense.
Env variables: Env variables are used to contain all IDs / very short configuration.
Create a dev.env file with all the current env variables set in
docker-compose.ymlto make use of this file.
Create a prod.env file (**and add it to
.gitignore) that will hold the production IDs (we will set the values later; it should have all the same entries as dev.env, with different values).
You might need to create configuration files for nginx & uwsgi. Put them in a folder
prod_conf at the root of the repo. You can then map them as dynamic volumes in
You might want to create different env files for the different aspect of the app and not to share all IDs in all containers. If so, put them in other
.env files in
NB: no django migrations should be applied automatically.
Make sure django is configured properly (
The app should be up and running with production settings with a simple
docker-compose up --build --file docker-compose.prod.yml
Make sure to document (in the documentation) the exact steps required to put the app in production (all the commands and files to edit).
Handle logging properly
Find a workaround for node_modules assets not being present if no
npm ior needed to map them from the image (beurk)