52 lines
1.5 KiB
YAML
52 lines
1.5 KiB
YAML
# Production compose stack for hamprint.
|
|
#
|
|
|
|
services:
|
|
db:
|
|
image: docker.io/library/postgres:16
|
|
restart: unless-stopped
|
|
env_file: .env
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
|
|
web:
|
|
build:
|
|
context: .
|
|
dockerfile: Containerfile
|
|
restart: unless-stopped
|
|
env_file: .env
|
|
environment:
|
|
DJANGO_SETTINGS_MODULE: hamprint.settings.prod
|
|
DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
|
|
ports:
|
|
- "8000:8000"
|
|
volumes:
|
|
- media:/app/media
|
|
labels:
|
|
traefik.enable: "true"
|
|
traefik.http.routers.hamprint.rule: "Host(`print.hamlab.lt`)"
|
|
traefik.http.middlewares.hamprint-https-redirect.redirectscheme.scheme: "https"
|
|
traefik.http.routers.hamprint.middlewares: "hamprint-https-redirect"
|
|
traefik.http.routers.hamprint-secure.entrypoints: "https"
|
|
traefik.http.routers.hamprint-secure.rule: "Host(`print.hamlab.lt`)"
|
|
traefik.http.routers.hamprint-secure.tls: "true"
|
|
traefik.http.routers.hamprint-secure.tls.certresolver: "lets-encrypt"
|
|
traefik.http.services.hamprint.loadbalancer.server.port: "8000"
|
|
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
|
|
volumes:
|
|
pgdata:
|
|
media:
|