What an app runs

One source per app, and one clear answer to “what runs?” on every deploy.

Every app on Yard answers two questions. Where does it come from? And what, exactly, runs? This chapter explains both answers, and how Yard finds the second one when you do not give it.

The short version for a Stario app: there is nothing to write. A Stario app shows the three files Yard reads and the Containerfile it writes from them.

One source#

An app has exactly one source:

  • A repo, on GitHub or Cursor Origin, with a branch to follow. Yard builds it.

  • An image, such as docker.io/vaultwarden/server:1.37.4. Yard pulls it.

  • A compose file at an https:// URL, for a ready-made service. Yard fetches it and runs it.

You pick it when you create the app:

yard app new                                    # the repo of this checkout
yard app new --image docker.io/vaultwarden/server:1.37.4
yard app new --compose-url https://example.com/umami.compose.yml

Each app has one source, not a mix, because each source has its own idea of “a new version”. For a repo, it is a new commit on the branch. For an image, it is the tag pointing at a new digest. For a URL, it is new bytes at that address. One source per app keeps that idea simple: Yard watches one thing, and when it moves, the app moves.

yard app set changes the source. A new source replaces the old one, so a repo app that moves to an image loses its branch and its runs.

All three kinds share the rest of the machinery: the check, the deploy container, the env file, /data, the site file, and the log. The rest of this chapter is mostly about repos, because a repo is where Yard has decisions to make.

The runs field#

A repo can hold many files that could run. So a repo app has one more field, runs, which names the one that does:

  • auto, the default. Yard reads the commit and decides on every deploy.

  • A path in the repo, such as Containerfile or deploy/stack.yml. Yard reads the file to learn its kind. A file with a services: block is a compose file. A file whose first instruction is FROM or ARG is a Containerfile.

  • yard:<template>, one of the Containerfiles that Yard keeps. Yard renders it for the repo and builds it.

runs always names a file in the repo, or a template. An image or a URL is a source, not a runs value, so --runs postgres:17 gets an error that points at --image.

yard app status shows the answer on one line:

runs  auto → yard:python-uv @3f9a1c2e (containerfile; stario: pyproject.toml declares stario)

Read it left to right. The record says auto. The last deploy answered yard:python-uv. @3f9a1c2e is the stamp of the templates it used. Inside the brackets are the kind of file and the reason Yard gave. A pinned path reads more simply:

runs  ops/stack.yml (compose)

Auto decides on every deploy#

On auto, Yard reads the commit at each deploy and takes the first match:

  1. A compose file: compose.yml or compose.yaml, at the root or in ops/.

  2. A Containerfile or a Dockerfile, at the root or in ops/.

  3. A language that Yard knows. Yard writes a Containerfile for it. How Yard reads a repo is this step in detail.

A file of your own always beats one that Yard would write. Right after the sync, the deploy log says what Yard chose and why:

== sync https://github.com/you/notes main
== runs compose.yml (compose; found compose.yml)

Because auto decides again on every deploy, a later commit can change the answer. Say a commit adds a compose.yml to a repo that ran a Containerfile that Yard wrote. A silent switch like that is almost never what you meant. So Yard refuses it, keeps the old version running, and asks you to pin one answer:

!! auto found compose.yml (compose); the last deploy ran yard:python-uv (containerfile)
  Help: Pin one: yard app set --runs compose.yml   or   yard app set --runs yard:python-uv

Pick one, deploy, and the guard is satisfied. All of Yard’s templates count as one answer here, so a move from yard:python-pip to yard:python-uv needs no pin. Any other change asks for one, even a move of the same kind, such as Containerfile to ops/Containerfile.

A pinned template still reads the repo on every deploy, because the file it writes needs the start command and the versions. What the pin stops is a change of kind: with --runs yard:python-uv, a new compose.yml in the repo is ignored. A pin that no longer fits the repo stops the deploy and names the template that does:

!! yard:python-pip does not fit this repo: Yard detects yard:python-uv (stario: pyproject.toml declares stario)
  Help: Run yard app set --runs yard:python-uv to accept it, or add a Containerfile.

How Yard reads a repo#

When the repo has no compose file and no Containerfile, Yard looks for the files that name a language. It does not run your code, and it does not guess. It reads a few files, and either it is sure or it stops and says what it found.

Yard findsIt writesThe image installs withIt starts
pyproject.toml that lists stario, or a [tool.stario-create] tableyard:python-uvuv sync --locked --no-install-project --no-devthe Python entry point
uv.lockyard:python-uvuv sync --locked --no-install-project --no-devthe Python entry point
requirements.txtyard:python-pippip install -r requirements.txtthe Python entry point
go.modyard:gogo buildthe one main package
package.json with a start scriptyard:node-npmnpm ci, or npm install without package-lock.jsonnpm start
serve.nu with a handler closureyard:http-nunothing: one static binaryhttp-nu … ./serve.nu

Yard asks the rows in that order, the specific before the general. The Stario check runs before the plain Python one, and uv.lock wins over requirements.txt. Three rules hold for every row.

