Architecture Overview
What runs where, and how Labelgate, agents, cloudflared and Cloudflare fit together.
A Labelgate setup has one main instance and, optionally, agents on other Docker hosts. Only the main instance talks to Cloudflare.
Host A (main) Host B (agent)
┌──────────────────────────┐ ┌───────────────────────┐
│ containers with labels │ │ containers with labels│
│ │ │ │ │ │
│ ▼ │ /ws │ ▼ │
│ Labelgate main ◄────────┼───────┼── Labelgate agent │
│ - dashboard/API :28111 │ └───────────────────────┘
│ - database │
└──────────┬───────────────┘
│ Cloudflare API
▼
Cloudflare: DNS, Tunnel routes, Access
▲
│ tunnel traffic
cloudflared (any host)What runs where
| Part | Where | What it does |
|---|---|---|
| Labelgate main | One host | Reads labels, changes Cloudflare, keeps the database, serves the dashboard and API |
| Labelgate agent | Each extra Docker host (optional) | Reads that host's labels and public IP and sends them to main. Holds no Cloudflare token |
| cloudflared | Any host that can reach your apps | Cloudflare's own tunnel client. Carries the traffic. Labelgate only sets up its routes |
Ports and data
| What | Default | Setting |
|---|---|---|
| Dashboard and API | :28111 | api.address (LABELGATE_API_ADDRESS) |
| Agent listener on main | :28112, path /ws | agent.listen (LABELGATE_AGENT_LISTEN), on with agent.enabled (LABELGATE_AGENT_ENABLED) |
| Database | /app/config/labelgate.db | db.path (LABELGATE_DB_PATH) |
Back up the /app/config volume. It holds what Labelgate has created (see Ownership & Conflicts).
What happens when
- A container starts: Labelgate creates or updates its Cloudflare resources within seconds.
- A container stops: its resources are deleted 30 minutes later (
sync.remove_delay), unless the container returns first or hascleanup: "false". - Every 5 minutes (
sync.interval): Labelgate checks everything again and fixes anything that drifted. - An agent goes offline: its resources stay for 24 hours (
sync.agent_grace), so a reboot or network outage does not remove them.
To set up agents, see Multi-Host (Agent Mode).