services: mongo: image: mongo:7 restart: unless-stopped # modest cache so the whole stack fits comfortably on small hosts command: ["mongod", "--wiredTigerCacheSizeGB", "0.5"] # WiredTiger needs far more FDs than the 1024 some hosts default to; # running out crashes mongod with a WT_PANIC during file creation ulimits: nofile: soft: 64000 hard: 64000 # Mongo is reachable only on the compose network; never published to the # host (ยง12). volumes: - mongo-data:/data/db healthcheck: test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping').ok"] interval: 10s timeout: 5s retries: 5 start_period: 15s app: build: . restart: unless-stopped env_file: .env environment: MONGO_URI: mongodb://mongo:27017 ports: - "127.0.0.1:${APP_PORT:-8787}:8787" depends_on: mongo: condition: service_healthy healthcheck: test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8787/healthz"] interval: 10s timeout: 5s retries: 3 start_period: 10s volumes: mongo-data: