Day to day

The handful of commands you will actually use.

Once an app is up, life with Yard is mostly pushing code. This chapter is the rest: the commands for looking around, and for the occasional change. Each section is short, and links to the chapter that explains the why.

Every command that acts on one app finds the app from the checkout you stand in: the origin remote and the current branch. Anywhere else, add --app notes.

Look at the host#

yard status
name          state    cpu   mem   data  rev      host                deploy
yard-app-1    up 6h  0.10%  60MB  128MB  9c2c7e1  yard.example.com    ok 12s · 2d
yard-caddy-1  up 6h  0.30%  24MB  128MB                               ok 12s · 2d
notes-app-1   up 2h  2.40% 210MB  1.2GB  9c2c7e1  notes.example.com   ok 43s · 2h
host: 31% of 4 cores · 294MB of 7.7GB · 1.3GB of 40GB

One row per container. A few words in the table are worth knowing:

  • unhealthy: the container’s healthcheck fails. Read its log.

  • starting: the healthcheck has not passed yet. It shows for a moment after a deploy.

  • 3 restarts: Podman restarted the container because its process exited. The app is crashing.

  • 9c2c7e1 → a1b2c3d: the app runs 9c2c7e1, but its source is at a1b2c3d. A deploy is on its way, the last one failed, or the app is manual.

An app with no healthcheck has no unhealthy state. It shows up as long as its process runs, even when it answers nothing. Healthchecks fixes that.

Lines that need attention are in color, and below the table Yard prints the one command worth typing next. --running hides stopped containers.

For one app in detail:

yard app status
notes
rev 9c2c7e1 · image localhost/notes:9c2c7e1a2b3c-3f9a1c2e · trigger push
data 1.2GB · env /srv/yard/apps/notes/env
runs  auto → yard:python-uv @3f9a1c2e (containerfile; stario: pyproject.toml declares stario)
caddy notes.example.com
 
containers
  notes-app-1  a1b2c3d4e5f6  up 2h  2.4%  210MB
 
deploy
  ok  43s  2h  9c2c7e1
 
log
  listening on :8000

And when something feels off about the machine itself, yard status --full runs every host check. It exits 1 when a check fails, so it fits a cron job.

Read logs#

yard app logs              # the app's output
yard app logs -f           # and keep following it
yard app logs --deploy     # the last deploy, step by step
yard logs yard-caddy-1     # any container, by name

Logs live in the journal, not in the container. So you can read the log of a container that crashed and was replaced an hour ago. --since -15m, --until, and --tail 500 set the window. --hide and --only filter it. Logs and events explains both.

Read events#

yard events --app notes                  # one app's timeline
yard events --app notes --event deploy.  # its deploy history
yard events -f                           # everything, live

Webhooks, checks, deploys, container starts and stops, and setting changes all appear on one timeline, oldest first.

Change a setting#

yard env set SESSION_SECRET=…
yard app deploy

Saving never restarts the app. The new value reaches the container at the next deploy, and yard app deploy makes that now. yard env cat, get, unset, and edit cover the rest. Settings and data explains the env file.

Change the site file#

yard caddy cat             # print the app's site file
yard caddy edit            # change it; Caddy checks and loads it on save

Add a name to the first line, put a password in front, or send a path to another container. Point the DNS at the VM first. An empty file removes the site. Caddy and HTTPS has examples.

Deploy by hand#

yard app deploy

This deploys what the source says now, even when nothing changed. It is how you apply a setting, retry after a fix outside the repo, or deploy a manual app. Ctrl-C leaves the deploy running on the host, and yard app logs --deploy -f rejoins it.

Change what an app runs#

yard app cat containerfile               # the file the app builds
yard app cat compose                     # the compose files it runs
yard app set --runs Containerfile        # build your own file from the repo
yard app set --runs yard:python-uv       # keep Yard's file, even if a compose.yml appears
yard app set --runs auto                 # let every deploy decide again

None of these deploys at once. After you change runs, a push app deploys once at the next check, even when the commit is the same. yard app deploy deploys it now. What an app runs explains runs.

The source changes the same way:

yard app set --ref redesign              # follow another branch
yard app set --image ghcr.io/you/api:1.5 # a new image tag
yard app set --trigger manual            # stop deploying on push

Preview a branch#

A branch can be an app of its own. Check out the branch, then create an app from it:

git switch redesign
yard app new --caddy redesign.example.com

The app is named notes-redesign. It follows the redesign branch, deploys each push to it, and has its own env file and data. When the branch is merged, remove the preview with yard app rm --app notes-redesign.

Roll back#

There is no rollback command, because Yard runs what the source says now. To go back, change the source:

  • A repo: git revert the bad commit and push. The revert is a new commit, and the build cache makes it quick.

  • An image: yard app set --image ghcr.io/you/api:1.3, then yard app deploy.

  • A compose URL: yard app set --compose-url with the raw URL of an older commit, then yard app deploy.

For a repo app on push, the revert is also what makes the rollback stick. Without it, the next check finds the bad commit at the branch tip again. To hold still while you investigate, run yard app set --trigger manual first.

Clean up#

Yard cleans up old images by itself, once a day. Podman and containers explains what it keeps.

When the disk is full right now:

yard prune --dry-run       # what would go
yard prune                 # the same as the daily run
yard prune --days 1        # also drop what is older than a day

yard status --full shows when the last prune ran and how much it freed, and how full the disk is.

Remove an app#

yard app rm

yard app rm deletes everything the app has on the host: its site file, its containers, its clone, its env file, and its data. There is no undo, so it first lists what will go and asks you to type the name:

This deletes the app notes:
  containers  notes-app-1
  clone       /srv/yard/apps/notes/repo
  env file    /srv/yard/apps/notes/env
  data        /srv/yard/apps/notes/data (1.2GB)
  caddy site  notes.example.com
This cannot be undone. Copy the data directory first if you need it.
Type the app name to confirm:

Yard removes the site file first, so the names stop answering before the containers go. In a script, --yes skips the question. The yard app cannot be removed this way.

By the way#

  • Every command prints text, in a pipe too. Add --json for JSON: yard status --json | jq '.rows[].container'.

  • yard <command> --help lists every flag. The CLI reference has them all on one page.

  • yard app ls lists every app on the host with its source and trigger.