Skip to Content
Alzo

Everyday development

The day-to-day commands for a running environment: stopping and resuming it, choosing an edit loop, running migrations and tests, debugging, working in several worktrees and recovering from common problems. It assumes Alzo's packages are installed in your application, as in the quickstart. Commands use npx --no-install alzo so they work without a global installation.

Stop, resume and remove

The process that alzo up starts supervises the environment; these pages call it the owner. In the foreground it is your terminal; with --wait it moves to the background.

ActionCommandOwner and data
Start and watch in this terminalnpx --no-install alzo upForeground owner; Ctrl-C stops processes and preserves volumes.
Start and return after readinessnpx --no-install alzo up --waitLeaves a background owner. --detach is an alias and also waits for settlement.
Stop one servicenpx --no-install alzo stop apiOwner and other services remain; volumes remain.
Resume that servicenpx --no-install alzo start apiRequires the running owner and ready dependencies; does not start missing dependencies.
Restart a servicenpx --no-install alzo restart apiUses the running owner; dependents are unchanged. restart ...api explicitly cascades.
Stop the whole environmentnpx --no-install alzo stopEnds the owner; preserves volumes. Resume with up, not start.
Remove the instancenpx --no-install alzo downRuns teardown, removes containers and networks, deletes named volumes unless onRemove: 'retain'. Bind-mounted data remains.
Inspect abandoned objectsnpx --no-install alzo plan --down --orphansShows what orphan cleanup would remove or keep, before it does anything.
Rebind a moved checkoutnpx --no-install alzo rebindRun from the new path after stopping and moving the original checkout.

down deletes default named volumes, unlike Compose's default down. Deleting a worktree or a node declaration does not remove its Docker objects; use orphan cleanup afterwards. Retained volumes keep their policy even when their declaration is gone, but an orphan's teardown cannot run once its configuration is gone.

Logs and allocation history remain under ~/.alzo after the workloads are removed. An instance listed as stopped is not an orphaned running process. The machine-wide HTTPS ingress, when used, can also outlive an individual instance.

Choose an edit loop

What changed / how the application runsWhat to configure or run
Host dev server already supports HMR/watchRun its normal watcher, passing Alzo's allocated port. No additional service watch is needed.
Host process cannot watch itselfAdd watch: { paths: ['./src'], onChange: 'restart' } to the service.
Container application watches its own sourceUse a managed mirror with sync: true, restart: false; source changes reach the container and its watcher reacts.
Container needs a new imageSet provision.image.watch to the source paths that should rebuild and recreate it. A build context alone does not declare a watch.
A generated binary changesWatch the binary on the consuming service with onChange: 'restart'.
alzo.config.ts changesRun check, then reload. Reload replaces the whole graph under the same owner.
An imported config helper changesStop the owner and run up again. The config-change indicator tracks the entry file, not the modules it imports.

Lifecycle covers watch, and Storage covers managed mirrors. The patterns include dependency installation, builds, initialisation, shared files and debugger ports. Bind mounts carry writes both ways; managed mirrors are one-way copies from the host into the container.

Reload reapplies the original up selection. After up db --wait, adding an API and reloading still selects only the database; start the API with start api once its dependencies are ready. An up without targets selects every auto-start node of the new graph. Later start and stop commands do not change this selection.

Run migrations and tests

Declare finite work as a task, with dependsOn and env for its actual dependencies. Include independent manual tasks in nodes, even if nothing depends on them. For example, if migrate depends on db:

npx --no-install alzo up db --wait
npx --no-install alzo run migrate

run verifies that the task's dependencies are already ready and refuses otherwise. Alternatively, up migrate --wait starts the dependencies and executes the task; do not immediately run migrate again unless you want a second execution.

npx --no-install alzo ci e2e
npx --no-install alzo ci -- npm test

The first form runs an e2e task and its dependencies; the second runs a host command once the graph is ready. ci is one-shot: it does not watch, and it tears down afterwards, deleting named volumes by the same rules as down. Run it in a separate worktree from your active development environment. A host test command must receive the addresses its application expects, so use a task's env callback for that wiring.

Inspect and debug

