Agent Architecture
The agent runs on servers and reconciles expected state from the control plane.Node Types
The agent supports two modes:| Type | Flag | Traefik | Description |
|---|---|---|---|
| Worker | Default | No | Runs containers only |
| Proxy | --proxy | Yes | Handles TLS and public traffic |
State Machine
The agent uses a two-state reconciliation model:IDLE State
- Polls the control plane every 10 seconds for expected state.
- Compares expected state against actual state.
- Transitions to
PROCESSINGwhen drift is detected.
PROCESSING State
- Uses a snapshot of expected state without re-polling.
- Applies one change at a time:
- Stop orphan containers with no deployment ID.
- Start containers in
createdorexitedstate. - Deploy missing containers.
- Redeploy containers with the wrong image.
- Update DNS records.
- Update Traefik routes on proxy nodes.
- Update WireGuard peers.
- Times out after 5 minutes.
- Always reports status before returning to
IDLE.
Drift Detection
Drift detection is deterministic and uses hashes:- Containers: missing, orphaned, wrong state, or image mismatch.
- DNS: hash of sorted records.
- Traefik: hash of sorted routes on proxy nodes.
- WireGuard: hash of sorted peers.
Container Labels
The agent tracks managed containers with Podman labels:| Label | Description |
|---|---|
techulus.deployment.id | Links the container to a deployment |
techulus.service.id | Links the container to a service |
techulus.service.name | Human-readable service name |
techulus.deployment.id are treated as orphans and cleaned up.
Command Line Flags
| Flag | Default | Description |
|---|---|---|
--url | Required | Control plane URL |
--token | Empty | Registration token, required on first run |
--logs-endpoint | Empty | VictoriaLogs endpoint for log shipping |
--proxy | false | Run as a proxy node |
Build System
Agents can build container images directly from GitHub sources:- Poll for pending builds.
- Claim the build to prevent duplicate work.
- Clone the repository using a GitHub App installation token.
- Run Railpack to generate a build plan, or use the existing Dockerfile.
- Build the image with BuildKit.
- Push the image to the registry.
- Update build status.
Work Queue
Agents also process queue items for operations that cannot be modeled purely as expected state:| Type | Description |
|---|---|
restart | Restart a specific container |
stop | Stop a specific container |
force_cleanup | Force remove containers for a service |
cleanup_volumes | Remove volume directories for a service |
deploy | Handled through expected-state reconciliation |
Proxy vs Worker Behavior
Proxy Node
- Runs Traefik for TLS termination.
- Receives Traefik routes from the control plane.
- Handles public traffic and routes requests to containers over WireGuard.
- Collects and ships Traefik access logs.
Worker Node
- Does not run Traefik.
- Receives empty Traefik route sets from the control plane.
- Skips Traefik-related drift detection and reconciliation.
- Keeps a lighter runtime footprint focused on container workloads.
