The agent now checks for updates every hour and automatically updates itself when a new version is available on Docker Hub. Features: - Periodic update checks (hourly via scheduler) - Automatic Docker image pull when update available - Graceful exit and restart with new version - Non-blocking, runs in background task - Requires Docker socket mount for self-update Changes: - Add UpdateInfo struct and get_update_info() function - Add perform_self_update() to pull new image and restart - Add update check ticker to scheduler (hourly) - Include docker-cli in Dockerfile runtime stage - Update docker-compose.example.yml with socket mount - Update README and CLAUDE.md with auto-update docs The agent will log update status: - "Already running latest version" - no action - "Performing self-update: X -> Y" - pulling new image - "Exiting to allow restart with new version" - restarting Requires: - Docker socket mounted: /var/run/docker.sock:/var/run/docker.sock - restart: unless-stopped in docker-compose (to restart after exit)
45 lines
1.3 KiB
YAML
45 lines
1.3 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
towerops-agent:
|
|
image: registry.gitlab.com/towerops/towerops-agent:latest
|
|
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
|
|
|
|
# Docker socket (required for automatic self-updates)
|
|
# The agent will check for updates hourly and automatically update itself
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
|
|
# Optional: Resource limits
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
reservations:
|
|
cpus: '0.1'
|
|
memory: 128M
|