mirror of
https://github.com/selfhosters-cc/container-census.git
synced 2026-01-26 16:38:28 -06:00
1. Added optional security to the UI for the server and telemtry collector 2. Expanded the telemetry being collected and the telemetry UI accordingly 3. Documentation update 4. Enhanced charting
84 lines
2.7 KiB
YAML
84 lines
2.7 KiB
YAML
# Example Docker Compose for Container Census Agent
|
|
# Deploy this on remote hosts to enable agent-based monitoring
|
|
|
|
version: '3.8'
|
|
|
|
services:
|
|
census-agent:
|
|
image: ghcr.io/selfhosters-cc/census-agent:latest
|
|
container_name: census-agent
|
|
restart: unless-stopped
|
|
|
|
# Add Docker socket GID at runtime (portable across hosts)
|
|
group_add:
|
|
- "${DOCKER_GID:-999}"
|
|
|
|
ports:
|
|
- "9876:9876"
|
|
|
|
volumes:
|
|
# Docker socket for container management
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
|
|
environment:
|
|
# API token for authentication (generated automatically if not set)
|
|
# To use a specific token, uncomment and set:
|
|
# API_TOKEN: your-secure-token-here
|
|
|
|
# Optional: Override port
|
|
# PORT: 9876
|
|
|
|
# Optional: Set timezone
|
|
TZ: ${TZ:-UTC}
|
|
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9876/health"]
|
|
interval: 30s
|
|
timeout: 3s
|
|
retries: 3
|
|
start_period: 5s
|
|
|
|
networks:
|
|
default:
|
|
name: census-agent-network
|
|
|
|
# ==============================================================================
|
|
# Quick Start
|
|
# ==============================================================================
|
|
#
|
|
# 1. Set up Docker socket permissions:
|
|
# echo "DOCKER_GID=$(stat -c '%g' /var/run/docker.sock)" > .env
|
|
#
|
|
# 2. Start the agent:
|
|
# docker-compose -f docker-compose.agent.example.yml up -d
|
|
#
|
|
# 3. Get the generated API token from logs:
|
|
# docker logs census-agent | grep "API Token"
|
|
# # Output: "Generated API token: abc123..."
|
|
#
|
|
# 4. Add to Census Server:
|
|
# - In Census UI, click "+ Add Agent Host"
|
|
# - URL: http://THIS_HOST_IP:9876
|
|
# - Token: (from step 3)
|
|
# - Click "Test Connection" then "Add Agent"
|
|
#
|
|
# ==============================================================================
|
|
# Notes
|
|
# ==============================================================================
|
|
#
|
|
# - The agent will auto-generate a secure token on first start
|
|
# - Token is logged once and stored persistently
|
|
# - To use a specific token, set API_TOKEN in .env file
|
|
# - The agent runs as non-root (UID 1000) for security
|
|
# - DOCKER_GID must match your Docker socket GID
|
|
#
|
|
# ==============================================================================
|
|
# Management
|
|
# ==============================================================================
|
|
#
|
|
# View logs: docker-compose -f docker-compose.agent.example.yml logs -f
|
|
# Restart: docker-compose -f docker-compose.agent.example.yml restart
|
|
# Stop: docker-compose -f docker-compose.agent.example.yml down
|
|
# Check health: docker exec census-agent wget -qO- http://localhost:9876/health
|
|
#
|