mbox series

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

Message ID 20261018214146.67856-1-tim.orling@konsulko.com
Headers show
Series Docker: environment files for dev, staging and production | expand

Message

Tim Orling Oct. 18, 2026, 9:41 p.m. UTC
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