The uc command line
Install on Windows, macOS and Linux without Node.js; deploy a folder, logs, variables, domains, databases, cron jobs, files and console.
uc is the UniCloud command line. It is a single executable: you do not need Node.js, curl or tar. It runs on Windows 10/11 (PowerShell and cmd), macOS (Intel and Apple Silicon) and Linux (x64 and arm64) and talks to the public API, so it can do exactly what its token allows.
Install
Open PowerShell (no administrator rights needed) and run:
irm https://<panel address>/cli/install.ps1 | iex
The same from cmd:
powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://<panel address>/cli/install.ps1 | iex"
The installer downloads uc.exe, checks its SHA-256 against /cli/SHASUMS256.txt, puts it into %LOCALAPPDATA%\Programs\unicloud and adds that folder to your user PATH. Open a new terminal window and check: uc version.
Without the installer: download https://<panel address>/cli/windows-x64 (saved as uc.exe) into any folder on your PATH.
curl -fsSL https://<panel address>/cli/install.sh | sh
The installer picks the build for your processor (Apple Silicon or Intel), checks the SHA-256, signs the file with a local signature (codesign --sign -; macOS does not run a modified binary without it) and puts it into ~/.local/bin/uc. If that folder is not on your PATH, add this line to ~/.zshrc:
export PATH="$HOME/.local/bin:$PATH"
Downloaded the file by hand (/cli/macos-arm64 or /cli/macos-x64)? Sign it yourself: chmod +x uc && codesign --force --sign - uc.
curl -fsSL https://<panel address>/cli/install.sh | sh
# or without curl:
wget -qO- https://<panel address>/cli/install.sh | sh
Builds exist for x64 and arm64 (Raspberry Pi 4/5, ARM servers). The file goes to ~/.local/bin/uc; choose another folder with UC_INSTALL_DIR=/usr/local/bin (needs write access).
With Node.js (npm)
If Node.js 20+ is already installed, install uc as a package or run it without installing:
npm i -g https://<panel address>/cli/uc.tgz
npx --yes https://<panel address>/cli/uc.tgz ls
Update with uc upgrade (the standalone file replaces itself after a checksum check). Once a day uc checks for a newer version and says so in one line; turn it off with UC_NO_UPDATE_CHECK=1.
Sign in
uc login --url https://<panel address>
Sign-in goes through the browser, like gh auth login: uc shows the /app/device address and an 8-letter code (for example BCDF-GHJK) and opens the page itself. In the panel (if you are not signed in, it asks for your password and second-factor code first) check that the code matches the terminal, see which computer and system ask for access, choose the token scope and lifetime and press Allow. A few seconds later uc receives the token and saves it. The code is valid for 10 minutes and works once; press Deny and no access is given. Every such sign-in sends a “New sign-in from the command line” email, and the token appears under Account → API tokens with the computer name, where you can revoke it.
A read-only scope is enough for ls, status and logs; deploys, variables and the console need full access. uc whoami shows who you are signed in as.
The old way still works: uc login --token asks for a ready token from Account → API tokens (the input is hidden), uc login --token uc_… takes it from the argument.
Where the token is kept:
%APPDATA%\unicloud\config.json — your profile folder, only your account can read it.
~/Library/Application Support/unicloud/config.json, mode 0600.
~/.config/unicloud/config.json (or $XDG_CONFIG_HOME/unicloud), mode 0600.
CI does not need a login: set UC_TOKEN and UC_URL, they take precedence over the saved login. A token can also come from standard input: echo $TOKEN | uc login --token -.
First deploy
uc create shop --kind app # asks for the plan and datacenter
cd my-project
uc link shop # link the folder: no name needed from now on
uc env import .env # variables from the file
uc deploy # pack, upload, show the build
uc logs -f # live log
uc open # open the site
uc deploy packs the folder itself, without a system tar: it shows the upload progress and then the build log until the result. The archive holds the files git sees (honouring every .gitignore); without git, a walk of the folder with the .gitignore of each folder. A .ucignore file (same syntax as .gitignore) excludes what git needs but the server does not. .git, node_modules and .uc are never sent. The archive limit is 300 MB. Retrying after a dropped connection is safe: the command sends an idempotency key.
The log of a running build can be read as a stream: GET /api/v1/workloads/<id>/deploys/<deploy>/log/stream (Server-Sent Events) sends log chunks as the build goes, resumes from the position in Last-Event-ID after a dropped connection and reports the result in the end event. uc deploy and the panel read the log the same way. Secrets of the resource are masked as ***.
Deploy queue and cancelling
An app runs at most one deploy at a time. A new deploy during a build (a Git push, uc deploy, the panel button, an API call) is not rejected: it waits in the queue and starts by itself when the current one finishes. The API answers {"deploy": "d_…", "status": "queued"}, and uc deploy says the deploy is waiting and shows the log once the build starts.
- A newer deploy of the same source (the same branch, any tag, an archive, an image) replaces the waiting one: a stale commit is not built, and the latest one is always rolled out. The branch is cloned when the build starts.
- A redelivered webhook with the same commit does not create a second deploy: the answer holds the existing number and
"duplicate": true. - At most 5 deploys of an app from different sources can wait; the sixth gets error 429.
- The queue lives in the database and survives a server restart: a build interrupted by the restart is marked failed, waiting deploys continue.
- A rollback (
uc rollback) is not queued: during a deploy it answers 409.
uc cancel <resource> (also uc deploy <resource> --cancel, the “Cancel” button in the panel, POST /api/v1/workloads/<id>/deploys/<deploy>/cancel) cancels the running build, or a waiting deploy if nothing is building. A deploy number can be given: uc cancel shop d_…. Only this app's build is stopped, the running release keeps answering, the deploy status becomes “Cancelled”, and the next waiting deploy starts. Starting the new release with its health check cannot be cancelled: the previous release keeps working until the new one passes the check anyway.
Secrets in the build and deploy log are replaced with ***: secret shared variables of the project and environment, app variables named like *_PASSWORD, *_SECRET, *_TOKEN, *_KEY, the password in a DATABASE_URL address and the repository token. Values shorter than 6 characters are not hidden.
Monorepo: what to build
For an app from Git you can set the build folder, a custom Dockerfile, auto-deploy paths and the trigger — the same as the “Source settings” card in the panel. Applies from the next deploy.
uc source shop # current settings
uc source set shop --root-dir apps/api --dockerfile Dockerfile.prod
uc source set shop --watch "apps/api/**" --watch "packages/shared/**" --watch "!**/*.md"
uc source set shop --trigger tag # deploy on a new tag instead of a push to the branch
uc source set shop --no-watch --root-dir= # any push, repository root
Only the given flags change. --watch can be repeated (up to 10 globs), a leading ! excludes. The server checks the paths: from the repository root, no ..; an error names the field. In the API: GET and PUT /api/v1/workloads/<id>/source with the body {"rootDir", "dockerfilePath", "watchPaths", "gitTrigger"} — PUT replaces the settings as a whole.
Commands
<resource> is a name or an id w_…; in a linked folder you can leave it out.
| Command | What it does |
|---|---|
uc ls / uc status <resource> | list resources / state, address, deploys |
uc create [name] [--kind --plan --dc] | new resource; without flags it asks for the kind, plan and datacenter |
uc plans [--kind app] | plans and datacenters |
uc deploy [resource] [folder] | deploy a folder; --git <url> --branch main — from a repository |
uc logs <resource> [-f] [-n 200] | log; -f — live stream |
uc rollback <resource> [--release N] | roll back to an earlier release without a build |
uc cancel <resource> [deploy] | cancel the running build or a waiting deploy; the current release keeps working |
uc restart, stop, start <resource> | lifecycle |
uc sleep <resource> [minutes|off] | sleep when there are no requests |
uc env ls|set|unset|import|export | environment variables |
uc source [show|set] <resource> | where an app is built from and what triggers auto-deploy |
uc previews [ls|rm|approve] <resource> [PR number] | pull request previews: URLs, deletion, approving a PR from a fork |
uc build [show|set] <resource> [--platform linux|windows|macos|ios] [--target …] [--scheme …] | platform and settings of an app build; uc artifacts ls|download <resource> — the built files |
uc domains ls|add|verify|rm | custom domains |
uc db ls|create|url|link | managed PostgreSQL, MySQL, Redis |
uc cron ls|add|rm|run | scheduled jobs |
uc files ls|get|put|mkdir|rm | files of the persistent volume, whole folders too |
uc console <resource> | terminal of the container or VM; leave with exit or Ctrl+] |
uc exec <resource> -- <command> | run a command in the container |
uc open [resource] | open the address in a browser (the panel without a resource) |
uc mcp | MCP server for AI assistants, see the article |
uc rm <resource> | delete with its data (asks for confirmation) |
Examples:
uc create db1 --kind database --engine postgres --plan <plan>
uc db link db1 shop # connection URL goes into the app's DATABASE_URL
uc domains add shop example.com # shows the TXT record to verify ownership
uc cron add shop "*/15 * * * *" "node jobs/cleanup.js"
uc files put shop ./uploads uploads # a whole folder
uc files get shop uploads ./backup
Scripts and CI
--json on any command prints JSON data (errors go to stderr as JSON), --yes answers yes to confirmations, --no-color and NO_COLOR=1 turn colour off. Exit codes: 0 success, 1 error, 2 wrong usage, 3 not signed in or token revoked, 130 interrupted with Ctrl+C. Errors show the API code ([validation_failed], [insufficient_scope]…) and the reason for each field.
# GitHub Actions
- run: curl -fsSL https://<panel address>/cli/install.sh | sh && ~/.local/bin/uc deploy shop
env:
UC_TOKEN: ${{ secrets.UC_TOKEN }}
UC_URL: https://<panel address>
Completion
uc completion powershell >> $PROFILEuc completion zsh >> ~/.zshrcuc completion bash >> ~/.bashrcResource names are completed from the list of the last uc ls.
Encoding on Windows
PowerShell and cmd windows show non-Latin text correctly. If you redirect the output of uc to a file or another command in Windows PowerShell 5.1, switch the session to UTF-8: [Console]::OutputEncoding = [Text.Encoding]::UTF8. PowerShell 7 does not need this.