Open the dashboard URL printed by up, or find it with status --json or instances. The local dashboard is part of the owner, listens on loopback and needs no separate server or login.

  1. Select the blocked node and read its dependency failure chain.
  2. Read its retained logs, resolved environment and health history. Values passed through secret() are redacted; ordinary environment strings are not.
  3. Use Graph to inspect relationships. Lifecycle, health and build are distinct: a running service can have a stale build dependency.
  4. Use Shell for a new terminal in the node's context; it does not attach to the service's standard input. For an interactive: true host process in a foreground Alzo terminal, i or Enter attaches it and Ctrl-Z returns to Alzo.
npx --no-install alzo logs api --tail 50
npx --no-install alzo logs api --follow
npx --no-install alzo exec api -- pwd
npx --no-install alzo traces api

Host exec uses the node's working directory, resolved relative to the configuration's directory, and its environment. A selected provision.local.cwd overrides the node's top-level cwd for host startup, tasks, commands and dashboard shells; a command's own cwd still takes precedence, and --containerize does not use the local branch's cwd. Container exec runs inside the container. logs keeps working after the owner stops; traces needs the running dashboard. --since accepts a timestamp or a relative age, for example alzo logs api --since 10m. logs --raw is not implemented.

Supervised host Node.js processes receive OpenTelemetry instrumentation automatically. A Node.js application in a container must install @alzo/otel-node and set instrumentation: { node: true }; other runtimes need their own SDK (Dashboard and telemetry). Send the application a request before expecting a request trace. The debugger pattern shows an inspector flag and port; a pinned inspector port cannot be shared by two worktrees running at once.

Worktrees and branch changes

Commit your application, configuration and dependency manifest first. Then, from the existing checkout:

git worktree add ../app-feature -b feature
cd ../app-feature
npm ci
npx --no-install alzo up --wait
npx --no-install alzo instances

Use your project's package manager if it is not npm. The private tarball paths in the lockfile must still exist. Worktrees do not copy node_modules, ignored .env files or generated bind-mount data: install dependencies, load the secrets you need and create required local directories in each worktree.

Run commands from the worktree they should affect. Each worktree gets its own nodes, database volumes and allocated endpoints (Parallel environments). --profile selects a shape of the graph and --instance selects an additional named environment in the same checkout; neither checks out a branch. If you start with --instance review, pass the same flag to subsequent commands. Instance names are distinct from the random hostname labels that instances shows.

An environment belongs to its checkout, not its branch. Switching branches, including to a detached HEAD, keeps the same environment, its allocation and its retained volumes. A branch change can still change the graph, so check what reload or the config-change indicator would apply. Use separate worktrees for concurrent work. A new directory created at the path of a removed checkout gets a fresh environment.

To move an environment, stop its owner with alzo stop and move the directory on the same filesystem, using git worktree move for a linked worktree. Then run alzo rebind from the new path, with the same --instance flag if you used one; rebind each named environment you want to move. A new checkout at the original path can coexist with the moved one. When both share Git metadata, the new checkout's hostnames get a suffix and the original keeps its unsuffixed hostnames. An owner whose checkout moved while it was running refuses new work but can still stop. A copy, or a move to another filesystem, gets a fresh environment; back up and restore its data explicitly if you need it.

To clean up, run down inside the feature worktree first, then leave it and run git worktree remove ../app-feature. If the worktree is already gone, use orphan cleanup with its exact scope; that keeps its named volumes and allocation available for recovery. alzo instances lists stopped reservations, and adding --release-ports to the cleanup returns their ports to the pool while keeping the data.

Reset retained database data

For a schema reset that keeps the Docker volume, declare a manual reset task with the database dependency and credentials it needs. That is application-specific SQL, not a generic Alzo operation.

For a complete reset of the quickstart database:

  1. Run npx --no-install alzo down and copy the retained volume name printed for db.data. This removes its container before you delete the data.

  2. Replace EXACT_VOLUME_NAME below with that name and inspect its labels:

    docker volume inspect EXACT_VOLUME_NAME --format '{{json .Labels}}'
  3. Verify that alzo.workspace matches the hash directory in the workspace row of alzo doctor (~/.alzo/<hash>), that alzo.instance matches the intended instance, that alzo.node is db, and that alzo.volume is data. Then discard that volume:

    docker volume rm EXACT_VOLUME_NAME
    npx --no-install alzo up --wait

