Serve the dev/test stack over HTTPS with a mounted self-signed cert
Terminate TLS in gunicorn using a host-generated cert mounted read-only under ./certs, so the browser sees a secure context. Secure-context-only web APIs (navigator.clipboard and others) refuse to run over plain http on a non-localhost origin, which the FQDN-accessed test box hits. Healthcheck now probes https with -k to match the TLS listener. A site swaps in its own cert or fronts this with its own IIS/nginx proxy.
This commit is contained in:
committed by
cproudlock
parent
84f9cfe13d
commit
4f01c3d2d4
@@ -65,8 +65,43 @@ services:
|
|||||||
COLLECTOR_API_KEY_ENDPOINTS: ${COLLECTOR_API_KEY_ENDPOINTS:-}
|
COLLECTOR_API_KEY_ENDPOINTS: ${COLLECTOR_API_KEY_ENDPOINTS:-}
|
||||||
ports:
|
ports:
|
||||||
- "${API_PORT:-5001}:5001"
|
- "${API_PORT:-5001}:5001"
|
||||||
|
# Terminate TLS in gunicorn with the mounted self-signed cert so the browser
|
||||||
|
# sees a secure context. navigator.clipboard and other secure-context-only
|
||||||
|
# web APIs refuse to run over plain http on a non-localhost origin, so the
|
||||||
|
# test box (accessed by FQDN) needs real https. A site swaps in its own cert
|
||||||
|
# under ./certs or fronts this with its IIS/nginx proxy.
|
||||||
|
command:
|
||||||
|
- gunicorn
|
||||||
|
- --bind
|
||||||
|
- 0.0.0.0:5001
|
||||||
|
- --workers
|
||||||
|
- "4"
|
||||||
|
- --timeout
|
||||||
|
- "60"
|
||||||
|
- --access-logfile
|
||||||
|
- "-"
|
||||||
|
- --error-logfile
|
||||||
|
- "-"
|
||||||
|
- --certfile
|
||||||
|
- /app/certs/server.crt
|
||||||
|
- --keyfile
|
||||||
|
- /app/certs/server.key
|
||||||
|
- wsgi:app
|
||||||
|
healthcheck:
|
||||||
|
# Match the TLS listener: probe over https and accept the self-signed cert
|
||||||
|
# (-k). The Dockerfile default probes http and would stay red once gunicorn
|
||||||
|
# only speaks TLS.
|
||||||
|
test: ["CMD", "curl", "--silent", "--insecure", "https://localhost:5001/api/auth/login",
|
||||||
|
"-X", "POST", "-H", "Content-Type: application/json", "-d", "{}"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 5s
|
||||||
|
start_period: 10s
|
||||||
|
retries: 3
|
||||||
volumes:
|
volumes:
|
||||||
- ./plugins:/app/plugins:ro
|
- ./plugins:/app/plugins:ro
|
||||||
|
# Self-signed TLS material for the dev/test https listener. Read-only;
|
||||||
|
# generated on the host under ./certs and never baked into the image.
|
||||||
|
- ./certs:/app/certs:ro
|
||||||
# /app/instance is WRITTEN state, not code: plugins.json (which plugins
|
# /app/instance is WRITTEN state, not code: plugins.json (which plugins
|
||||||
# this site has enabled), uploaded floor plans, branding, model and
|
# this site has enabled), uploaded floor plans, branding, model and
|
||||||
# application images, employee photos, warranty proofs, slides,
|
# application images, employee photos, warranty proofs, slides,
|
||||||
|
|||||||
Reference in New Issue
Block a user