Test suite (the manual audit harness, now a real test):
- backend/apps/core/tests/test_security.py: 20 transactional tests across
guest visibility, object ownership, staged-upload/similarity privacy,
staff role boundaries, deletion rules, encrypted credentials, throttling
and the download allowlist. Uses temp media folders and clears cache.
Needs a one-time GRANT on test_j621 (documented in the module + README).
Images (deploy/J621-Frontend, deploy/J621-Backend, repo root as context):
- Frontend: node build -> static nginx with SPA fallback, asset caching and
an internal health endpoint.
- Backend: gunicorn + whitenoise (admin static collected at build), ffmpeg
for video thumbnails, migrations applied on start, GIT_HASH build arg so
the shell's version pill shows the commit.
Composes (distinct project names so they coexist with the dev stack):
- compose.yml (both), compose.frontend.yml, compose.backend.yml.
- A shared nginx proxy service is the only entry point (no host nginx, no
published host ports): /api,/admin,/static,/health -> backend, everything
else -> SPA; both upstreams resolve at request time so one config serves
all variants.
- A Tailscale sidecar per compose shares the nginx network namespace;
serve.default/frontend/backend.json use funnel ports 443 and 8443 only
(10000 is the remaining allowance) with ${TS_CERT_DOMAIN} substitution.
Registry: push_frontend.sh / push_backend.sh / push_all.sh build multi-arch
images and push :latest + :<sha> to the Gitea registry, following the
existing Packs-site pattern.
Docs: deploy/README.md + .env.example, ROADMAP section 6 updated,
AGENTS.md deployment and test notes.
Verified: all three composes validate, both nginx configs pass nginx -t,
both images build, the combined stack boots against real MariaDB/Redis
(migrations applied, /health ok, whitenoise serving admin static, env=prod,
git hash baked in), the proxy serves the SPA and routes /api, and
manage.py test apps.core.tests passes 20/20.
63 lines
2.0 KiB
YAML
63 lines
2.0 KiB
YAML
# J621 — frontend-only deployment: SPA + nginx proxy + Tailscale sidecar.
|
|
#
|
|
# cd deploy && cp .env.example .env # TS_AUTHKEY at minimum
|
|
# docker compose -f compose.frontend.yml up -d
|
|
#
|
|
# Funnel: https://<TS_HOSTNAME>.<tailnet>.ts.net (443) serves the SPA.
|
|
# On first start the SPA asks for a backend (/setup): point it at a
|
|
# backend-only deployment (e.g. https://j621-backend.<tailnet>.ts.net:8443),
|
|
# leave it blank to serve one yourself, or stay in local mode.
|
|
#
|
|
# There is no backend in this compose, so /api answers 502 here until the SPA
|
|
# is configured to call one elsewhere.
|
|
|
|
name: j621-frontend-deploy
|
|
|
|
services:
|
|
frontend:
|
|
image: ${J621_REGISTRY:-gitea.rainbow-herring.ts.net/jakebreath}/j621-frontend:${J621_TAG:-latest}
|
|
build:
|
|
context: ..
|
|
dockerfile: deploy/J621-Frontend
|
|
restart: unless-stopped
|
|
|
|
nginx:
|
|
image: nginx:1.29-alpine
|
|
restart: unless-stopped
|
|
volumes:
|
|
- ./nginx-proxy.conf:/etc/nginx/conf.d/default.conf:ro
|
|
depends_on:
|
|
frontend:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "wget -q --spider http://127.0.0.1/nginx-health || exit 1"]
|
|
interval: 30s
|
|
timeout: 3s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
tailscale:
|
|
image: tailscale/tailscale:latest
|
|
restart: unless-stopped
|
|
# Shares the nginx service's network namespace: 127.0.0.1:80 is the proxy.
|
|
network_mode: "service:nginx"
|
|
environment:
|
|
TS_AUTHKEY: ${TS_AUTHKEY:?Set TS_AUTHKEY in deploy/.env}
|
|
TS_HOSTNAME: ${TS_HOSTNAME:-j621-frontend}
|
|
TS_AUTH_ONCE: "true"
|
|
TS_STATE_DIR: /var/lib/tailscale
|
|
TS_SERVE_CONFIG: /config/serve.json
|
|
volumes:
|
|
- ./tailscale-state:/var/lib/tailscale
|
|
- ./serve.frontend.json:/config/serve.json:ro
|
|
- /etc/ssl/certs:/etc/ssl/certs:ro
|
|
depends_on:
|
|
nginx:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "tailscale", "status"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 30s
|