PostgreSQL initialises a fresh acme database. Changing POSTGRES_DB or POSTGRES_PASSWORD alone does not reinitialise an existing database volume. Bind-mounted data is a separate host directory, which Alzo never deletes. Resetting one database needs no broad Docker pruning and no deletion of ~/.alzo.

Troubleshooting and prerequisites

SymptomNext action
alzo: command not foundUse npx --no-install alzo in the project with installed packages, or an npm script.
Missing process/Buffer types in configInstall @types/node and put /// <reference types="node" /> first in alzo.config.ts. check ignores the app's tsconfig.json.
Docker unavailable or remote context refusedStart the local daemon and select its local context. Check docker version and alzo doctor.
Database ready by TCP but queries failUse pg_isready or an application-aware readiness probe, and verify the database exists.
inherit: 'image' refusesThe image needs a Docker HEALTHCHECK; stock Redis does not supply one. Use an explicit probe.
Config edit has no effectCheck the config changed indicator, then check and reload; imported helpers require stop/up.
Added node stays stopped after reloadCheck the original targeted startup selection and the node's start policy.
Startup times outInspect status and logs. The environment can remain running after timeout; stop it explicitly when done.
Native source watching reports unrecoverable lossRun down, wait for teardown, then up; reload cannot repair the watcher. Account for volume deletion. See Lifecycle.
Port or subnet conflictRead the named conflicting process or network; avoid pinned ports for parallel instances. Do not stop unrelated workloads.
A name "belongs to … another project on this machine"Inspect the exact Docker object and its workspace label. Environments are named per checkout, so new projects are distinguished automatically.
up or down refuses because the ingress routing record was written by a different Alzo version or cannot be readRun docker rm -f alzo-ingress, as the error says, then run the command again, or reload if a failed up left its owner running. The ingress holds no data, and the next up recreates it. Every other checkout it served stays offline until it starts again with this version: run reload there if its owner was started by this version, otherwise run up there, after stopping it with the version that started it if it still runs.
run, up, stop, down, down --orphans or rebind refuses because an earlier task or lifecycle operation ended without proving its cleanup, or because a task is running without this command's custodyThe command that started the task exited before it could prove the task's container stopped, so Alzo kept the instance reserved. Wait for the task to finish, or stop the container the message names with docker stop, or remove it with docker rm if the message says it was only created, then run run, up, stop or down again: once Docker shows none of the instance's task containers running, the command takes the reservation over and releases it when it finishes. If the message says Docker cannot be asked, start Docker first. If it says the process that reserved the instance may still be running, it names that process's PID and the ps command that shows it: run the command again once that process has exited. That happens only when the machine will not say whether that PID still belongs to the process, for example because it does not name the boot the process started in. On a machine that names its boot, setting the clock never causes it, and a restart shows the old process gone. A moved checkout's rebind does the same once all of its containers are stopped. down --orphans takes a reservation over only for a checkout that no longer exists or with --release-ports, and releases it once it has removed the instance's containers and the Docker daemon that ran the checkout lists none of them. A task that is still running refuses it the same way. If it says a container is still listed, remove what its docker ps -a command lists; if it says another daemon answered, select the one that ran the checkout; and if Docker did not answer, run alzo doctor. Then run the cleanup again. Where the checkout still exists, run stop there first.
A command refuses because a task or lock record, such as runs.db, was written at another process-lease schema version or records noneStop every Alzo process of the version that wrote it, let its tasks finish, and finish any rebind or orphan cleanup with that version. For runs.db, run the docker ps command the message prints and stop any task container it lists. Then delete the files the message names.
The control socket path is too longFollow the shorter-home remedy the CLI prints, and keep using the same home for subsequent commands.
The workspace cache or a log store is refused, or metric history is reported unavailable, as written at another schema version or as recording noneAlzo never migrates these files. Stop the Alzo version that wrote them, finish any rebind or orphan cleanup with that version, then delete the files the message names. Deleting the workspace cache reallocates ports and hostname labels, so ports may change, and forgets moved and unavailable checkouts; deleting a log store or metric history loses only what it retained. Until metric history is deleted, the dashboard keeps metrics in memory only.

check type-checks the configuration; the first up loads it at run time without a full compiler pass, so run check before the first start. Help and configuration inspection evaluate your configuration code, and any top-level side effects in it still happen. There is no shell-completion installation command: use alzo <command> --help and the CLI reference for the supported flags.

On this page