79 lines
2.7 KiB
YAML
79 lines
2.7 KiB
YAML
|
|
services:
|
||
|
|
# MongoDB database for persistent storage (optional - SQLite is used by default)
|
||
|
|
mongodb:
|
||
|
|
image: mongo:8.0
|
||
|
|
container_name: caddymanager-mongodb
|
||
|
|
restart: unless-stopped
|
||
|
|
environment:
|
||
|
|
- MONGO_INITDB_ROOT_USERNAME=mongoadmin
|
||
|
|
- MONGO_INITDB_ROOT_PASSWORD=someSecretPassword # Change for production!
|
||
|
|
ports:
|
||
|
|
- "27017:27017" # Expose for local dev, remove for production
|
||
|
|
volumes:
|
||
|
|
- mongodb_data:/data/db
|
||
|
|
networks:
|
||
|
|
- caddymanager
|
||
|
|
profiles:
|
||
|
|
- mongodb # Use 'docker-compose --profile mongodb up' to include MongoDB
|
||
|
|
|
||
|
|
# Backend API server
|
||
|
|
backend:
|
||
|
|
image: caddymanager/caddymanager-backend:latest
|
||
|
|
container_name: caddymanager-backend
|
||
|
|
restart: unless-stopped
|
||
|
|
environment:
|
||
|
|
- PORT=3000
|
||
|
|
# Database Engine Configuration (defaults to SQLite)
|
||
|
|
- DB_ENGINE=sqlite # Options: 'sqlite' or 'mongodb'
|
||
|
|
# SQLite Configuration (used when DB_ENGINE=sqlite)
|
||
|
|
- SQLITE_DB_PATH=/app/data/caddymanager.sqlite
|
||
|
|
# MongoDB Configuration (used when DB_ENGINE=mongodb)
|
||
|
|
- MONGODB_URI=mongodb://mongoadmin:someSecretPassword@mongodb:27017/caddymanager?authSource=admin
|
||
|
|
- CORS_ORIGIN=http://localhost:80
|
||
|
|
- LOG_LEVEL=debug
|
||
|
|
- CADDY_SANDBOX_URL=http://localhost:2019
|
||
|
|
- PING_INTERVAL=30000
|
||
|
|
- PING_TIMEOUT=2000
|
||
|
|
- AUDIT_LOG_MAX_SIZE_MB=100
|
||
|
|
- AUDIT_LOG_RETENTION_DAYS=90
|
||
|
|
- METRICS_HISTORY_MAX=1000 # Optional: max number of in-memory metric history snapshots to keep
|
||
|
|
- JWT_SECRET=your_jwt_secret_key_here # Change for production!
|
||
|
|
- JWT_EXPIRATION=24h
|
||
|
|
# Backend is now only accessible through frontend proxy
|
||
|
|
volumes:
|
||
|
|
- sqlite_data:/app/data # SQLite database storage
|
||
|
|
networks:
|
||
|
|
- caddymanager
|
||
|
|
|
||
|
|
# Frontend web UI
|
||
|
|
frontend:
|
||
|
|
image: caddymanager/caddymanager-frontend:latest
|
||
|
|
container_name: caddymanager-frontend
|
||
|
|
restart: unless-stopped
|
||
|
|
depends_on:
|
||
|
|
- backend
|
||
|
|
environment:
|
||
|
|
- BACKEND_HOST=backend:3000
|
||
|
|
- APP_NAME=Caddy Manager
|
||
|
|
- DARK_MODE=true
|
||
|
|
ports:
|
||
|
|
- "80:80" # Expose web UI
|
||
|
|
networks:
|
||
|
|
- caddymanager
|
||
|
|
|
||
|
|
networks:
|
||
|
|
caddymanager:
|
||
|
|
driver: bridge
|
||
|
|
|
||
|
|
volumes:
|
||
|
|
mongodb_data: # Only used when MongoDB profile is active
|
||
|
|
sqlite_data: # SQLite database storage
|
||
|
|
|
||
|
|
# Notes:
|
||
|
|
# - SQLite is the default database engine - no additional setup required!
|
||
|
|
# - To use MongoDB instead, set DB_ENGINE=mongodb and start with: docker-compose --profile mongodb up
|
||
|
|
# - For production, use strong passwords and consider secrets management.
|
||
|
|
# - The backend uses SQLite by default, storing data in a persistent volume.
|
||
|
|
# - The frontend proxies all /api/* requests to the backend service.
|
||
|
|
# - Backend is not directly exposed - all API access goes through the frontend proxy.
|