towerops-agent/docker-compose.example.yml
Graham McIntire 368ca5a0a6
Add DOCKER_API_VERSION to Watchtower configuration
Prevents 'client version too old' errors when Watchtower tries to
communicate with modern Docker daemons that require API version 1.44+
2026-01-16 17:39:10 -06:00

100 lines
3.1 KiB
YAML

version: '3.8'
services:
towerops-agent:
# Use 'main' tag for automatic updates (updated on every push to main)
# Or use 'latest' for stable releases only (updated on git tags)
image: gmcintire/towerops-agent:main
container_name: towerops-agent
restart: unless-stopped
environment:
# Required: Your Towerops API URL
- TOWEROPS_API_URL=https://app.towerops.com
# Required: Agent authentication token (from Towerops web UI)
# Get this from: Organization > Agents > Create New Agent
- TOWEROPS_AGENT_TOKEN=your-agent-token-here
# Optional: How often to refresh configuration (seconds)
# Default: 300 (5 minutes)
# - CONFIG_REFRESH_SECONDS=300
# Optional: Database path for metrics buffering
# Default: /data/towerops-agent.db
# - DATABASE_PATH=/data/towerops-agent.db
# Optional: Log level (error, warn, info, debug, trace)
# Default: info
# - RUST_LOG=info
volumes:
# Persistent storage for metrics buffering
- ./data:/data
labels:
# Enable automatic updates via Watchtower
- "com.centurylinklabs.watchtower.enable=true"
# Optional: Set update scope (can be used to group updates)
- "com.centurylinklabs.watchtower.scope=towerops"
# Optional: Resource limits
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.1'
memory: 128M
watchtower:
image: containrrr/watchtower:latest
container_name: towerops-watchtower
restart: unless-stopped
environment:
# Check for updates every 15 minutes (900 seconds)
# For production, consider increasing to 1800 (30 min) or 3600 (1 hour)
- WATCHTOWER_POLL_INTERVAL=900
# Only update containers with the watchtower.enable label
- WATCHTOWER_LABEL_ENABLE=true
# Clean up old images after update
- WATCHTOWER_CLEANUP=true
# Include stopped containers in updates
- WATCHTOWER_INCLUDE_STOPPED=true
# Use latest Docker API version (prevents "client version too old" errors)
- DOCKER_API_VERSION=1.44
# Optional: Send notifications (Slack, Discord, email, etc.)
# See: https://containrrr.dev/watchtower/notifications/
# - WATCHTOWER_NOTIFICATIONS=slack
# - WATCHTOWER_NOTIFICATION_SLACK_HOOK_URL=https://hooks.slack.com/services/...
# Optional: Only update containers with specific scope
# - WATCHTOWER_SCOPE=towerops
# Log level (panic, fatal, error, warn, info, debug, trace)
- WATCHTOWER_LOG_LEVEL=info
# Optional: Run once and exit (for scheduled cron jobs)
# - WATCHTOWER_RUN_ONCE=true
# Optional: Custom update schedule (cron format)
# Default: check every POLL_INTERVAL seconds
# - WATCHTOWER_SCHEDULE=0 0 4 * * * # 4am daily
volumes:
# Docker socket to monitor and update containers
- /var/run/docker.sock:/var/run/docker.sock
# Optional: Resource limits
deploy:
resources:
limits:
cpus: '0.1'
memory: 128M