Project structure
In your project
ant nest init writes a single file, ant.yaml:
app: my-app
deploy:
build: dockerfile # dockerfile | nixpacks | buildpacks | railpack | none
run: container # container | compose | stack
port: 3000
# keep_images: 3
# use_machine_network: true # join the machine-wide network
# rollback:
# keep_releases: 5 # releases retained for `ant trail rollback`
# machine: prod # uncomment to target a remote nest
buildselects the builder.nonemeans the image is pre-built or comes from the compose file.runselects how it runs: a single container, a compose project, or a stack.machine(optional) targets a registered remote machine by name.rollbackconfigures release retention and the optional rollback hooks; image retention iskeep_images, falling back torollback.keep_releases.- Environments (
local,dev, …) layer env vars, secrets, ports, and domains on top of the base config.
See Configuration for the full ant.yaml reference.
Under ~/.ant
Ant keeps its state in ~/.ant, split by role: the client state that ant
and ant ui own, and the worker state ant-worker owns under
~/.ant/worker/.
Client
| Path | Holds |
|---|---|
~/.ant/config.json | Machines (including the roster mirror), groups, project roots, UI settings, notifications, relay |
~/.ant/identity | Your account keypair (written by ant colony signup, restored by login/import) |
~/.ant/machines/<id>/identity | Only for an identity you generated yourself (ant nest identity generate); provisioning no longer writes it |
~/.ant/machines/<id>/audit-anchor.json | The audit chain head this client last saw on that machine (staleness detection) |
~/.ant/deployments.json | The deploy history shown by ant trail history |
~/.ant/deploy-logs/ | Captured output per deploy event (history is capped at 200 entries, 500 lines each) |
~/.ant/templates, ~/.ant/templates-dokploy, ~/.ant/dokploy-index.json | Your templates and the imported Dokploy catalog |
~/.ant/locks/ | Transient operation locks (caddy-<hash>, local-deploy-<hash>), removed after use |
~/.ant/known_hosts | SSH host keys pinned during provisioning |
~/.ant/caddy/ | The managed local Caddy's PID (and a transient config while it starts) |
~/.ant/local/<app>/<env>/ | Legacy working directory; only read and removed by ant trail destroy |
Worker
A machine running ant-worker keeps its own state under ~/.ant/worker/
(system installs run it as user ant, so /home/ant/.ant/worker/):
| Path | Holds |
|---|---|
agent-identity | The machine's ed25519 keypair, generated on the machine and never copied off it |
agent-identity.pub | The machine's NodeID as text |
agent-state.json | The authoritative roster (roles, membership expiry), used/revoked invite nonces, OIDC policies, and the bootstrap marker; a state import keeps the previous file as .bak |
audit.log, audit.log.1…audit.log.5 | Hash-chained log of privileged RPCs; 8 MiB segments |
bin/ant-worker | The worker binary under its own state directory, so ant nest worker update can replace and re-exec it without SSH or root; .ant-worker-new-* is transient staging and .bak is the previous image kept for a manual cp rollback |
remote-compose/<project>/docker-compose.yml | The resolved compose document a remote deploy applied (with ${KEY} references; never secret values) |
remote-compose/<project>/stack.yml | The stack file a remote stack deploy applied |
remote-compose/<project>/<referenced files> | Files a no-build compose project references, shipped at their project-relative paths: env_file and .env inputs, include/extends targets, and secrets/configs sources (0600) |
remote-compose/<project>/secrets.env | Runtime secret values for that project, written at up and removed at down |
remote-compose/<project>/releases/<id>.json | Release records for ant trail rollback (content, routes, flags, secret names); the newest 20 are kept |
remote-compose/<project>/zd-*.yml, zd-*.secrets.env | An in-flight zero-downtime staged copy; removed after the swap or abort |
The roster shown by the CLI and dashboard is a mirror of agent-state.json,
refreshed from the machine after each change; authorization always happens
against the machine's copy. The worker's paths can be overridden with
--identity / --state; provisioning sets them explicitly.
A worker started with the default paths adopts pre-existing state after an
upgrade: a ~/.ant/agent-identity, agent-state.json, audit.log, and
remote-compose/ left by an older build move into ~/.ant/worker/. Explicit
--identity/--state flags are never moved. A ~/.ant/remote-compose on a
client-only machine is not a project store: it is never read, and
ant nest doctor --cleanup removes it once a worker copy exists (otherwise it
notes that a worker on this host adopts it on its next start).
Config, identity, state, audit, and secret files are written 0600 (their
directories 0700). Transient artifacts appear only while an operation runs:
<file>.lock siblings for path locks, .ant-worker-new-* while a self-update
stages, and zd-* files during a zero-downtime compose swap. The imported
Dokploy catalog (~/.ant/dokploy-index.json
and ~/.ant/templates-dokploy/) is world-readable by design. Nothing is written
into your project except ant.yaml and the transient .ant-<app>-*.yml
compose patch files a local compose deploy writes beside the compose file
(removed after the run, and swept on the next deploy if a run was killed).
Machine config schema
~/.ant/config.json is schema v2. Projects, groups, and Caddy settings nest
under the machine they belong to:
{
"version": 2,
"machines": {
"local": {
"caddy": { "auto_start": true },
"groups": { "backend": { "domains": ["example.com"] } },
"project_dirs": ["/home/me/code/api", "/home/me/code/worker"]
}
}
}
v1 configs are migrated on load: a top-level local object is folded into
machines.local, and the old flat groups/project_dirs/caddy are nested.
See Configuration for the full reference.