services: # ========================================================================= # MySQL Database # ========================================================================= mysql: image: mysql:8.0 container_name: mixarr_mysql hostname: mysql restart: unless-stopped environment: - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} - MYSQL_DATABASE=${MYSQL_DATABASE} - MYSQL_USER=${MYSQL_USER} - MYSQL_PASSWORD=${MYSQL_PASSWORD} volumes: - ./mysql_data:/var/lib/mysql command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci networks: - mixarr_internal deploy: resources: limits: memory: 1G cpus: '1.0' healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD}"] interval: 10s timeout: 5s retries: 5 labels: - "autoheal=true" - "com.centurylinklabs.watchtower.enable=true" # ========================================================================= # Redis Cache # ========================================================================= redis: image: redis:7-alpine container_name: mixarr_redis hostname: redis restart: unless-stopped volumes: - ./redis_data:/data command: redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru networks: - mixarr_internal deploy: resources: limits: memory: 256M cpus: '0.5' healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 labels: - "autoheal=true" - "com.centurylinklabs.watchtower.enable=true" # ========================================================================= # Mixarr API # ========================================================================= api: image: ghcr.io/aquantumofdonuts/mixarr:latest container_name: mixarr_api hostname: api restart: unless-stopped ports: - "3005:3005" environment: - DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql:3306/${MYSQL_DATABASE} - REDIS_URL=redis://redis:6379 - SESSION_SECRET=${SESSION_SECRET} - PORT=3005 - NODE_ENV=production volumes: - ./api_data:/data depends_on: mysql: condition: service_healthy redis: condition: service_healthy command: > sh -c "npx prisma migrate deploy && node apps/api/dist/index.js" networks: - mixarr_internal - proxy deploy: resources: limits: memory: 512M cpus: '1.0' healthcheck: test: ["CMD-SHELL", "curl -f http://localhost:3005/api/health || exit 1"] interval: 30s timeout: 10s retries: 3 start_period: 120s labels: - "autoheal=true" - "com.centurylinklabs.watchtower.enable=true" # ========================================================================= # Mixarr Web Frontend # ========================================================================= web: image: ghcr.io/aquantumofdonuts/mixarr:latest container_name: mixarr_web hostname: web restart: unless-stopped ports: - "3006:3000" environment: - NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} - SESSION_SECRET=${SESSION_SECRET} - NODE_ENV=production volumes: - ./web_data:/data depends_on: - api networks: - mixarr_internal - proxy deploy: resources: limits: memory: 512M cpus: '1.0' labels: - "autoheal=true" - "com.centurylinklabs.watchtower.enable=true" - "homepage.group=Media" - "homepage.name=Mixarr" - "homepage.icon=lidarr.png" - "homepage.href=https://mixarr.3ddbrewery.com" networks: mixarr_internal: driver: bridge proxy: external: true