major-domo-v2/docker-compose.yml
Cal Corum 03dd449551
All checks were successful
Build Docker Image / build (pull_request) Successful in 57s
fix: split read-only data volume to allow state file writes (#85)
The data/ volume was mounted :ro to protect Google Sheets credentials,
but this also prevented all state trackers from persisting JSON files
(scorecards, voice channels, trade channels, soak data), causing silent
save failures and stale data accumulating across restarts.

- Mount only the credentials file as :ro (file-level mount)
- Add a separate :rw storage/ volume for runtime state files
- Move all tracker default paths from data/ to storage/
- Add STATE_HOST_PATH env var (defaults to ./storage)
- Update SHEETS_CREDENTIALS_HOST_PATH semantics: now a file path
  (e.g. ./data/major-domo-service-creds.json) instead of a directory
- Add storage/ to .gitignore

Closes #85

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 13:34:43 -05:00

83 lines
2.1 KiB
YAML

version: '3.8'
# ============================================
# Production Configuration
# ============================================
# This compose file pulls the pre-built image from Docker Hub
#
# Usage:
# docker-compose pull
# docker-compose up -d
#
# Docker Hub Repository: manticorum67/major-domo-discordapp
services:
discord-bot:
# Build locally from Dockerfile
build:
context: .
dockerfile: Dockerfile
container_name: major-domo-discord-bot-v2
# Restart policy
restart: unless-stopped
# Environment variables from .env file
env_file:
- .env
# Environment configuration (uses .env file values)
environment:
- LOG_LEVEL=${LOG_LEVEL:-INFO}
- ENVIRONMENT=${ENVIRONMENT:-production}
- TESTING=${TESTING:-false}
- REDIS_URL=${REDIS_URL:-}
- REDIS_CACHE_TTL=${REDIS_CACHE_TTL:-300}
# Volume mounts
volumes:
# Google Sheets credentials (read-only, file mount)
- ${SHEETS_CREDENTIALS_HOST_PATH:-./data/major-domo-service-creds.json}:/app/data/major-domo-service-creds.json:ro
# Runtime state files (writable) - scorecards, voice channels, trade channels, soak data
- ${STATE_HOST_PATH:-./storage}:/app/storage:rw
# Logs directory (persistent) - mounted to /app/logs where the application expects it
- ${LOGS_HOST_PATH:-./logs}:/app/logs:rw
# Development volumes for local testing
- ../dev-logs:/app/dev-logs:rw
- ../dev-storage:/app/dev-storage:rw
# Network configuration
networks:
- major-domo-network
# Health check
healthcheck:
test: ["CMD", "python", "-c", "import sys; sys.exit(0)"]
interval: 60s
timeout: 10s
retries: 3
# Resource limits (production)
deploy:
resources:
limits:
cpus: '1.0'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
# Logging configuration
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
major-domo-network:
driver: bridge