Skip to content

Docker: environment files for dev, staging and production

Tim Orling yocto-patches 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4docker/settings.py: don't enable DEBUG when DEBUG=0docker/settings.py+1 -10 replies
2/4docker: set X-Forwarded-Proto in the nginx configsdocker/nginx-ssl.conf docker/nginx.conf+3 -00 replies
3/4docker/settings.py: read more settings from the environmentdocker/settings.py+5 -20 replies
4/4Add staging and production docker-compose setups with env files.dockerignore .env.dev.app .env.dev.celery +16 more+341 -960 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [layerindex-web][PATCH 0/4] Docker: environment files for dev, staging and production

This series moves the Docker container settings out of docker-compose.yml into tracked .env.<context>.<service> files and adds staging and production compose setups, with two fixes found on the way.

Patch 1 stops DEBUG=0 from enabling Django's debug mode: any non-empty value used to count as true.

Patch 2 makes nginx send X-Forwarded-Proto, which docker/settings.py already trusts. Without it Django treated HTTPS requests as plain HTTP, which is also what caused the 403 on login on a non-default HTTPS port [YOCTO #15329].

Patch 3 lets DATABASE_PORT and STATIC_ROOT be set from the environment and adds ENABLE_RRS to turn on the Recipe Reporting System.

Patch 4 adds the env files and the staging and production setups. The secrets in the staging and production files are commented out, so nothing starts with a known password; the real values belong in a local commit on the server. dockersetup.py now writes the secrets it generates to untracked .env.local.* files instead of editing docker-compose.yml. Installations set up with dockersetup.py before this keep their secrets in docker-compose.yml and need them carried over once; the README change in the documentation series that follows describes how.

Tested with docker/run-tests.sh (the full suite, including tests/test_update.py) and on a test deployment.

Tim Orling (4):
docker/settings.py: don't enable DEBUG when DEBUG=0
docker: set X-Forwarded-Proto in the nginx configs docker/settings.py: read more settings from the environment Add staging and production docker-compose setups with env files

 .dockerignore              |   1 +
 .env.dev.app               |  14 +++++
 .env.dev.celery            |  14 +++++
 .env.dev.db                |   3 +
 .env.dev.rabbit            |   3 +
 .env.prod.app              |  15 +++++
 .env.prod.celery           |  15 +++++
 .env.prod.db               |   4 ++
 .env.prod.rabbit           |   4 ++
 .env.staging.app           |  15 +++++
 .env.staging.celery        |  15 +++++
 .env.staging.db            |   4 ++
 .env.staging.rabbit        |   4 ++
 .gitignore                 |   2 +
 README                     |  23 +++++++-
 docker-compose.prod.yml    |  74 +++++++++++++++++++++++++
 docker-compose.staging.yml |  74 +++++++++++++++++++++++++
 docker-compose.yml         |  42 +++-----------
 docker/nginx-ssl.conf      |   2 +
 docker/nginx.conf          |   1 +
 docker/settings.py         |   9 ++-
 dockersetup.py             | 111 +++++++++++++++++--------------------
 22 files changed, 350 insertions(+), 99 deletions(-)
 create mode 100644 .env.dev.app
 create mode 100644 .env.dev.celery
 create mode 100644 .env.dev.db
 create mode 100644 .env.dev.rabbit
 create mode 100644 .env.prod.app
 create mode 100644 .env.prod.celery
 create mode 100644 .env.prod.db
 create mode 100644 .env.prod.rabbit
 create mode 100644 .env.staging.app
 create mode 100644 .env.staging.celery
 create mode 100644 .env.staging.db
 create mode 100644 .env.staging.rabbit
 create mode 100644 docker-compose.prod.yml
 create mode 100644 docker-compose.staging.yml

base-commit: e6040597ae0f614581de241fe78f20e34dae13ac

Signature · 1 line
2.56.0