Labelgate

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

PartWhereWhat it does
Labelgate mainOne hostReads labels, changes Cloudflare, keeps the database, serves the dashboard and API
Labelgate agentEach extra Docker host (optional)Reads that host's labels and public IP and sends them to main. Holds no Cloudflare token
cloudflaredAny host that can reach your appsCloudflare's own tunnel client. Carries the traffic. Labelgate only sets up its routes

Ports and data

WhatDefaultSetting
Dashboard and API:28111api.address (LABELGATE_API_ADDRESS)
Agent listener on main:28112, path /wsagent.listen (LABELGATE_AGENT_LISTEN), on with agent.enabled (LABELGATE_AGENT_ENABLED)
Database/app/config/labelgate.dbdb.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 has cleanup: "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).

On this page