A1: Django skeleton with web and worker processes (ADR-54, ADR-55, WEB-01, WEB-07, ARC-70..74)
Django 5.2 project (config/, apps/accounts with a custom User and case-insensitive usernames, apps/lottery with the run_worker command, apps/web with a placeholder home and /health/live, apps/ops), SQLite in WAL with IMMEDIATE transactions, secrets and hosts from the environment. The compose stack is now web + worker + caddy and serves https://localhost; the old FastAPI service is out of the stack until roadmap D1. The three old infrastructure tests follow the new Dockerfile and compose. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
79f7ebe53e
commit
fc23a75c9b
43 files changed
+709
-61
No files matched your search
+10
-8
@@ -9,17 +9,19 @@ WORKDIR /app
|
||||
COPY requirements.lock ./
|
||||
RUN pip install --no-cache-dir --require-hashes --no-deps -r requirements.lock
|
||||
|
||||
COPY pyproject.toml ./
|
||||
COPY app ./app
|
||||
COPY migrations ./migrations
|
||||
COPY alembic.ini ./
|
||||
COPY scripts ./scripts
|
||||
# ADR-54: the Django project (`config/`, `apps/`). The previous FastAPI code (`app/`) is no longer
|
||||
# part of the image; it stays in the repository until the old backend is removed (roadmap D1).
|
||||
COPY pyproject.toml manage.py ./
|
||||
COPY config ./config
|
||||
COPY apps ./apps
|
||||
|
||||
RUN pip install --no-cache-dir --no-deps . \
|
||||
&& DJANGO_DEBUG=true python manage.py collectstatic --noinput \
|
||||
&& useradd --uid 1000 --no-create-home --shell /usr/sbin/nologin app
|
||||
USER 1000:1000
|
||||
|
||||
EXPOSE 8123
|
||||
EXPOSE 8000
|
||||
|
||||
# umask 077: the database, its WAL files and the logs are created readable by the app user only.
|
||||
CMD ["/bin/sh", "-c", "umask 077; test -f \"$MASTER_KEY_PATH\" || { echo \"ERROR: master key not found at $MASTER_KEY_PATH -- run: docker compose run --rm app python scripts/generate_master_key.py\" >&2; exit 1; }; alembic upgrade head && exec uvicorn app.main:app --host 0.0.0.0 --port 8123 --proxy-headers --forwarded-allow-ips \"${FORWARDED_ALLOW_IPS:-127.0.0.1}\""]
|
||||
# umask 077: the database and its WAL files are created readable by the app user only.
|
||||
# The worker service overrides this command (`python manage.py run_worker`).
|
||||
CMD ["/bin/sh", "-c", "umask 077; python manage.py migrate --noinput && exec gunicorn config.wsgi --bind 0.0.0.0:8000 --workers 2 --access-logfile - --forwarded-allow-ips \"${FORWARDED_ALLOW_IPS:-127.0.0.1}\""]
|
||||
Reference in new issue
Block a user