# LetsBe Ansible Runner - Docker Compose for Hub Integration # # This file is used by the Hub to spawn provisioning containers. # Each provisioning job gets its own container instance. # # Usage (by Hub): # JOB_ID="abc123" HUB_API_URL="https://hub.letsbe.solutions" \ # RUNNER_TOKEN="..." CONFIG_PATH="/path/to/config.json" \ # docker compose -p letsbe-runner-abc123 up -d # # The container will: # 1. Load config from /job/config.json # 2. SSH to target server # 3. Upload and execute provisioning scripts # 4. Stream logs back to Hub API # 5. Exit when complete (success or failure) services: runner: build: . image: ${RUNNER_IMAGE:-code.letsbe.solutions/letsbe/ansible-runner:latest} container_name: letsbe-runner-${JOB_ID:-manual} # Mount the job-specific config file volumes: - ${CONFIG_PATH:-./config.json}:/job/config.json:ro - ${LOGS_PATH:-./logs}:/logs # Environment variables for Hub communication environment: - HUB_API_URL=${HUB_API_URL:-https://hub.letsbe.solutions} - JOB_ID=${JOB_ID} - RUNNER_TOKEN=${RUNNER_TOKEN} - JOB_CONFIG_PATH=/job/config.json # Network configuration # Development: Use 'host' or add extra_hosts for host.docker.internal # Production: Use 'letsbe-network' shared network network_mode: ${NETWORK_MODE:-bridge} extra_hosts: - "host.docker.internal:host-gateway" # Resource limits to prevent runaway processes deploy: resources: limits: cpus: '1.0' memory: 512M reservations: cpus: '0.25' memory: 128M # Container will exit when provisioning completes # Hub should poll for status via API restart: "no" # Health check (optional - container is short-lived) # healthcheck: # test: ["CMD", "curl", "-f", "http://localhost/health"] # interval: 30s # timeout: 10s # retries: 3 # Optional: Define a persistent network for production networks: default: name: ${DOCKER_NETWORK:-letsbe-runner-network} driver: bridge