# ============================================================================ # Nerd Monitor Docker Compose Configuration # ============================================================================ # # This file provides multiple ways to run Nerd Monitor: # # 1. Full Stack (Server + Agent): # docker-compose up # # 2. Server Only: # docker-compose up server # # 3. Agent Only (requires external server): # docker-compose up agent # (Set SERVER env var: SERVER=your-server:8080 docker-compose up agent) # # 4. Multiple Agents: # docker-compose up -d server # docker-compose run --name agent1 -e AGENT_ID=machine1 agent # docker-compose run --name agent2 -e AGENT_ID=machine2 agent # # ============================================================================ services: # ========================================================================= # Nerd Monitor Server # ========================================================================= # Web UI and API endpoint for collecting agent statistics # # Environment Variables: # ADDR: Server bind address (default: 0.0.0.0) # PORT: Server port (default: 8080) # USERNAME: Admin username (default: admin) # PASSWORD: Admin password (default: admin) - CHANGE IN PRODUCTION # server: build: context: . dockerfile: Dockerfile.server container_name: nerd-monitor-server ports: - "8080:8080" environment: # Server configuration ADDR: "0.0.0.0" PORT: "8080" # IMPORTANT: Change these credentials in production! USERNAME: "admin" PASSWORD: "admin" healthcheck: test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/login"] interval: 30s timeout: 3s retries: 3 start_period: 5s restart: unless-stopped networks: - nerd-monitor # Resource limits (optional, uncomment to enable) # deploy: # resources: # limits: # cpus: '0.5' # memory: 512M # ========================================================================= # Nerd Monitor Agent # ========================================================================= # Lightweight monitoring agent that reports system stats to the server # # Environment Variables: # SERVER: Server address (default: server:8080 when using docker-compose) # INTERVAL: Reporting interval (default: 15s) # AGENT_ID: Optional agent identifier (auto-generated from hostname if empty) # # Note: This agent depends on the server being healthy before starting # agent: build: context: . dockerfile: Dockerfile.agent environment: # Agent configuration SERVER: "server:8080" # Connect to the server service INTERVAL: "15s" # Report stats every 15 seconds # AGENT_ID: "my-machine" # Optional: set a custom agent ID depends_on: server: condition: service_healthy # Wait for server to be healthy restart: unless-stopped networks: - nerd-monitor # Resource limits (optional, uncomment to enable) # deploy: # resources: # limits: # cpus: '0.25' # memory: 128M networks: # Shared network for server and agent communication nerd-monitor: driver: bridge