chore: deployment move to docker only
This commit is contained in:
+13
-11
@@ -9,12 +9,11 @@ one container:
|
||||
- `worker` - two `rqworker` processes for background jobs (submission OCR,
|
||||
AAndT sync, etc.)
|
||||
|
||||
Postgres, Redis and S3-compatible storage are **not** bundled - the image
|
||||
expects them the same way the bare-metal deploy does (see
|
||||
`deploy/supervisor/polylan-submitter.env.dist` for the full list of env
|
||||
vars: `POSTGRES_*`, `REDIS_HOST`/`REDIS_PORT`, `AWS_*`, `DJANGO_SECRET_KEY`,
|
||||
etc.). Point those at wherever those services already live (other
|
||||
containers/LXCs, or existing infra).
|
||||
Postgres, Redis and S3-compatible storage are **not** bundled (see
|
||||
`deploy/docker/polylan-submitter.env.dist` for the full list of env vars:
|
||||
`POSTGRES_*`, `REDIS_HOST`/`REDIS_PORT`, `AWS_*`, `DJANGO_SECRET_KEY`, etc.).
|
||||
Point those at wherever those services already live (other containers/LXCs,
|
||||
or existing infra).
|
||||
|
||||
## Build
|
||||
|
||||
@@ -30,7 +29,7 @@ docker buildx build --load -t polylan-submitter .
|
||||
```sh
|
||||
docker run -d \
|
||||
--name polylan-submitter \
|
||||
--env-file deploy/supervisor/polylan-submitter.env \
|
||||
--env-file deploy/docker/polylan-submitter.env \
|
||||
-p 8000:8000 \
|
||||
polylan-submitter
|
||||
```
|
||||
@@ -41,15 +40,18 @@ shared S3 bucket, so run it once per deploy instead of racing multiple
|
||||
replicas on every boot:
|
||||
|
||||
```sh
|
||||
docker run --rm --env-file deploy/supervisor/polylan-submitter.env \
|
||||
docker run --rm --env-file deploy/docker/polylan-submitter.env \
|
||||
polylan-submitter python manage.py collectstatic --noinput
|
||||
```
|
||||
|
||||
## Scaling
|
||||
|
||||
There's one `daphne` process per container (unlike the bare-metal deploy's
|
||||
`NUM_WEB_WORKERS` behind HAProxy) - scale by running multiple container
|
||||
replicas behind an external reverse proxy/load balancer instead.
|
||||
There's one `daphne` process per container - it binds the only port the
|
||||
container exposes, so running more of them would need a reverse proxy
|
||||
inside the container too. Scale by running multiple container replicas
|
||||
behind an external reverse proxy/load balancer instead (each replica also
|
||||
runs its own pair of `rqworker` processes, so worker capacity scales the
|
||||
same way).
|
||||
|
||||
## Deploying to Proxmox
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Template for the --env-file passed to `docker run` (see
|
||||
# deploy/docker/README.md). Copy this to deploy/docker/polylan-submitter.env,
|
||||
# fill in real values, and keep it out of git (already in .gitignore) and
|
||||
# world-readable perms (chmod 600) since it holds secrets.
|
||||
#
|
||||
# Docker reads this file itself (KEY=VALUE per line) before the container's
|
||||
# Python even starts - no python-dotenv, no $VAR/${VAR} expansion, no shell
|
||||
# involved. settings.py just reads the values from os.environ.
|
||||
#
|
||||
# Rotating a secret means editing this file and restarting the container
|
||||
# (`docker restart polylan-submitter` or replacing it, depending on how
|
||||
# you're running it) - values are read fresh on every process start.
|
||||
#
|
||||
# See settings.py for what each of these does and its dev-mode default.
|
||||
|
||||
DJANGO_SECRET_KEY=
|
||||
DJANGO_DEBUG=false
|
||||
DJANGO_ALLOWED_HOSTS=submitter.polylan.ch
|
||||
|
||||
POSTGRES_DB=
|
||||
POSTGRES_USER=
|
||||
POSTGRES_PASSWORD=
|
||||
POSTGRES_HOST=
|
||||
POSTGRES_PORT=
|
||||
|
||||
REDIS_HOST=
|
||||
REDIS_PORT=
|
||||
PLACE_REDIS_URL=
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_S3_ENDPOINT_URL=
|
||||
AWS_STORAGE_BUCKET_NAME=
|
||||
|
||||
SENTRY_ENVIRONMENT=production
|
||||
SENTRY_DSN=
|
||||
|
||||
MARKET_ENABLED=true
|
||||
STEAM_API_KEY=
|
||||
AANDT_API_BASE_URL=
|
||||
SUBMITTER_BASE_URL=
|
||||
@@ -1,10 +1,8 @@
|
||||
; Runs inside the single app container as the non-root "app" user (see
|
||||
; Dockerfile's USER app - no [supervisord] user= needed, we never start as
|
||||
; root here). Unlike deploy/supervisor/polylan-submitter.conf (multiple
|
||||
; daphne processes behind HAProxy on one bare-metal host), this container
|
||||
; runs ONE daphne process on TCP: scale by running more container replicas
|
||||
; behind an external reverse proxy/load balancer instead of more processes
|
||||
; per container.
|
||||
; root here). This container runs ONE daphne process on TCP: scale by
|
||||
; running more container replicas behind an external reverse proxy/load
|
||||
; balancer instead of more processes per container.
|
||||
;
|
||||
; Program logs go to stdout/stderr (logfile_maxbytes=0 disables supervisor's
|
||||
; own log rotation for them) so `docker logs` / Proxmox's log viewer picks
|
||||
@@ -29,7 +27,6 @@ stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
|
||||
; RQ workers - same command as deploy/supervisor/polylan-submitter.conf.
|
||||
[program:worker]
|
||||
command=/app/.venv/bin/python manage.py rqworker default --job-class django_tasks_rq.Job --with-scheduler
|
||||
directory=/app/polylan_submitter
|
||||
|
||||
Reference in New Issue
Block a user