One language per repo. Stario and Python count as one. A repo with a pyproject.toml and a package.json stops with found pyproject.toml and package.json; Yard will not guess. Add a Containerfile, or move the second language out of the root.

The lock file is the dependency list. Yard installs Python packages exactly as uv.lock or requirements.txt says, and never resolves them itself. So a pyproject.toml with no lock stops. uv sync --locked also fails when the lock no longer matches pyproject.toml. After you change a dependency, run uv lock and commit uv.lock with the change.

The start command comes from a file you can see. For Python, Yard takes the first of these that exists:

  1. app/main.py, started as python -m app.main.

  2. main.py, started as python main.py.

  3. app.py, started as python app.py.

  4. With uv.lock, a [build-system] table, and exactly one entry in [project.scripts]: that script.

None of them, and the deploy stops. A Go repo needs one package main at the root, or exactly one under cmd/. A Node repo starts with npm start. A serve.nu app starts with http-nu.

The versions come from the repo too: .python-version or requires-python for Python, engines.node in package.json for Node, and the go line in go.mod for Go. The templates lists what each template covers.

A Stario app#

A repo from uvx stario-create new has the three files that decide the answer: a pyproject.toml that lists stario, a committed uv.lock, and app/main.py. So Yard writes yard:python-uv and starts python -m app.main, the same command you run on your laptop.

The Stario check makes a difference only when a file is missing. A plain Python repo without uv.lock falls back to requirements.txt. A Stario repo without uv.lock stops with a Stario app needs uv.lock; run uv lock and commit it, because every Stario app is meant to install from its lock.

Stario listens on 127.0.0.1:8000 by default, and inside a container that address is out of Caddy’s reach. So every image that Yard builds gets three Stario variables:

  • STARIO_HOST=0.0.0.0, so Caddy can reach the app.

  • STARIO_PORT=8000, the port the default site file dials.

  • STARIO_TRACER=json, so each request is one JSON line in the journal, where yard app logs reads it.

The app code changes nothing for any of this. Here is the whole file that Yard writes for a Stario app, with the digests shortened:

# Written by Yard for yard:python-uv (stario: pyproject.toml declares stario). To change it, copy it into your repo: yard app cat containerfile --app notes > Containerfile
FROM python:3.14-slim-trixie@sha256:…
 
ENV PYTHONUNBUFFERED=1 \
    PORT=8000
 
ARG UV_COMPILE_BYTECODE=1
ARG UV_LINK_MODE=copy
ARG UV_PYTHON_DOWNLOADS=0
 
WORKDIR /workspace
 
RUN --mount=type=bind,from=ghcr.io/astral-sh/uv:0.13.5@sha256:…,source=/uv,target=/bin/uv \
    --mount=type=cache,target=/root/.cache/uv \
    --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
    --mount=type=bind,source=uv.lock,target=uv.lock \
    uv sync --locked --no-install-project --no-dev
 
COPY . /workspace
 
ENV PATH="/workspace/.venv/bin:$PATH"
 
CMD ["python", "-m", "app.main"]

The order of the lines is the point. The packages install in a layer of their own, from pyproject.toml and uv.lock alone. Then the code is copied in. So a deploy that changes only code keeps the package layer, and writes a layer the size of your source. uv itself is mounted for the build and never lands in the image.

The build context is the repo, so keep the .dockerignore that stario-create new writes. It keeps .venv, .env, and the local SQLite files out of the image.

The templates#

yard:<name> is one of five Containerfiles that Yard keeps. Each one pins its base images by digest, so a rebuild anywhere starts from the same bytes:

  • yard:python-uv installs from uv.lock in a layer of its own, then copies the code. A packaged project, one with a [build-system] or tool.uv.package = true, also installs itself after the copy.

  • yard:python-pip installs requirements.txt into a virtual environment in a layer of its own, then copies the code.

  • yard:go builds one static binary with CGO_ENABLED=0 and runs it on a distroless image.

  • yard:node-npm installs with npm, runs npm run build when there is a build script, sets NODE_ENV=production, and starts with npm start. A repo with pnpm-lock.yaml or yarn.lock stops, because the template uses npm.

  • yard:http-nu runs a cross.stream app: a serve.nu at the root whose last expression is a handler closure like {|req| ...}. The image holds one static http-nu binary, checked against a pinned sha256. It keeps the xs store in /data/store, so the store survives deploys.

Each template covers the versions its base images pin: Python 3.12, 3.13, and 3.14; Node 22 and 24; Go 1.26 and 1.27. An exact pin, like .python-version, must be in the set. A minimum, like requires-python = ">=3.13", gets the smallest version that covers it. The defaults are Python 3.14, Node 24, and Go 1.26.

Every file that Yard writes sets PORT=8000, and the app must listen there. The file has no healthcheck, because Yard cannot know where your app answers. Add one when you take the file into your repo. Healthchecks explains why that matters.

