diff --git a/docker-compose.yml b/docker-compose.yml index 7da0e66..e7f6056 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,21 +1,13 @@ # ============================================================================= -# PatchMon Docker Compose - Production +# PatchMon Docker Swarm Stack - Production # ============================================================================= -# Before starting, copy env.example to .env and fill in your values: -# -# cp env.example .env -# -# Then start PatchMon: -# -# docker compose up -d -# -# See the PatchMon documentation for full configuration details. +# Deploy via Portainer as a stack, with your .env file contents pasted +# into the "Environment variables" section in Portainer. # ============================================================================= services: database: image: postgres:17-alpine - restart: unless-stopped environment: POSTGRES_DB: patchmon_db POSTGRES_USER: patchmon_user @@ -34,14 +26,18 @@ services: options: max-size: "10m" max-file: "3" + deploy: + replicas: 1 + restart_policy: + condition: on-failure + delay: 5s + max_attempts: 3 + placement: + constraints: + - node.hostname == Docker-Swarm-1 redis: image: redis:7-alpine - restart: unless-stopped - # Simple Redis configuration - no memory limits to prevent OOM errors - # If you need memory limits, set maxmemory-policy to 'allkeys-lru' instead of 'noeviction' - # to allow eviction rather than rejecting commands - # Debug logging: Use --loglevel debug for maximum verbosity, or --loglevel verbose for less output command: redis-server --requirepass ${REDIS_PASSWORD} volumes: - redis_data:/data @@ -57,13 +53,19 @@ services: options: max-size: "10m" max-file: "3" + deploy: + replicas: 1 + restart_policy: + condition: on-failure + delay: 5s + max_attempts: 3 + placement: + constraints: + - node.hostname == Docker-Swarm-1 backend: image: ghcr.io/patchmon/patchmon-backend:latest - restart: unless-stopped - env_file: .env environment: - # Internal Docker wiring - do not change DATABASE_URL: postgresql://patchmon_user:${POSTGRES_PASSWORD}@database:5432/patchmon_db REDIS_HOST: redis REDIS_PORT: 6379 @@ -75,31 +77,43 @@ services: - branding_assets:/app/assets networks: - patchmon-internal - depends_on: - - database - - redis logging: driver: "json-file" options: max-size: "10m" max-file: "3" + deploy: + replicas: 1 + restart_policy: + condition: on-failure + delay: 5s + max_attempts: 3 + placement: + constraints: + - node.hostname == Docker-Swarm-1 frontend: image: ghcr.io/patchmon/patchmon-frontend:latest - restart: unless-stopped ports: - "3030:3000" volumes: - branding_assets:/usr/share/nginx/html/assets networks: - patchmon-internal - depends_on: - - backend logging: driver: "json-file" options: max-size: "10m" max-file: "3" + deploy: + replicas: 1 + restart_policy: + condition: on-failure + delay: 5s + max_attempts: 3 + placement: + constraints: + - node.hostname == Docker-Swarm-1 volumes: postgres_data: @@ -109,4 +123,4 @@ volumes: networks: patchmon-internal: - driver: bridge + driver: overlay \ No newline at end of file