Concepts

Existing projects

Bring a project, an image, or a machine that Ant did not create under management, and what deliberately stays out of scope.

Ant manages what it deploys. Workloads that already exist on a machine are left alone: they are not listed, stopped, pruned, or adopted automatically. There are three ways to bring something existing under management, one deliberate cutover for a running workload, one manual recipe for the cases the cutover does not cover, and one supported exit.

From existing source

ant nest init writes ant.yaml for the project in the current directory and auto-detects the build and run from the files present:

FileDetected
railpack.tomlbuild: railpack
nixpacks.tomlbuild: nixpacks
docker-compose.yml / compose.yamlbuild: none, run: compose
Dockerfilebuild: dockerfile
Procfilebuild: buildpacks
ant nest init
ant nest init --build none --file docker-compose.yml   # explicit

Override with --build, --run, and --file; --force overwrites an existing ant.yaml. Then ant haul builds and ant trail deploy runs it, locally, or on a registered machine through the deployment's server:. Remote deploys ship the project context, so the source does not need to exist on the target machine.

Review the result before deploying: env, secrets, and domains are yours to add (ant nest edit env, ant nest edit secret, ant nest edit domain).

From an existing image

ant trail deploy --image runs a prebuilt image as an Ant-managed container on a registered machine:

ant trail deploy --image ghcr.io/acme/api:1.4.2 --machine prod --pull \
  --port 8080 --env LOG_LEVEL=info --domain api.example.com

--from-tar uploads a docker save archive instead of pulling. The container carries Ant's labels, so it appears in ant nest containers list and the dashboard's Docker tab, takes logs, and can be started, stopped, or removed like any other Ant workload. The dashboard's Run image action on a machine is the same path.

Onboarding an existing machine

ant nest machines add plus ant nest bootstrap install the worker without touching what is already running. Re-running bootstrap is the upgrade path and preserves the machine identity and roster.

ant nest machines add prod --host 173.87.3.89 --ssh-key ~/.ssh/id_ed25519
ant nest machines add prod --node-id 7f2e…          # worker already running
ant nest doctor --machine prod                      # host checks
ant nest tools                                      # builders and helpers on the machine

ant nest reconcile --apply is the operator-run root path for privileged host setup (exact argv, no shell; see Security model). Ant programs the Caddy it manages; a Caddy the machine already runs for other workloads is detected, not reconfigured.

Cutover: a running workload

Resource names are derived (<group>-<app>-<env>-<branch>), so a hand-managed container or stack is never matched, replaced, or removed by a normal deploy. --adopt names it explicitly and cuts over:

ant trail deploy prod --machine prod --adopt oldapp      # run: container
ant trail deploy prod --machine prod --adopt oldstack    # run: compose

Ant stages its own container (or compose project) on ephemeral ports, health gates it, and moves the Caddy routes to it while the adopted workload keeps serving. Only then is the adopted workload stopped, not removed, so docker start oldapp (or docker compose -p oldstack start) undoes the cutover. --adopt-remove removes it instead. Adoption is remote-only for now and refuses a workload Ant already manages.

Two things it cannot do for you:

  • No domain, no gap-free cutover. Without a route to move, pass --adopt-force: Ant stops the adopted workload first and accepts a short gap.
  • Named volumes. A compose project's named volumes are project-scoped, so declare the old ones external: true (or give them an explicit name:) before adopting, or map them at deploy time:
    ant trail deploy prod --machine prod --adopt oldstack \
      --adopt-volumes data=oldstack_data
    

    Without either, the new project would start with empty volumes and adoption refuses. A container deploy reuses a named volume by declaring the mount external: true in deploy.volumes (it then keeps the exact name instead of being prefixed with the resource name). Bind mounts keep working unchanged.
    If you want ant-namespaced volumes instead of reusing the old ones, copy the data first (stop the writer, or accept a crash-consistent copy):
    ant nest volume copy oldstack_data myapp-local-data --machine prod
    

If the old stack sits behind its own proxy, move the hostnames to Ant's Caddy first (ant nest edit domain add), or keep routing outside and deploy with --no-caddy.

For a local workload, a stack, or a no-domain cutover without --adopt-force, the manual recipe still applies:

  1. Scaffold from the same source. ant nest init --build none --file docker-compose.yml, then set app and review ports, volumes, and domains.
  2. Handle data. As above: external: true, an explicit name:, or a migration.
  3. Stage, then cut over. Run on different host ports first to verify, then stop the old stack and ant trail deploy.
  4. Move the routing. As above.

What stays out of scope

Existing workloads are not addressable through Ant's surfaces, by design:

  • ant nest containers lists, controls, and reads logs for Ant-managed containers only; unmanaged names are refused.
  • ant nest volume list hides unmanaged volumes unless --all is given, and removal refuses them without --all.
  • Pruning removes only what it can positively identify as Ant-managed; unknown projects and containers are always kept.
  • ant nest tunnel forwards to Ant-managed containers.

This is what keeps a shared machine safe: Ant cannot accidentally stop, prune, or reconfigure somebody else's stack.

Leaving

ant nest machines decommission --host ADDR --handover --yes exports a plain-compose takeover bundle to ~/ant-handover on the machine, so the workloads keep running without Ant. There is no import for that bundle back into Ant; re-onboard with the source or image paths above.

Copyright © 2026