Ajo Server
Deploy an App
The App image, branch targets, SSH and token credentials, recovery, and updating or deleting a host.
ajo-kit-server adds kit host and kit deploy to a Kit application. Deploy your first App walks from an empty directory to a live App; this page covers what comes after it: adding the plugin to an App of your own, the image it builds, branch targets, deploying with a token, recovery, and updating or deleting a host. The package README on npm holds every code, result field and credential file.
Add it to an App
The starter already lists the plugin. In another App, install it as a development dependency, add the engine pair as described in Seal and run, and name the host in package.json, which kit host create also does when it runs in the App:
pnpm add -D ajo-kit-server{ "name": "blog", "kit": { "host": "apps.example.com" } }The App’s name is package.json#name without its npm scope. No other configuration is needed: Kit discovers the plugin among the installed packages. The plugin’s own engine metadata adds the /ajo/origin root to the App’s descriptor and declares the optional AJO_ORIGINS_FILE variable, so the build includes Kit’s reader for the origins manifest the host mounts there; Origins and CSRF describes it.
The App image
kit deploy runs kit build, which seals the App into dist/ajo, and then writes the image itself, with no Podman or Containerfile. It is a FROM scratch image of one layer with the engine at /bin/ajo-engine, its ISC license and third-party notices under /usr/share/licenses/ajo-engine, the artifact at /app, an empty directory for each filesystem root the artifact declares, and, when the App declares network access, a CA store for outbound TLS. It runs as USER 1000:1000, and the same input gives the same bytes.
- The App listens on
0.0.0.0:8080, which Kit’s defaults already do, and answersGET /to be considered ready. - The host imports one
linux/amd64image of at most 128 MiB. - The container’s root filesystem is read-only; persistent writes belong under
/ajo/data, the App’s own data directory. - The host sets
APP_URLto the App’s generated address and generatesAPP_SECRET. When the host lacks a name the App requires, the deploy stops withenv_missingbefore anything is replaced; set it in the App’s Secrets, also before the first deploy.
Targets
The Git branch chooses the target, and the command prints it before anything is built: main, master or production deploy the production App at https://<app>.<host>, staging deploys staging.<app>, and any other branch a private preview. A detached HEAD is refused. A preview answers 403 without its access link, which the host operator gives out and each deployment rotates. The host’s own name always serves the administration App.
Deploy with a token
kit host create records the host’s SSH access, so the machine that created the host deploys over SSH. Another machine, such as a teammate’s or a CI runner, deploys with an App token instead:
In the administration App, open Profile, then Tokens, and create a token for the App. It names one App base name, which covers its production, staging and preview targets, holds only
apps:deployand expires after 90 days. The value appears only once.Save it as the only line of a private file in the host’s directory, outside the project:
Terminal (umask 077; mkdir -p ~/.config/ajo/hosts/apps.example.com/tokens) (umask 077; cat > ~/.config/ajo/hosts/apps.example.com/tokens/blog)Run
pnpm kit deploy. With no SSH access recorded for the host, it sends the token over verified HTTPS to the administration App athttps://<host>, and nowhere else.
The client uploads the image in verified chunks and prints the deployment ID before it submits. Success is reported only after the host confirms it; a version that fails readiness is a failed deployment, even when the rollback that follows succeeds. A token cannot deploy the administration App or an App with privileged host mounts, and it refuses the names admin and host. It never changes the App’s secrets or grants host administration.
If observation is interrupted, resume it from the same App and Git branch, with the same token:
pnpm kit deploy --resume <id>Over SSH, kit deploy connects as ajo-ops with the recorded identity and trusts only the host key that kit host create checked over HTTPS; an unknown or changed key stops it with host_key_untrusted. The SSH path is the operator’s trusted path: its helper script can also grant the typed host-operations capability meant for the administration App, which kit deploy never does.
Replacement and recovery
Every arrival gets a named version. If the new version does not answer HTTP, the host attempts to restore the previous image, together with the last environment revision proven to run with it, and still reports the deployment as failed.
- Rollback restores an image. It never rolls back App data or database migrations.
- A failed rollback is recorded and needs an operator.
- After a confirmed rollback, fix the cause and submit a new deployment.
- SSH and token deployments, lifecycle actions and preview retirement share one deployment lock.
Update or delete a host
pnpm kit host updateRun in the App, it installs the latest release’s administration App on the host in kit.host, over the recorded SSH access, when that admin is newer than the installed one and the host provides the contract it requires. It never installs an older admin (it answers admin_is_current) and never replaces the HostImage: when the latest admin needs a newer host, it stops with admin_needs_newer_host, and a host moves to a newer image only by being created again.
pnpm kit host delete apps.example.comThe name is the confirmation. It removes a host that kit host create made, with every App on it and their data: a local host’s QEMU process and disk, or a DigitalOcean host’s Droplet, SSH key and, when kit host create could not delete it and no host still being created uses it, image. A failure keeps the host’s directory, so running it again finishes the job.
- Deploy your first AppCreate a host and deploy the starter to it.
- The hostDomains, secrets, backups and privileges after deployment.
- Ajo ServerWhat the host includes and its current status.
Full reference: ajo-kit-server on npm