58 lines
2.0 KiB
YAML
58 lines
2.0 KiB
YAML
# Shared infrastructure for running one Rezervovator container per customer:
|
|
# the reverse proxy and the PostgreSQL server. Customer containers are not listed
|
|
# here, they are created with ./rezervator.sh (see README.md in this directory).
|
|
|
|
name: ${REZERVATOR_PREFIX:-rezervator}
|
|
|
|
services:
|
|
proxy:
|
|
image: traefik:v3
|
|
container_name: ${REZERVATOR_PREFIX:-rezervator}-proxy
|
|
restart: unless-stopped
|
|
command:
|
|
- --providers.docker=true
|
|
- --providers.docker.exposedbydefault=false
|
|
- --providers.docker.network=${REZERVATOR_PREFIX:-rezervator}
|
|
# Only containers of this stack, so two stacks on one host don't mix
|
|
- --providers.docker.constraints=Label(`rezervator.stack`,`${REZERVATOR_PREFIX:-rezervator}`)
|
|
- --entrypoints.web.address=:80
|
|
- --entrypoints.websecure.address=:443
|
|
# Let's Encrypt certificates, used when REZERVATOR_TLS=true
|
|
- --certificatesresolvers.le.acme.email=${ACME_EMAIL:-}
|
|
- --certificatesresolvers.le.acme.storage=/letsencrypt/acme.json
|
|
- --certificatesresolvers.le.acme.httpchallenge.entrypoint=web
|
|
ports:
|
|
- "${HTTP_PORT:-80}:80"
|
|
- "${HTTPS_PORT:-443}:443"
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
- letsencrypt:/letsencrypt
|
|
networks:
|
|
- rezervator
|
|
|
|
postgres:
|
|
image: postgres:17
|
|
container_name: ${REZERVATOR_PREFIX:-rezervator}-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env (./rezervator.sh init creates it)}
|
|
# Every customer instance may open up to CUSTOMER_MAX_CONNECTIONS connections
|
|
command: ["postgres", "-c", "max_connections=${PG_MAX_CONNECTIONS:-300}"]
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -h 127.0.0.1 -U postgres"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 20
|
|
networks:
|
|
- rezervator
|
|
|
|
networks:
|
|
rezervator:
|
|
name: ${REZERVATOR_PREFIX:-rezervator}
|
|
|
|
volumes:
|
|
letsencrypt:
|
|
postgres-data:
|