services: # Reverse Proxy with Auto-TLS traefik: image: traefik:v2.11 container_name: waouw_traefik restart: unless-stopped ports: - "80:80" - "443:443" volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - /etc/waouw/traefik:/config:ro - traefik_certificates:/certificates - traefik_logs:/var/log/traefik environment: - ACME_EMAIL=${ACME_EMAIL} command: - --configFile=/config/traefik.yml - --entrypoints.web.address=:80 - --entrypoints.websecure.address=:443 - --providers.docker=true - --providers.docker.endpoint=unix:///var/run/docker.sock - --api.dashboard=true - --api.insecure=true - --providers.file.filename=/config/dynamic.yml - --providers.file.watch=true - --ping=true - --providers.docker.network=waouw_traefik - --accesslog=true - --accesslog.filepath=/var/log/traefik/access.log - --accesslog.bufferingsize=100 - --certificatesresolvers.letsencrypt.acme.email=${ACME_EMAIL} - --certificatesresolvers.letsencrypt.acme.storage=/certificates/acme.json - --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web labels: - "traefik.enable=true" - "traefik.http.routers.api.rule=Host(`traefik.${WAOUW_DOMAIN:-localhost}`)" - "traefik.http.routers.api.tls.certresolver=letsencrypt" networks: - traefik healthcheck: test: ["CMD", "wget", "--spider", "-q", "http://localhost:8080/ping"] interval: 30s timeout: 10s retries: 3 postgres: image: postgres:15-alpine container_name: waouw_postgres restart: unless-stopped environment: POSTGRES_DB: waouw POSTGRES_USER: waouw POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=C --lc-ctype=C" volumes: - postgres_data:/var/lib/postgresql/data - ./init-db.sql:/docker-entrypoint-initdb.d/init-db.sql:ro networks: - backend healthcheck: test: ["CMD-SHELL", "pg_isready -U waouw"] interval: 30s timeout: 10s retries: 3 deploy: resources: limits: memory: 256M cpus: '0.5' reservations: memory: 128M redis: image: redis:7-alpine container_name: waouw_redis restart: unless-stopped command: redis-server --maxmemory 64mb --maxmemory-policy allkeys-lru volumes: - redis_data:/data networks: - backend healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 30s timeout: 10s retries: 3 deploy: resources: limits: memory: 128M cpus: '0.25' backend: build: context: ../BACKEND dockerfile: Dockerfile args: - BUILDPLATFORM=${BUILDPLATFORM:-linux/arm64} container_name: waouw_backend restart: unless-stopped environment: - DATABASE_URL=${DATABASE_URL} - REDIS_URL=${REDIS_URL} - JWT_SECRET_KEY=${JWT_SECRET_KEY} - DEVICE_HMAC_SECRET=${DEVICE_HMAC_SECRET} - WAOUW_DOMAIN=${WAOUW_DOMAIN:-waouw.local} - WAOUW_CLOUD_DOMAIN=${WAOUW_CLOUD_DOMAIN:-} - WAOUW_ADMIN_URL=${WAOUW_ADMIN_URL} - NEXTCLOUD_ADMIN_PASSWORD=${NEXTCLOUD_ADMIN_PASSWORD} - WAOUW_SUPPORT_SSH_USER=${WAOUW_SUPPORT_SSH_USER:-waouw} - WAOUW_SUPPORT_SSH_ROTATE=${WAOUW_SUPPORT_SSH_ROTATE:-1} - WAOUW_LAN_IP=${WAOUW_LAN_IP:-} - WAOUW_GATEWAY_IP=${WAOUW_GATEWAY_IP:-} - LOG_LEVEL=${LOG_LEVEL:-INFO} - MAIL_MYSQL_HOST=maildb - MAIL_MYSQL_USER=mailuser - MAIL_MYSQL_PASSWORD=${MAIL_MYSQL_PASSWORD} - MAIL_MYSQL_DATABASE=mailserver - SMTP_FROM_EMAIL=${SMTP_FROM_EMAIL:-waouwbox@waouw.tech} - SYNCTHING_URL=http://syncthing:8384 - SYNCTHING_API_KEY=${SYNCTHING_API_KEY:-} - MAIL_MYSQL_ROOT_PASSWORD=${MAIL_MYSQL_ROOT_PASSWORD} group_add: - "${DOCKER_GID:-985}" # docker group GID on host — gives access to /var/run/docker.sock cap_add: - SYS_ADMIN volumes: - /var/run/docker.sock:/var/run/docker.sock - /etc/waouw:/etc/waouw:rw - /opt/waouw/sites-data:/opt/waouw/sites-data:rw - /opt/waouw/VERSION.json:/app/VERSION.json:ro - backend_logs:/app/logs - sync_db_dumps:/data/sync-dumps - backup_data:/data/backups - dovecot_data:/data/dovecot:ro - nextcloud_storage:/data/nextcloud:ro networks: - backend - traefik - mail depends_on: postgres: condition: service_healthy redis: condition: service_healthy labels: - "traefik.enable=true" - "traefik.docker.network=waouw_traefik" - "traefik.http.routers.backend.rule=PathPrefix(`/api`)" - "traefik.http.routers.backend.entrypoints=web,websecure" - "traefik.http.routers.backend.tls=true" - "traefik.http.routers.backend.priority=100" - "traefik.http.services.backend.loadbalancer.server.port=8000" healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/health"] interval: 30s timeout: 10s retries: 3 deploy: resources: limits: memory: 512M cpus: '1.0' reservations: memory: 256M worker: build: context: ../BACKEND dockerfile: Dockerfile container_name: waouw_worker restart: unless-stopped command: celery -A app.tasks worker --loglevel=info --concurrency=2 environment: - DATABASE_URL=${DATABASE_URL} - REDIS_URL=${REDIS_URL} - CELERY_BROKER_URL=redis://redis:6379/1 - CELERY_RESULT_BACKEND=redis://redis:6379/2 - JWT_SECRET_KEY=${JWT_SECRET_KEY} - WAOUW_ADMIN_URL=${WAOUW_ADMIN_URL} - LOG_LEVEL=${LOG_LEVEL:-INFO} volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - /etc/waouw:/etc/waouw:rw - worker_logs:/app/logs networks: - backend depends_on: postgres: condition: service_healthy redis: condition: service_healthy healthcheck: test: ["CMD", "celery", "-A", "app.tasks", "inspect", "ping"] interval: 60s timeout: 30s retries: 3 deploy: resources: limits: memory: 256M cpus: '0.5' frontend: build: context: ../UI dockerfile: Dockerfile args: VITE_API_URL: ${VITE_API_URL:-/api/v1} container_name: waouw_frontend restart: unless-stopped depends_on: backend: condition: service_healthy networks: - traefik labels: - 'traefik.enable=true' - 'traefik.docker.network=waouw_traefik' - 'traefik.http.routers.frontend.rule=PathPrefix(`/`)' - 'traefik.http.routers.frontend.priority=1' - 'traefik.http.routers.frontend.entrypoints=web,websecure' - 'traefik.http.routers.frontend.tls=true' - 'traefik.http.services.frontend.loadbalancer.server.port=80' healthcheck: test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:80/"] interval: 30s timeout: 10s retries: 3 deploy: resources: limits: memory: 128M cpus: '0.25' mosquitto: image: eclipse-mosquitto:2.0 container_name: waouw_mosquitto restart: unless-stopped ports: - "1883:1883" volumes: - ./mosquitto.conf:/mosquitto/config/mosquitto.conf:ro - mosquitto_data:/mosquitto/data - mosquitto_logs:/mosquitto/log networks: - backend profiles: - mqtt healthcheck: test: ["CMD", "mosquitto_pub", "-h", "localhost", "-t", "test", "-m", "health"] interval: 30s timeout: 10s retries: 3 # ==== EMAIL STACK ==== maildb: image: mariadb:10.11 container_name: waouw_maildb restart: unless-stopped environment: MYSQL_ROOT_PASSWORD: ${MAIL_MYSQL_ROOT_PASSWORD} MYSQL_DATABASE: mailserver MYSQL_USER: mailuser MYSQL_PASSWORD: ${MAIL_MYSQL_PASSWORD} volumes: - maildb_data:/var/lib/mysql - ./mail-init.sql:/docker-entrypoint-initdb.d/init.sql:ro networks: - mail healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] interval: 30s timeout: 10s retries: 3 deploy: resources: limits: memory: 256M cpus: '0.5' postfix: image: boky/postfix:latest container_name: waouw_postfix restart: unless-stopped environment: HOSTNAME: ${WAOUW_DOMAIN:-waouw.local} ALLOWED_SENDER_DOMAINS: ${WAOUW_DOMAIN:-waouw.local} waouw.tech POSTFIX_myhostname: ${WAOUW_DOMAIN:-waouw.local} POSTFIX_mydestination: ${WAOUW_DOMAIN:-waouw.local} ports: - "25:25" - "587:587" volumes: - postfix_data:/var/lib/postfix - postfix_logs:/var/log networks: - mail - traefik depends_on: maildb: condition: service_healthy healthcheck: test: ["CMD", "nc", "-z", "localhost", "587"] interval: 30s timeout: 10s retries: 3 dovecot: image: dovecot/dovecot:latest-root container_name: waouw_dovecot restart: unless-stopped ports: - "143:143" - "993:993" - "110:110" - "995:995" volumes: - dovecot_data:/var/lib/dovecot - dovecot_config:/etc/dovecot networks: - mail depends_on: maildb: condition: service_healthy healthcheck: test: ["CMD", "nc", "-z", "localhost", "143"] interval: 30s timeout: 10s retries: 3 roundcube: image: roundcube/roundcubemail:latest-apache container_name: waouw_roundcube restart: unless-stopped environment: ROUNDCUBEMAIL_DB_TYPE: mysql ROUNDCUBEMAIL_DB_HOST: maildb ROUNDCUBEMAIL_DB_NAME: roundcube ROUNDCUBEMAIL_DB_USER: mailuser ROUNDCUBEMAIL_DB_PASSWORD: ${MAIL_MYSQL_PASSWORD} ROUNDCUBEMAIL_DEFAULT_HOST: dovecot ROUNDCUBEMAIL_SMTP_SERVER: postfix volumes: - roundcube_data:/var/www/html networks: - mail - traefik depends_on: dovecot: condition: service_healthy postfix: condition: service_healthy labels: - "traefik.enable=true" - "traefik.http.routers.roundcube.rule=Host(`mail.${WAOUW_DOMAIN:-localhost}`) || PathPrefix(`/webmail`)" - "traefik.http.routers.roundcube.tls.certresolver=letsencrypt" - "traefik.http.services.roundcube.loadbalancer.server.port=80" healthcheck: test: ["CMD", "curl", "-f", "http://localhost:80"] interval: 30s timeout: 10s retries: 3 mailadmin: image: postfixadmin:apache container_name: waouw_mailadmin restart: unless-stopped environment: POSTFIXADMIN_DB_TYPE: mysqli POSTFIXADMIN_DB_HOST: maildb POSTFIXADMIN_DB_NAME: mailserver POSTFIXADMIN_DB_USER: mailuser POSTFIXADMIN_DB_PASSWORD: ${MAIL_MYSQL_PASSWORD} volumes: - mailadmin_data:/var/www/html networks: - mail - traefik depends_on: maildb: condition: service_healthy labels: - "traefik.enable=true" - "traefik.http.routers.mailadmin.rule=Host(`mailadmin.${WAOUW_DOMAIN:-localhost}`) || PathPrefix(`/mailadmin`)" - "traefik.http.routers.mailadmin.tls.certresolver=letsencrypt" - "traefik.http.services.mailadmin.loadbalancer.server.port=80" healthcheck: test: ["CMD", "curl", "-f", "http://localhost:80"] interval: 30s timeout: 10s retries: 3 # ==== CLOUD & STORAGE ==== nextcloud_db: image: mariadb:10.11 container_name: waouw_nextcloud_db restart: unless-stopped environment: MYSQL_ROOT_PASSWORD: ${NEXTCLOUD_MYSQL_ROOT_PASSWORD} MYSQL_DATABASE: nextcloud MYSQL_USER: nextcloud MYSQL_PASSWORD: ${NEXTCLOUD_MYSQL_PASSWORD} volumes: - nextcloud_db_data:/var/lib/mysql networks: - nextcloud healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] interval: 30s timeout: 10s retries: 3 nextcloud: image: nextcloud:30-apache container_name: waouw_nextcloud restart: unless-stopped environment: MYSQL_HOST: nextcloud_db MYSQL_DATABASE: nextcloud MYSQL_USER: nextcloud MYSQL_PASSWORD: ${NEXTCLOUD_MYSQL_PASSWORD} NEXTCLOUD_ADMIN_USER: admin NEXTCLOUD_ADMIN_PASSWORD: ${NEXTCLOUD_ADMIN_PASSWORD} NEXTCLOUD_TRUSTED_DOMAINS: ${WAOUW_DOMAIN:-localhost} ${WAOUW_CLOUD_DOMAIN:-cloud.${WAOUW_DOMAIN:-localhost}} REDIS_HOST: redis volumes: - nextcloud_data:/var/www/html - nextcloud_config:/var/www/html/config - nextcloud_storage:/var/www/html/data networks: - nextcloud - backend - traefik depends_on: nextcloud_db: condition: service_healthy redis: condition: service_healthy labels: - "traefik.enable=true" - "traefik.http.routers.nextcloud.rule=Host(`${WAOUW_CLOUD_DOMAIN:-cloud.${WAOUW_DOMAIN:-localhost}}`) || PathPrefix(`/nextcloud`)" - "traefik.http.routers.nextcloud.tls.certresolver=letsencrypt" - "traefik.http.services.nextcloud.loadbalancer.server.port=80" - "traefik.http.middlewares.nextcloud.headers.customrequestheaders.X-Forwarded-Proto=https" - "traefik.http.routers.nextcloud.middlewares=nextcloud" healthcheck: test: ["CMD", "curl", "-f", "http://localhost:80/status.php"] interval: 30s timeout: 10s retries: 3 deploy: resources: limits: memory: 512M cpus: '1.0' # ==== SYSTEM MANAGEMENT ==== # webmin: désactivé (pas d'image Docker ARM64 fiable) # Installer webmin directement sur l'hôte si nécessaire : # curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh && sh setup-repos.sh && apt-get install -y webmin webmin: image: alpine:3.19 container_name: waouw_webmin entrypoint: ["sh", "-c", "echo 'Webmin placeholder - install on host instead' && sleep infinity"] restart: unless-stopped networks: - traefik labels: - "traefik.enable=true" - "traefik.http.routers.webmin.rule=Host(`admin.${WAOUW_DOMAIN:-localhost}`) && PathPrefix(`/webmin`)" - "traefik.http.routers.webmin.tls.certresolver=letsencrypt" - "traefik.http.services.webmin.loadbalancer.server.port=10000" - "traefik.http.services.webmin.loadbalancer.server.scheme=https" healthcheck: test: ["CMD", "nc", "-z", "localhost", "10000"] interval: 30s timeout: 10s retries: 3 phpmyadmin: image: phpmyadmin:latest container_name: waouw_phpmyadmin restart: unless-stopped environment: PMA_ARBITRARY: 1 PMA_HOSTS: maildb,nextcloud_db PMA_USER: root PMA_PASSWORD: ${PHPMYADMIN_PASSWORD} networks: - backend - mail - nextcloud - traefik depends_on: postgres: condition: service_healthy labels: - "traefik.enable=true" - "traefik.http.routers.phpmyadmin.rule=Host(`db.${WAOUW_DOMAIN:-localhost}`) || PathPrefix(`/phpmyadmin`)" - "traefik.http.routers.phpmyadmin.tls.certresolver=letsencrypt" - "traefik.http.services.phpmyadmin.loadbalancer.server.port=80" healthcheck: test: ["CMD", "curl", "-f", "http://localhost:80"] interval: 30s timeout: 10s retries: 3 # ==== SECURITY & VPN ==== fail2ban: image: crazymax/fail2ban:latest container_name: waouw_fail2ban restart: unless-stopped environment: TZ: Europe/Paris F2B_LOG_TARGET: STDOUT F2B_LOG_LEVEL: INFO SSMTP_HOST: postfix SSMTP_PORT: 587 SSMTP_TLS: "YES" volumes: - fail2ban_data:/data - /var/log:/var/log - ./fail2ban/jail.d:/data/jail.d:ro - ./fail2ban/filter.d:/data/filter.d:ro - traefik_logs:/var/log/traefik:ro networks: - mail - traefik cap_add: - NET_ADMIN - NET_RAW healthcheck: test: ["CMD", "fail2ban-client", "ping"] interval: 30s timeout: 10s retries: 3 openvpn: image: lunderhage/openvpn-rpi:latest container_name: waouw_openvpn restart: unless-stopped ports: - "1194:1194/udp" volumes: - openvpn_data:/etc/openvpn - openvpn_config:/tmp/openvpn networks: - vpn cap_add: - NET_ADMIN devices: - /dev/net/tun environment: OVPN_SERVER_URL: udp://${WAOUW_DOMAIN:-waouw.local}:1194 profiles: - vpn healthcheck: test: ["CMD", "nc", "-zu", "localhost", "1194"] interval: 30s timeout: 10s retries: 3 # ==== RELAY TUNNEL (WireGuard client) ==== wg-tunnel: image: linuxserver/wireguard:latest container_name: waouw_wg_tunnel restart: unless-stopped cap_add: - NET_ADMIN - SYS_MODULE sysctls: - net.ipv4.conf.all.src_valid_mark=1 volumes: - wg_tunnel_config:/config - /lib/modules:/lib/modules:ro environment: PUID: 1000 PGID: 1000 TZ: Europe/Paris networks: - traefik profiles: - relay healthcheck: test: ["CMD", "wg", "show", "wg0"] interval: 30s timeout: 10s retries: 3 # ==== BACKUP & SYNC ==== syncthing: image: syncthing/syncthing:latest container_name: waouw_syncthing restart: unless-stopped hostname: waouw-syncthing environment: STNODEFAULTFOLDER: "true" STGUIADDRESS: "0.0.0.0:8384" PUID: "1000" PGID: "1000" ports: - "22000:22000/tcp" - "22000:22000/udp" volumes: - syncthing_config:/var/syncthing - /var/www:/sync/sites:ro - dovecot_data:/sync/dovecot:ro - postfix_data:/sync/postfix:ro - nextcloud_storage:/sync/nextcloud:ro - /etc/waouw:/sync/waouw-config:ro - sync_db_dumps:/sync/db-dumps:ro networks: - backend healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8384/rest/noauth/health"] interval: 30s timeout: 10s retries: 3 deploy: resources: limits: memory: 256M cpus: '0.5' # ==== MONITORING & LOGS ==== # Graylog + OpenSearch + MongoDB : désactivés sur Raspberry Pi # (4-6 Go de RAM requis, OpenSearch incompatible ARM RPi4) # Réactiver sur serveur x86 avec plus de RAM si nécessaire prometheus: image: prom/prometheus:v2.52.0 container_name: waouw_prometheus volumes: - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro networks: - backend - traefik labels: - "traefik.enable=true" - "traefik.http.routers.prom.rule=Host(`metrics.${WAOUW_DOMAIN:-localhost}`) || PathPrefix(`/prom`)" - "traefik.http.routers.prom.tls.certresolver=letsencrypt" - "traefik.http.services.prom.loadbalancer.server.port=9090" healthcheck: test: ["CMD", "wget", "-q", "-O", "-", "http://localhost:9090/-/healthy"] interval: 30s timeout: 10s retries: 3 grafana: image: grafana/grafana:10.4.2 container_name: waouw_grafana environment: - GF_SECURITY_ADMIN_USER=admin - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD} networks: - traefik - backend depends_on: prometheus: condition: service_healthy labels: - "traefik.enable=true" - "traefik.http.routers.grafana.rule=Host(`dashboard.${WAOUW_DOMAIN:-localhost}`) || PathPrefix(`/dashboard`)" - "traefik.http.routers.grafana.tls.certresolver=letsencrypt" - "traefik.http.services.grafana.loadbalancer.server.port=3000" healthcheck: test: ["CMD", "wget", "-q", "-O", "-", "http://localhost:3000/api/health"] interval: 30s timeout: 10s retries: 3 volumes: postgres_data: { name: waouw_postgres_data } redis_data: { name: waouw_redis_data } traefik_certificates: { name: waouw_traefik_certificates } traefik_logs: { name: waouw_traefik_logs } backend_logs: { name: waouw_backend_logs } worker_logs: { name: waouw_worker_logs } mosquitto_data: { name: waouw_mosquitto_data } mosquitto_logs: { name: waouw_mosquitto_logs } maildb_data: { name: waouw_maildb_data } postfix_data: { name: waouw_postfix_data } postfix_logs: { name: waouw_postfix_logs } dovecot_data: { name: waouw_dovecot_data } dovecot_config: { name: waouw_dovecot_config } mail_storage: { name: waouw_mail_storage } roundcube_data: { name: waouw_roundcube_data } mailadmin_data: { name: waouw_mailadmin_data } nextcloud_db_data: { name: waouw_nextcloud_db_data } nextcloud_data: { name: waouw_nextcloud_data } nextcloud_config: { name: waouw_nextcloud_config } nextcloud_storage: { name: waouw_nextcloud_storage } wg_tunnel_config: { name: waouw_wg_tunnel_config } fail2ban_data: { name: waouw_fail2ban_data } openvpn_data: { name: waouw_openvpn_data } openvpn_config: { name: waouw_openvpn_config } syncthing_config: { name: waouw_syncthing_config } sync_db_dumps: { name: waouw_sync_db_dumps } backup_data: { name: waouw_backup_data } # graylog/opensearch/mongo désactivés sur Pi networks: traefik: { name: waouw_traefik, driver: bridge } backend: { name: waouw_backend, driver: bridge, internal: true } mail: { name: waouw_mail, driver: bridge, internal: true } nextcloud: { name: waouw_nextcloud, driver: bridge, internal: true } vpn: { name: waouw_vpn, driver: bridge }