Unisrv logoUnisrv.io
CLI Reference

CLI Overview

The unisrv CLI reference.

The CLI is declarative: you describe a project in unisrv.hcl and apply it.

unisrv up        # apply unisrv.hcl to an environment
unisrv status    # see what is running
unisrv destroy   # tear the environment down

Everything else is setup (hosts, registry credentials) or inspection (status, logs).

Environments

Every command that touches running resources works against one environment, resolved from project in your unisrv.hcl and prompted when ambiguous. Pin it with --env <name>:

unisrv up --env staging

The same file applied to a different environment gives an independent copy. That is how per-PR and per-agent environments work.

Session

CommandWhat it does
unisrv loginSign in through the browser, then pick the account to act as.
unisrv accountShow the account you act as.
unisrv account switch [id]Act as another account, by its id or short id. Asks when you leave it out.
unisrv logoutForget the stored session on this machine.
unisrv auth tokenPrint an access token to stdout, for scripts and docker login. -j for JSON.

login opens a browser on this machine. Over SSH, or with --no-browser, it prints a URL instead. Open it on any device and paste back the code it shows.

You can belong to several accounts. Every command acts as the one you picked.

Project

CommandWhat it does
unisrv upApply unisrv.hcl from the current directory. Shows a plan first.
unisrv statusWhat is running across this project's environments, with per-service traffic. --json for scripts.
unisrv destroyDelete an environment and everything in it.

up takes --var KEY=VALUE and --var-file FILE (both repeatable) for interpolation. Both up and destroy take -y to skip confirmation, required when no terminal is attached, as in CI.

Some changes are destructive: renaming a service or network, changing a network's iprange, or changing a deployment's volume recreates the affected resources. unisrv up tells you before it does it.

Hosts

CommandWhat it does
unisrv host claim <hostname>Claim a domain and provision a TLS certificate for it.
unisrv host listList claimed hosts.

A host must be claimed before a service can list it in hosts. unisrv up claims *.unisrv.dev names for you. For your own domain, claim prints the DNS records to create and asks you to confirm before it requests the certificate.

Claiming is per account, and a host binds to one service globally. You don't need a host to get a URL. Every service is reachable at {service}-{environment-slug}.unisrv.dev.

Registries

Public images need no setup. Private ones need a credential, stored on your account rather than this machine, so the platform can pull on your behalf. The web console manages the same credentials.

CommandWhat it does
unisrv registry add <hostname>Add a credential, e.g. unisrv registry add ghcr.io -u <username>.
unisrv registry listList configured registries. --json for scripts.
unisrv registry update <hostname>Replace the credentials for a registry.
unisrv registry delete <hostname>Remove a credential.
unisrv registry test <hostname>Check the stored credentials still work upstream.

add validates upstream before saving (--no-validate to skip) and prompts for the password, or reads it from stdin:

echo $GITHUB_TOKEN | unisrv registry add ghcr.io -u <username> --password-stdin

Instances

unisrv up creates instances; these commands inspect them, plus run for one-shot containers. Instances are referenced by UUID, name, or short id: the last 8 characters of the UUID, as instance list shows it, or enough of their start to pick one out.

CommandWhat it does
unisrv instance listInstances in the environment. -a includes stopped ones, --json for scripts.
unisrv instance logs <name>Print logs. -f follows until the instance stops.
unisrv instance run <image> [cmd...]Start a one-shot instance and follow it until it exits.
unisrv instance rm <name>Stop and remove an instance. -t <secs> for a graceful shutdown.

Use instance run for one-off work: a migration, a script, a check that an image boots. It takes -e KEY=VALUE, --env-file, --cpus, -m/--memory, --name, --network, -d to detach, and --rm to clean up on exit. --arch and --isolation restrict which nodes it can run on, like placement.

The command exits with the container's exit code, so instance run works in a && chain.

unisrv instance run alpine echo hello
unisrv instance run --network internal -e PGPASSWORD=... --rm migrate:latest

An instance started with run is not managed by unisrv.hcl. unisrv up will not touch it, and it will not come back if it dies.

On this page