pyo-server
The program that sets up a machine as one of Pyo's servers.
pyo-server sets up a machine as one of Pyo's servers: a sandbox server, a server that joins a cluster, or a cluster's first server. It's new in Pyo 0.53.0. It runs on Linux, on x86-64 and arm64, as root.
pyo is the CLI for your computer and CI. pyo-server is for a server.
The command Pyo shows
Pyo shows one line for each setup. It downloads pyo-server, checks it, puts it in /usr/local/bin and runs it with a command and a token:
curl -fsSL https://pyo.dev/v/0.53.0/server.sh | bash -s -- join pyoj1_eyJzZXJ2ZXIi...| Where Pyo shows it | What it runs |
|---|---|
| Add server on the Sandboxes page, and Reset access or Update on a sandbox server | sandbox <token> |
| Add server on a cluster | join <token> |
| Add cluster | connect <token>. On Pyo Cloud, and with PYO_AGENT_SELF_UPDATE=false, it ends in --auto-update or --no-auto-update. See Agent updates |
| Refresh this cluster | connect with no token |
| Add server on a cluster whose first server isn't on the tailnet yet, and Move on the Tailscale card | tailnet <token> |
Copy the line from Pyo and run it on the server. It asks for sudo when it needs root.
A machine that isn't on your tailnet yet gets server.sh from this release on pyo.dev, at https://pyo.dev/v/<version>/server.sh. Refresh this cluster gets it from Pyo itself, at <your Pyo>/install/server.sh. With PYO_SCRIPTS_URL set to a mirror, both come from the mirror, and the line adds --version.
This machine, the server Pyo runs on, keeps its own commands in 0.53.0. Its connect and refresh commands run connect.sh from Pyo on http://127.0.0.1:8000, and Pyo is still installed and updated with install.sh. See Installing Pyo.
Commands copied before 0.53.0
Commands with connect.sh, join.sh and sandbox.sh keep working. Those scripts are still published with each release, and a server set up by them keeps running. pyo-server takes over such a server when it runs there, and changes nothing that's already right.
To have Pyo show the scripts' commands again, set PYO_SETUP_SCRIPTS=1 on Pyo's pyo deployment:
sudo k3s kubectl -n pyo-system set env deployment/pyo PYO_SETUP_SCRIPTS=1It changes the commands for sandbox servers, joining servers, connecting clusters, refreshing a cluster, the tailnet and the servers Pyo makes at Hetzner. It's for self-hosted Pyo.
The token
The token carries what the scripts' flags carried: Pyo's address, the one-time code, the Tailscale key, the join token and the registry login. Its prefix names the command it's for:
| Token | Command | Its secrets work for |
|---|---|---|
pyos1_… | sandbox | 15 minutes, once |
pyoj1_… | join | 1 hour |
pyoc1_… | connect | 1 hour, until the agent reports in |
pyot1_… | tailnet | 1 hour |
The Tailscale key in it works once. The registry login stays valid after the token expires. It's the cluster's login for pulling images from Pyo's registry.
The token isn't encrypted. Anyone who has it can read it. Treat it like a password. Its last part is a checksum, so a token cut off when you paste it is caught before anything changes.
Read a token
pyo-server token show prints what a token carries. Secrets show as their length only:
$ pyo-server token show pyoj1_eyJzZXJ2ZXIi...
This is a token for joining a cluster, for pyo-server join.
expiresAt: 2026-12-01T11:29:00Z
k3sToken: (hidden, 23 characters)
k3sVersion: v1.37.2+k3s1
name: server-2
registry.host: pyo.tail1234.ts.net:5005
registry.token: (hidden, 64 characters)
server: pyo.tail1234.ts.net
tailscaleKey: (hidden, 61 characters)Keep it off the command line
A token pasted in the line stays in your shell's history. To keep it out, put one of these in place of the token:
| In place of the token | Where the token comes from |
|---|---|
- | A prompt that doesn't show what you paste |
--token-file FILE | The file |
Nothing, with PYO_SERVER_TOKEN set | The environment variable, for scripts and cloud-init |
For example:
$ curl -fsSL https://pyo.dev/v/0.53.0/server.sh | bash -s -- sandbox -
Paste the command's token:Paste only the token, the part that starts with pyos1_, pyoj1_, pyoc1_ or pyot1_. Keep anything after it in the line, like --auto-update.
server.sh takes the token out of pyo-server's arguments and hands it over in PYO_SERVER_TOKEN. When it runs itself again with sudo, it passes the token on sudo's standard input. The Tailscale key goes to Tailscale in a file only root can read. Nothing of the token goes into the log.
When a token is refused
| It says | What to do |
|---|---|
The token is cut off: part of it is missing. Copy the whole command from Pyo again. | Copy the line again. |
This is a sandbox server's token. Run it with pyo-server sandbox. | The token is for another command. Copy the line from Pyo as it is. |
This command expired at 10:29 UTC. Copy a new one from Pyo. | Get a new command in Pyo. Nothing was changed. |
This command is from a newer Pyo. Copy it again. | The pyo-server you ran is older than the Pyo that made the token. Run the line from Pyo, which fetches the right one. |
That isn't a token from Pyo. Copy the command from Pyo again. | Copy the line again. |
How pyo-server is checked
server.sh checks pyo-server before it runs it:
- The copy each release publishes on pyo.dev carries the SHA-256 of that release's
pyo-server, written in when the release is made. It checks the download against it. - Any other copy, like Pyo's own at
<your Pyo>/install/server.shor a mirror's, downloads the release'srelease.jsonand checks its Sigstore signature with cosign. The signature must be from Pyo's release workflow at exactly that release's tag. It then checks the download against the SHA-256 listed there. cosign is the machine's own, or a pinned release of it, itself checked against its SHA-256.
If a check fails, nothing is installed. A pyo-server that's already in /usr/local/bin at that release is used as it is.
After that, pyo-server checks the release's release.json signature itself, for exactly its own release, and checks everything it downloads against the SHA-256 listed there. See Securing Pyo.
Commands on the server
Once a setup ran, pyo-server is in /usr/local/bin. Run these as root:
| Command | What it does |
|---|---|
pyo-server status | What this machine is, its release, what runs and how the last run went. --json prints it as JSON |
pyo-server update | On a sandbox server: brings pyo-server to the release Pyo runs, then updates the sandbox daemon. --version X names the release |
pyo-server sandbox | On a sandbox server, without a token: updates the sandbox daemon to this pyo-server's release |
pyo-server join | On a server that joined a cluster, without a token: brings its k3s settings up to date |
pyo-server connect | On a cluster's first server, without a token: the same as Refresh this cluster |
pyo-server uninstall | Takes Pyo off this machine. See Uninstall |
pyo-server token show TOKEN | Prints what a token carries, its secrets hidden |
pyo-server version | Prints this pyo-server's release |
Status
$ sudo pyo-server status
● Sandbox server sbx-1, Pyo 0.53.0
● The sandbox daemon is running (Firecracker on KVM)
● On your tailnet as sbx-1.tail1234.ts.net
Last run: sandbox, 2026-11-29 10:14 UTC, doneIt reads only, and changes nothing. On a server that joined a cluster it shows whether k3s is running.
Update
pyo-server update asks Pyo which release it runs, at the address the sandbox server joined with. It never goes back to an older release. It downloads that release's pyo-server, checks it against the SHA-256 in the release's signed release.json, and keeps the one it replaces as /usr/local/bin/pyo-server.previous. Then the new one updates the sandbox daemon. Running sandboxes keep running.
If Pyo doesn't say which release it runs, it says Run pyo-server update --version X, with the release your Pyo shows.
Uninstall
pyo-server uninstall finds what this machine is and takes Pyo off it:
| Machine | What it does |
|---|---|
| A sandbox server | Removes the sandbox daemon, its files, its sandboxes and its firewall rules. Tailscale stays. See Take it off a machine |
| A cluster's first server | Removes everything Pyo put into the cluster. k3s stays. See Disconnect a cluster |
| A server that joined a cluster | Removes nothing. It says This server joined a cluster. Remove it in Pyo first, then run /usr/local/bin/k3s-agent-uninstall.sh here. See Remove a server |
On a cluster, it lists what it removes and asks you to type yes:
| Option | What it does |
|---|---|
--keep-data | Keeps your projects' namespaces, databases and volumes. |
--dry-run | Only lists what it would remove. |
--yes | Doesn't ask first, for scripts. |
pyo-server itself and its log stay. To remove them too:
sudo rm -f /usr/local/bin/pyo-server /usr/local/bin/pyo-server.previous /var/log/pyo-server.logWhat a run shows
Each step gets one line. On a terminal, the step that runs shows its time, like → Downloading k3s… 0:12, then stays as how it ended:
| Mark | Meaning |
|---|---|
✓ | Done, with its time when it took 5 seconds or more |
✗ | Failed |
● | Something to know, or a step that goes on by itself |
A sandbox server's setup looks like this, shortened:
✓ Downloaded pyo-server 0.53.0
✓ Downloaded the sandbox files 0:07
✓ Installed Tailscale 0:19
✓ Joined your tailnet
✓ Got an HTTPS certificate for sbx-1.tail1234.ts.net
● Firecracker on KVM. A test VM booted in 142 ms.
✓ Joined Pyo as sbx-1
✓ Started the sandbox daemon
✓ sbx-1 is a sandbox server now. It shows up in Pyo in a few seconds.Off a terminal, like in a CI log or cloud-init, there are no colors and no lines drawn over. A step's line comes once, then again with its time every 20 seconds while it runs. Set NO_COLOR=1 to turn colors off on a terminal.
A failure is the step's ✗ line, then one line that says what's wrong and what to do next, then where the log is:
✗ Getting an HTTPS certificate for sbx-1.tail1234.ts.net
Error: Couldn't get an HTTPS certificate for sbx-1.tail1234.ts.net. Turn on HTTPS certificates in your tailnet's DNS settings, then run the same command again.
The full log is /var/log/pyo-server.log.Running it again
Run the same command again after a failure. Each step checks whether it's done already, and does only what isn't. A sandbox server that joined Pyo before the failure goes on from there, though its one-time code is used. The run then starts with Going on after "<the step it failed at>".
Only one setup changes a server at a time. A second one says Waiting for another Pyo setup on this server to finish. and starts when the first is done.
Log
/var/log/pyo-server.log keeps every run that changes the machine: when it started, the command, the release, each step and the full output of every tool it ran, also when the step went well. Only root can read it. Secrets from the token are written as their name and length only.
On the terminal, a failed step shows the last lines of its output.
State file
/var/lib/pyo-server/state.json keeps what this machine is, its release, Pyo's address and the last run with the step it ended on. pyo-server status reads it. It holds no secret.
Exit codes
| Code | Meaning |
|---|---|
0 | Done, or nothing to do |
1 | Failed. The last lines say why and what to do |
2 | Wrong usage, like an unknown option |
3 | tailnet couldn't move k3s to the tailnet and put it back as it was |