72 lines
2.4 KiB
YAML
72 lines
2.4 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# Traefik reverse proxy
|
|
traefik:
|
|
image: traefik:v3.0
|
|
container_name: quixotic-traefik
|
|
restart: unless-stopped
|
|
command:
|
|
- --api.dashboard=true
|
|
- --api.insecure=true
|
|
- --providers.docker=true
|
|
- --providers.docker.exposedbydefault=false
|
|
- --entrypoints.web.address=:80
|
|
- --entrypoints.websecure.address=:443
|
|
- --certificatesresolvers.myresolver.acme.tlschallenge=true
|
|
- --certificatesresolvers.myresolver.acme.email=${ACME_EMAIL:-admin@example.com}
|
|
- --certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json
|
|
- --log.level=INFO
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
- "8080:8080" # Traefik dashboard
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
- traefik-ssl-certs:/letsencrypt
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.traefik.rule=Host(`traefik.${DOMAIN:-localhost}`)"
|
|
- "traefik.http.routers.traefik.service=api@internal"
|
|
- "traefik.http.routers.traefik.middlewares=auth"
|
|
- "traefik.http.middlewares.auth.basicauth.users=${TRAEFIK_AUTH:-admin:$$2y$$10$$8qCUOc.FKLB8o4X8ZGVb7OU4xrslBUjOdBPtRz9wM7YJ9.XsGVzui}" # admin:password
|
|
networks:
|
|
- quixotic
|
|
|
|
# Main application
|
|
quixotic-app:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: quixotic-app
|
|
restart: unless-stopped
|
|
environment:
|
|
- NODE_ENV=production
|
|
- PORT=3000
|
|
volumes:
|
|
- downloads:/app/downloads
|
|
- ./database:/app/database
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.quixotic.rule=Host(`${DOMAIN:-localhost}`)"
|
|
- "traefik.http.routers.quixotic.entrypoints=websecure"
|
|
- "traefik.http.routers.quixotic.tls.certresolver=myresolver"
|
|
- "traefik.http.routers.quixotic.service=quixotic"
|
|
- "traefik.http.services.quixotic.loadbalancer.server.port=3000"
|
|
# HTTP to HTTPS redirect
|
|
- "traefik.http.routers.quixotic-http.rule=Host(`${DOMAIN:-localhost}`)"
|
|
- "traefik.http.routers.quixotic-http.entrypoints=web"
|
|
- "traefik.http.routers.quixotic-http.middlewares=redirect-to-https"
|
|
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
|
|
depends_on:
|
|
- traefik
|
|
networks:
|
|
- quixotic
|
|
|
|
volumes:
|
|
traefik-ssl-certs:
|
|
downloads:
|
|
|
|
networks:
|
|
quixotic:
|
|
driver: bridge |