Yard writes the file fresh on every deploy, into /srv/yard/apps/<name>/Containerfile. Its stamp, the first eight characters of a hash over Yard’s detectors, templates, and pins, rides along in the image tag. So when a Yard release improves a template, the next check sees a new stamp, and a push app deploys once on the new file. A manual app gets the new file at its next yard app deploy.

The written file is a starting point. To change it, take it into your repo, and pin it before you push:

yard app cat containerfile > Containerfile
git add Containerfile && git commit -m "Own the Containerfile"
yard app set --runs Containerfile
git push

When Yard refuses#

A wrong guess costs more than a missing one, so Yard stops when it is not sure. The deploy fails before the build starts, and the running app keeps running. The live log of yard app new or yard app deploy shows the message and the fix, and yard app logs --deploy shows it again later:

== sync https://github.com/you/notes main
!! a Stario app needs uv.lock; run uv lock and commit it
  Help: uv lock && git add uv.lock && git commit && git push
failed
Read the full log: yard app logs --deploy --app notes

These are the messages you can meet, and what each one asks for:

The message starts withFix
no compose file, Containerfile, or known languageAdd a Containerfile. Yard found nothing it knows.
found pyproject.toml and package.json; Yard will not guessAdd a Containerfile, or keep one language in the root.
a Stario app needs uv.lockRun uv lock, then commit uv.lock.
found pyproject.toml but no uv.lock or requirements.txtCommit uv.lock or requirements.txt.
… but no app/main.py, main.py, or app.pyAdd one of those files, or one entry in [project.scripts].
Yard's python templates cover 3.12, 3.13, 3.14; this repo asks …Change .python-version or requires-python, or add a Containerfile.
Yard's node templates cover 22, 24; this repo asks …Change engines.node in package.json, or add a Containerfile.
Yard's go templates cover 1.26, 1.27; this repo asks …Change the go line of go.mod, or add a Containerfile.
package.json does not parseFix the JSON in package.json.
package.json has no start scriptAdd scripts.start.
Yard's Node template uses npm; this repo uses pnpmAdd a Containerfile, or move to npm.
found go.mod but no single main packageKeep one package main at the root or in cmd/.
found serve.nu but it has no handler closureMake a handler closure the last expression of serve.nu.
auto found … the last deploy ran …Pin one answer, as Auto decides on every deploy shows.
yard:… does not fit this repoAccept the template that Yard names, or add a Containerfile.
… is not a file in the checkoutFix the --runs path, or commit the file.
the file has a services: block, a FROM or ARG instructionKeep the file one kind: a compose file or a Containerfile.
a Containerfile needs a repo to buildA compose URL must name a compose file. To build a Containerfile, give the app a repo.
a compose file from a URL cannot buildBuild the image elsewhere and name it in the file, or give the app a repo.

A Containerfile is always the way out. Yard builds it as it is, and reads no language files to do so.

An image#

An image app has no repo. It runs an image that a public registry already holds, and the tag decides how far it follows the publisher: postgres:17 follows every 17.x release, and latest follows everything. A tag is required, so no app follows latest by accident.

At every check, Yard sends one HEAD request to the registry and reads the digest the tag points to. When the digest moves, a push app deploys it. Yard always runs the exact image, name:tag@sha256:…, so a restart never changes what runs.

Yard runs the image as its publisher built it. It sets no PORT, so the site file dials the port the image already uses, which Yard reads from the running container. The image keeps its files in /data. An image that keeps them elsewhere needs a compose file instead.

A compose file at a URL#

A compose file at an https:// URL runs a ready-made service, with the same contract as a compose file in a repo. At every check, Yard fetches the file, up to 256 KiB, and hashes it. When the hash changes, a push app deploys the new file. Yard keeps a copy of the file that runs and of the one before it, so a revert needs no network.

A URL cannot build, because there is no checkout to build from, so a file with a build: line is refused. To stay on one version, use the raw URL of one commit instead of main.

Self-host a service walks through both kinds with real software: Vaultwarden from an image, and Umami with Postgres from a compose file.

When the source fails#

An image app and a compose URL app depend on something outside the VM. The rule is simple: the running app keeps running.

  • The registry or the URL does not answer. Yard tries again at the next check, and yard status --full shows a source <name> warning until it works.

  • The fetched file is not a valid compose file, or it breaks the contract. The deploy fails before anything starts.

  • The new version never becomes healthy. Yard goes back to the one before, as it does for code.

Teach Yard a language#

Each language is one small module in the Yard repo, under app/server/detect/, with its template next to it. A module names its language and the files that prove the language is there. Then it answers one question: given this checkout, which Containerfile? The Stario module shows a framework on top of a language: it shares the Python template and adds only its own check and message.

To add a language, open a pull request with the module, its template, its pins in bases.json, one line in the list of detectors, and tests. The list runs from specific to general, so a framework goes before its language. There is one rule: when the module cannot be sure, it refuses, with a message that says what it found.

By the way#

  • Following an image or a URL means that its publisher’s changes reach your host. For a source you do not control, create the app with --trigger manual. Yard then shows each new version in yard status, and you deploy it when you have read the release notes.