Files
rezervovator/deploy/docker-compose.yml
T

66 lines
2.3 KiB
YAML
Raw Normal View History

# 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).
#
# Both services are optional and selected by profiles: ./rezervator.sh init starts
# "traefik" unless REZERVATOR_PROXY=nginx, and "postgres" unless REZERVATOR_POSTGRES=host.
name: ${REZERVATOR_PREFIX:-rezervator}
services:
proxy:
profiles: ["traefik"]
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:
profiles: ["postgres"]
image: postgres:17
container_name: ${REZERVATOR_PREFIX:-rezervator}-postgres
restart: unless-stopped
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-}
# 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
# Created by ./rezervator.sh init, because customer containers use it even when
# neither service above runs
networks:
rezervator:
name: ${REZERVATOR_PREFIX:-rezervator}
external: true
volumes:
letsencrypt:
postgres-data: