# Introduction The open-source PaaS alternative to Vercel, Netlify, Railway, Render and Fly.io. Deploy apps, run services, and create isolated sandboxes, from one machine to a whole cluster. Pyo is an open-source, self-hosted PaaS. It works like a modern cloud platform, on hardware you own or rent. Deploy anything: websites and APIs, background workers, cron jobs, databases, and services that speak plain TCP or UDP, like game servers and DNS servers. Start from a Git repository, a container image, a template or a Docker Compose file, and Pyo builds it, runs it and puts it on the web with HTTPS. Pyo aims to be secure out of the box, without settings you have to know to turn on. Pyo runs on k3s, but you never have to touch Kubernetes. Your services keep running if Pyo itself is down, and everything it deploys is standard Kubernetes, so you're never locked in. ## Where to start - [Installing Pyo](https://pyo.dev/docs/install): Get Pyo running on your machine. - [Making your first deploy](https://pyo.dev/docs/first-deploy): Go from nothing to a live service. - [Core concepts](https://pyo.dev/docs/concepts): Teams, projects, services and clusters. - [Deploying a template](https://pyo.dev/docs/templates): Popular software, ready to run. ## What makes Pyo different **Scales and stays up** - Autoscaling on CPU and memory, with replicas spread across servers. See [Scaling a service](https://pyo.dev/docs/scaling). - Services move to a healthy server when one fails. See [Making Pyo highly available](https://pyo.dev/docs/high-availability). - Several clusters, with regions. Keep traffic on the same server or within its region, or send it across all servers. See [Serving traffic by region](https://pyo.dev/docs/regions). **Secure by default** - All public traffic goes through [Pyo Gateway](https://pyo.dev/docs/gateway). It's the one part every visitor reaches, so it's kept apart from your secrets and can't read your services' passwords and keys. - The Pyo agent on your servers only has the rights it needs, and follows a policy that only you can change. - Projects are [isolated](https://pyo.dev/docs/network-isolation) from each other by default. - Secrets are [encrypted](https://pyo.dev/docs/encryption) with each team's own key, which you can keep in OpenBao or Vault. - Sign in with [passkeys](https://pyo.dev/docs/passkeys), with limits on failed sign-ins, and give scripts [API keys](https://pyo.dev/docs/api) that expire. - The team's **Security** page shows every protection for each of your clusters. See [Securing Pyo](https://pyo.dev/docs/securing-pyo) for what to do after installing. - A [firewall](https://pyo.dev/docs/firewall) for each service, by address, range or country, with rate limits. - An optional [web application firewall](https://pyo.dev/docs/waf) for each service's websites. **Sees what's happening** - Website [analytics](https://pyo.dev/docs/observability#analytics) with no script to add. - CPU, memory, disk and network for every server and service. See [Monitoring your services](https://pyo.dev/docs/observability). **Runs your databases** - [Postgres, MySQL and KV](https://pyo.dev/docs/databases), created in one click. - High availability with automatic failover. - Backups with point-in-time recovery. MySQL restores to any moment up to its latest backup. - Read replicas for Postgres and KV. - Live logs and events, and one click to connect a service. **Keeps your data safe** - [Backups](https://pyo.dev/docs/backups) of volumes and databases, to the backup store built into Pyo or your own S3-compatible storage. Volume backups are encrypted. **Automates everything** - A full [API](https://pyo.dev/docs/api), with a reference for every operation. - The [`pyo` CLI](https://pyo.dev/docs/cli), for your terminal and CI. - [MCP](https://pyo.dev/docs/mcp) for AI assistants. It can do everything the API can, with **Read only**, **Deploy**, **Sandboxes** or **Full** access. **And more** - [GPUs](https://pyo.dev/docs/gpus) for AI models. - [Sandbox](https://pyo.dev/docs/sandbox): isolated microVMs on demand, for AI agents, code interpreters, previews and CI. - [External secret stores](https://pyo.dev/docs/external-secrets), like Vault, AWS, GCP, Azure and Doppler. - [Docker Compose import](https://pyo.dev/docs/deploy/compose). - TCP and UDP ports go through the gateway, with connection analytics. Turn the gateway off for a port to send its traffic straight to your service. See [public TCP and UDP ports](https://pyo.dev/docs/domains#public-tcp-and-udp-ports). --- # Following activity See what changed, and hear about what matters. ## Activity **Activity** records what happened across your team: who deployed or changed what, and when. Find it in the sidebar's **Observability** menu. You can also open it from the bell in the header with **View all activity**. When an admin changes Pyo's own settings, such as observability, updates, backups or Tailscale, it shows in the activity of the team whose cluster runs Pyo. Owners and admins can also see how and from where each change was made, with sign-ins included, in the [audit log](https://pyo.dev/docs/audit-log). ## Notifications The bell in the header shows your team's events. Choose which topics appear under **Notifications**, in the sidebar's **Team** section: - Failed deployments - Successful deployments - Server health - Domains - Service changes - Team and projects These topics are for this browser only. To tell the whole team in Telegram, Discord, Slack or a webhook, set up [alerts](https://pyo.dev/docs/alerts). --- # Admin sign-in Limit where the installation's admins can sign in from. An installation admin can change everything in Pyo, for every team. **Admin sign-in** limits where admin accounts can sign in from: your tailnet, a list of IP addresses, or both. By default, admins can sign in from anywhere. It only applies to installation admins. Team owners, admins, developers and viewers sign in from anywhere, as before. ## Set it up 1. Open **Settings → Security** and find **Admin sign-in**. 2. Turn on **Tailnet** to allow devices on your tailnet. The switch shows when Pyo has a [tailnet address](https://pyo.dev/docs/tailscale). 3. Under **IP addresses**, add addresses or ranges, one per line. IPv4 and IPv6 both work, like `203.0.113.7` or `2001:db8::/48`. The field shows your own address. 4. Choose **Save changes**. With both set, either one is enough. With neither, admins can sign in from anywhere. You can add up to 100 addresses. Pyo won't save a rule that shuts out the address you save it from. It asks you to add your address first. Only an installation admin can change this, and only from the dashboard. Each change is recorded in the **Activity** of the admin's teams. ## What it restricts From anywhere else, an admin account: - **Can't sign in.** This covers a password, a two-factor code, a [passkey](https://pyo.dev/docs/passkeys), a sign-in link and `pyo login`. Pyo answers as it does for a wrong password, so the page tells nothing about the account or the rule. - **Has no dashboard session.** A browser that's already signed in is treated as signed out. The session works again once it's back at an allowed address. - **Keeps its API keys, without admin powers.** [API keys](https://pyo.dev/docs/api) and [MCP](https://pyo.dev/docs/mcp) connections keep working from anywhere, with the account's role in each team. They can't change the installation. Each refused sign-in is recorded in the account's [audit log](https://pyo.dev/docs/audit-log). With [email](https://pyo.dev/docs/email) set up, Pyo also emails the account. Pyo uses the visitor's address as described in [Client IP headers](https://pyo.dev/docs/securing-pyo#client-ip-headers). Behind a CDN, list the CDN's ranges in `PYO_TRUSTED_PROXIES` first. Otherwise Pyo sees the CDN's address and not yours. ## If you're locked out Run this on the server Pyo runs on: ```bash sudo pyo-reset-login ``` Open the link it prints. A link made on the server turns the rule off, so you can sign in from anywhere. It also turns off two-factor authentication for that account. See [Getting back in](https://pyo.dev/docs/getting-back-in#on-the-server). Set the rule again once you're in. A link from **Forgot password?** or from a team owner doesn't turn the rule off. From an address that isn't allowed, it answers like a used link. It still works from an allowed address. You can also make Pyo ignore the rule for a while: ```bash sudo k3s kubectl -n pyo-system set env deployment/pyo PYO_ADMIN_SIGNIN_ANYWHERE=1 ``` While it's set, admins can sign in from anywhere, and the **Admin sign-in** panel says so. The saved rule isn't changed. To apply the rule again, remove the variable: ```bash sudo k3s kubectl -n pyo-system set env deployment/pyo PYO_ADMIN_SIGNIN_ANYWHERE- ``` ## On Pyo Cloud On Pyo Cloud, the installation admins are our own staff, and we set this rule for them. It never applies to your account. Your team signs in from anywhere, and you can't change the rule. --- # For AI agents The commands a coding agent runs to deploy an app to Pyo, and what to ask the person first. This page is written for AI coding agents. If someone asked you to deploy an app to Pyo, follow it from top to bottom. It's also plain Markdown at `https://pyo.dev/md/ai-agents.md`. Pyo is a platform a person runs on their own servers, or uses hosted as Pyo Cloud. Every Pyo has its own address, like `https://pyo.example.com`. The `pyo` CLI deploys a folder to it. ## Before you start - **Find the Pyo's address.** Run `pyo whoami`. If it prints an account, you're signed in and can skip to [Deploy](#3-deploy). If not, ask the person for their Pyo's address. Pyo Cloud's is `https://cloud.pyo.dev`. Don't guess one. - **Don't install Pyo itself.** `https://pyo.dev/install.sh` turns a server into a Pyo. Run it only when the person asks to install Pyo on that machine. Deploying an app needs only the CLI. ## 1. Install the CLI On Linux and macOS: ```bash curl -fsSL https://pyo.dev/cli.sh | sh pyo --version ``` It installs to `/usr/local/bin` when that's writable, and to `~/.local/bin` otherwise. If `pyo` isn't found afterwards, add `~/.local/bin` to `PATH`. For Windows, see [the CLI page](https://pyo.dev/docs/cli#windows). ## 2. Sign in ```bash pyo login --url https://your-pyo ``` It prints a code and a link, then waits up to 10 minutes. Show both to the person. They open the link in a browser, type the code and approve. It needs no terminal input, so it works from an agent's shell. With an API key there's no browser step. The person makes the key under **API keys** in Pyo. Making a new service needs a key with full access. Set these in the environment, and don't write the key to a file in the repository: ```bash export PYO_URL=https://your-pyo export PYO_API_KEY= ``` ## 3. Deploy From the app's folder: ```bash pyo deploy ``` In a folder with no `pyo.jsonc`, it makes a service named after the folder, links the folder by writing `pyo.jsonc`, uploads the folder and builds it. It builds with the folder's Dockerfile, or without one by detecting the language. Then it follows the deployment to the end and exits with an error when the build or the deploy fails. In a folder that has a `pyo.jsonc`, it deploys the service that file names. | To | Pass | | --- | --- | | Name the new service | `--name web` | | Choose its project, made when there's none by that name | `--project shop` | | Choose the team or the cluster | `--team acme`, `--cluster home` | | Deploy to a service that exists already | `pyo link shop/api`, then `pyo deploy` | `.gitignore` and `.pyoignore` decide what's uploaded. `.env` files aren't sent. Set variables with `pyo env set KEY=value`, with `--secret` for secrets, or send a `.env` file's with `pyo env push`. ## 4. Check it ```bash pyo status # state, live version and domains pyo logs # the service's logs pyo logs --build # the latest deployment's build and deploy log ``` Add `--json` to a read command for JSON and nothing else. ## When a command stops | It says | Do this | | --- | --- | | `Not signed in. Run: pyo login` | Sign in as in step 2. | | `Say which project with --project.` | The team has more than one project. Run `pyo deploy --project `. | | `This team has no cluster to deploy to. Add a server first.` | Ask the person to add a server in Pyo. See [Clusters](https://pyo.dev/docs/clusters). | | `Deploying a folder needs a builder. Add one in Builders, then deploy again.` | Ask the person to add a builder in Pyo. See [Builders](https://pyo.dev/docs/builders). | | The build or the deploy fails | Read `pyo logs --build`, fix the cause in the code or in `pyo.jsonc`, and run `pyo deploy` again. | ## Settings and domains A service's port, health check, replicas, resources and variables go in [`pyo.jsonc`](https://pyo.dev/docs/cli/pyo-jsonc), next to the code. `pyo deploy` applies the file each time. ```bash pyo domain add app.example.com ``` This serves the service on a hostname without a redeploy. `pyo domain list` shows each domain's status. ## Ask the person first - Before you delete a service, a database, a volume or a domain. - Before you change a service you didn't make in this session. - Before you put an API key or another secret in a file. `pyo rollback` puts the previous version back when a deploy you made breaks the service. ## Set the folder up for next time ```bash pyo agents --client claude --yes ``` This writes a Pyo section in `AGENTS.md` with the Pyo's address, the linked service and the commands above. `--client` also adds Pyo's [MCP server](https://pyo.dev/docs/mcp) to that client's project config: `claude`, `cursor`, `vscode` or `codex`. The MCP server is at `https://your-pyo/api/mcp`, and the client signs in with OAuth, so no key goes in a file. ## More to read - [`https://pyo.dev/llms.txt`](https://pyo.dev/llms.txt): every docs page as a list. - [`https://pyo.dev/llms-full.txt`](https://pyo.dev/llms-full.txt): all docs in one file. - `https://pyo.dev/md/.md`: any docs page as Markdown, like `https://pyo.dev/md/cli.md`. - Any docs page also answers in Markdown to a request with `Accept: text/markdown`. - [`https://pyo.dev/openapi.json`](https://pyo.dev/openapi.json): the API. - [The CLI's commands](https://pyo.dev/docs/cli/commands). --- # Alerts Send important events to Telegram, Discord, Slack or a webhook. Pyo can tell your team when something needs a look, in the chat you already use. Alerts belong to the team, so everyone sees the same ones. Owners and admins set them up under **Notifications**, in the sidebar's **Team** section. ## What Pyo sends Each channel gets all of these unless you turn some off: - **Deploy failed.** A build or rollout of a service failed. - **Server offline**, and **back online**. A server in a cluster stopped being ready, or a cluster's agent stopped reporting to Pyo for a minute. - **Server low on disk or memory**, and **back to normal**. A server ran low on disk space or memory, so Kubernetes may stop some of its pods. - **Backup failed.** A backup of a volume or database failed, or its server never answered. - **Certificate expiring or not renewed.** A certificate you uploaded, or one you made for [mTLS](https://pyo.dev/docs/certificates#mutual-tls-mtls), expires in 30 days, in 7 days, or has expired. Or the HTTPS certificate of a domain stopped working because it couldn't be renewed. A message says what happened, the team, the service or server, and links to the right page in Pyo. Links use Pyo's address: its tailnet name, else its public one. Messages never hold environment variables, tokens or logs. Pyo sends one alert about the same service, server or certificate in 15 minutes. A server that keeps going offline and coming back sends **offline** and **back online** once. If it's still offline when the 15 minutes are over, Pyo says so then. Alerts are sent in the background and never slow a deploy down. If a channel doesn't answer, Pyo tries again for about an hour. Each channel shows when it last sent, or why it last failed. ## Telegram 1. In Telegram, talk to [@BotFather](https://t.me/BotFather) and send `/newbot`. Pick a name. BotFather answers with the bot's token, like `123456789:AAE…`. 2. Add the bot to the group or channel the alerts should go to. In a channel, make it an admin that can post. 3. Find the chat's ID. Send a message in the chat, then open `https://api.telegram.org/bot/getUpdates` in a browser. The ID is `chat.id`, a number like `-1001234567890`. A public channel can use its `@name` instead. 4. In Pyo, choose **Set up** on the **Telegram** card, paste the token and the chat ID, and choose **Add**. ## Discord 1. In Discord, open the channel's settings, then **Integrations › Webhooks**, and choose **New Webhook**. 2. Choose **Copy Webhook URL**. It starts with `https://discord.com/api/webhooks/`. 3. In Pyo, choose **Set up** on the **Discord** card and paste the URL. Alerts never mention `@everyone` or anyone else. ## Slack 1. Create a Slack app at [api.slack.com/apps](https://api.slack.com/apps) (**From scratch**), then turn on **Incoming Webhooks** in it. 2. Choose **Add New Webhook**, pick the channel, and copy the URL. It starts with `https://hooks.slack.com/services/`. 3. In Pyo, choose **Set up** on the **Slack** card and paste the URL. ## Webhook A webhook sends each alert to your own URL as a `POST` with a JSON body: ```json { "event": "deploy_failed", "title": "Deploy failed: web", "team": { "name": "Acme", "slug": "acme" }, "details": { "project": "shop" }, "url": "https://pyo.example.ts.net/acme/shop/web/deployments/dpl_8kq2x7ad", "at": 1795000000000 } ``` `event` is one of `deploy_failed`, `server_offline`, `server_online`, `server_pressure`, `server_pressure_ended`, `backup_failed`, `certificate_expiring`, `certificate_failed` or `test`. `details` holds what the message names, like `project`, `cluster` or `service`. `at` is in milliseconds. The URL has to use `https://`. On your own Pyo, plain `http://` works for an address on a private network, like your LAN or tailnet, unless the installation turns private networks off. Pyo Cloud only sends to addresses on the internet. Pyo never calls its own server, link-local addresses (cloud metadata services among them) or its cluster's internal networks. ### Check the signature Give the webhook a secret to sign each request. Pyo then adds these headers: - `X-Pyo-Timestamp`: when it was sent, in Unix seconds. - `X-Pyo-Signature`: `sha256=` and the HMAC-SHA256 of `.`, with your secret as the key, in hex. - `X-Pyo-Event`: the event, as in the body. Check the signature against the raw body, and refuse requests whose timestamp is more than 5 minutes old. Someone who recorded a request can't send it again later. In Node.js: ```js import { createHmac, timingSafeEqual } from "node:crypto"; function fromPyo(req, rawBody, secret) { const ts = req.headers["x-pyo-timestamp"]; const sig = req.headers["x-pyo-signature"] ?? ""; if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false; const want = "sha256=" + createHmac("sha256", secret).update(`${ts}.${rawBody}`).digest("hex"); return sig.length === want.length && timingSafeEqual(Buffer.from(sig), Buffer.from(want)); } ``` Answer with any `2xx` status. Pyo tries again after a `5xx`, a `429` or a timeout of 10 seconds. Any other status counts as a refusal and is shown on the channel. ## Test, change or remove a channel Open a card with **Manage**. **Send test** sends a test alert now and says why if it didn't arrive. **Edit** changes the name, the events and where it sends. Leave the token or URL empty to keep the saved one. The trash button removes the channel. Pyo keeps tokens, webhook URLs and secrets encrypted with the team's key, and never shows them again. The dashboard shows only the chat ID, the end of a webhook URL, or a webhook's host. With the API, the operations are `addAlertChannel`, `updateAlertChannel`, `testAlertChannel` and `removeAlertChannel`. See the [API reference](https://pyo.dev/docs/api). --- # API overview Automate Pyo over HTTP with an API key. The API is what the dashboard and the CLI use. It works in one simple way. You read everything from a snapshot, and change anything through one endpoint. ## Base URL The API lives on your own Pyo: ```text https://your-pyo/api/v1 ``` ## Authentication Create an API key on the **API keys** page, then send it as a Bearer token: ```bash curl https://your-pyo/api/v1/state \ -H "Authorization: Bearer $PYO_API_KEY" ``` A key is shown once, so save it when you create it. A key expires after 30 days, 90 days (the default) or a year, or never. The **API keys** page shows when each key was last used and when it expires, and warns in its last week. An expired key gets a `401`: ```json { "error": "This API key expired. Create a new one." } ``` ## What a key can do | Access | What it allows | | --- | --- | | Read | Reading only | | Deploy | Reading, plus deploying, cancelling, restarting, stopping and scaling | | Sandboxes | Reading, plus creating and using [sandboxes](https://pyo.dev/docs/sandbox) | | Full | Anything its owner can do | A key can also be limited to some of your teams. Whatever its access, a key acts as you, with your role in each team. It can't manage your account or the installation. ## Errors Failed requests use a standard HTTP status, with the reason in the body: ```json { "error": "This API key can only read." } ``` > Pyo is before version 1.0, so the API can still change between releases. ## Limits Each API key can make 600 requests a minute. Changes are limited to 300 a minute per account and 600 a minute per team. Past a limit, Pyo answers `429` with what there were too many of, and a `Retry-After` header that says when to try again. ## Next - [Reading data](https://pyo.dev/docs/api/reading): The snapshot, logs, metrics and observability. - [Making changes](https://pyo.dev/docs/api/changing): Deploy, scale, restart and more. --- # Making changes Deploy, scale, restart and more with one endpoint. Every change is a `POST` to `/api/v1/ops`, with the operation's name in `op` and its fields alongside it: ```bash curl -X POST https://your-pyo/api/v1/ops \ -H "Authorization: Bearer $PYO_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "op": "scaleService", "id": "", "replicas": 3 }' ``` Find ids in the [snapshot](https://pyo.dev/docs/api/reading). ## Common operations These work with a key that has deploy access. | Operation | Fields | What it does | | --- | --- | --- | | `deploy` | `serviceId`, `deploymentId`, `trigger` | Deploy a service | | `cancel` | `deploymentId` | Cancel a deployment | | `scaleService` | `id`, `replicas` | Set the number of replicas | | `restartService` | `id` | Restart it, one replica at a time | | `stopService` | `id` | Stop it, keeping its settings and data | ## Deploying You choose the new deployment's id: `dpl_` followed by 4 to 40 lowercase letters, digits, dashes or underscores. It comes back in the snapshot so you can follow it. Set `trigger` to `manual`. ```json { "op": "deploy", "serviceId": "", "deploymentId": "dpl_", "trigger": "manual" } ``` ## Rolling back A rollback is a deploy of an earlier deployment: ```json { "op": "deploy", "serviceId": "", "deploymentId": "dpl_", "trigger": "rollback", "rollbackOf": "" } ``` ## A simpler way to trigger deploys If all you need is to start a deploy from CI or a CMS, use a [deploy hook](https://pyo.dev/docs/deploy/hooks). It needs no key or JSON. --- # Reading data The snapshot, logs, metrics and observability. Every endpoint here is a `GET` under `/api/v1`. ## Snapshot `GET /state` returns everything you can see: teams, projects, clusters, servers, services and recent deployments. Most scripts only need this one. ```bash curl https://your-pyo/api/v1/state \ -H "Authorization: Bearer $PYO_API_KEY" ``` ## Service logs `GET /services/{id}/logs` returns the recent output of a service's running replicas. It takes `since`, `replica` and `tail`. To follow them, open a WebSocket at `/services/{id}/logs/follow` with the same query. It sends the last lines, then new ones as they're printed. Each text frame is `{"type":"lines","lines":[…]}`, or `{"type":"error","message":…}`. It closes after an hour, so open it again with `since` set to the newest line's time. `pyo logs -f` and the dashboard follow logs this way. ## Database logs `GET /databases/{id}/logs` returns a database's recent output and its events. To follow them, open a WebSocket at `/databases/{id}/logs/follow`. It works like a service's, and also sends all events as `{"type":"events","events":[…]}` whenever they change. ## Metrics `GET /metrics` returns CPU and memory over time for a team's servers and services. | Parameter | Description | | --- | --- | | `team` | The team (required) | | `cluster` | A cluster id, or `all` | | `range` | The time range, such as `24h` | ## Observability `GET /observability` returns traffic for a team's websites: a `summary`, a `series` over time, and the `previous` period to compare with. A read key is enough. | Parameter | Description | | --- | --- | | `team` | The team (required) | | `project` | A project id, or `all` | | `service` | Limit it to one service's domains | | `site` | A domain id, or `all` | | `range` | `1h`, `24h`, `7d` or `30d` (default `7d`) | If the installation has no ClickHouse set up, it returns `503`. `GET /observability/domains?team=...` returns each domain's requests over a `range` (default `24h`) with a `series` over time, busiest first. It lists only domains that had requests. While observability is off, the list is empty. ## Request logs `GET /access-logs` returns the requests your sites served, newest first. It takes `team`, `project`, `service`, `site` and `range` like observability, plus `status`, `method`, `limit` and `before` for paging back. ## Audit log `GET /audit-log?team=...` returns who did what in a team, newest first, 100 at a time. Only the team's owners and admins get an answer. See [Audit log](https://pyo.dev/docs/audit-log#api-and-assistants) for its parameters. ## Images `GET /images?team=...` lists the container images a team's services have run, with each version deployed. --- # You The account these credentials act as: an API key's owner, or the person who connected an assistant. API key access: **read**. `GET /api/v1/me` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # What this Pyo is Its version, and the features a hosted Pyo turned on (none when self-hosted). No API key needed. No API key needed. `GET /api/v1/meta` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Add alert channel Send the team's alerts somewhere: `kind` "telegram" (a bot `token` and a `chatId`), "discord" or "slack" (the channel's `webhookUrl`), or "webhook" (your `webhookUrl`, and a `secret` to sign each request with). Pyo keeps it encrypted. Team owners and admins. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove alert channel Remove an alert channel. Team owners and admins. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Test alert channel Send a test alert to a channel now. When it doesn't arrive, the error says why. Team owners and admins. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Update alert channel Change an alert channel. What you leave out stays as it is. An empty `secret` stops signing. Team owners and admins. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove team backup settings Stop a team's backups. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Reveal backup password Show the team's backup repository password, to restore without Pyo. Logged. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Run team backup Back up now: one service or volume (by id), or everything selected. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Save team backup settings Back up a team's volumes and databases: where, how often and how many to keep. A blank secret keeps the saved one. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set team backup selection Choose what a team backs up: "all" but `exceptions`, or only the "selected" ones. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Create builder Add a builder that builds images from Git on one of the team's servers (`kind` "cluster"). API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove builder Remove a builder. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Rotate builder token A new token for a builder. The old one stops working. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Create cloud cluster Add a cluster whose first server Pyo makes at a cloud provider (team admins). pyo-server connects it there the way Add cluster's command does, over your tailnet. Without `confirm` it answers 409 with the monthly price. Confirm that with the user, then send it again with `confirm: true`. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Create cluster Add a cluster. The response has the command that connects its first server: `curl -fsSL /server.sh | bash -s -- connect `, which runs pyo-server with one token. On the machine Pyo itself runs on, it runs connect.sh from Pyo there. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Discard cluster draft Discard a cluster that was added but never connected. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # A cluster's Cloudflare Tunnel The cluster's tunnel as Pyo last saw it: its state, Cloudflare's view (`health`, `connections`, `colos`), the connectors in the cluster (`connectors`: each one's server, whether it's ready, and why not), its default domain, its certificate, and `refused` when the cluster's install is older than Pyo's. Never a token. Cloudflare's view is read again when it's older than 30 seconds. API key access: **read**. `GET /api/v1/clusters/{id}/tunnel` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove cluster Remove a cluster from Pyo. Its servers keep running. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove cluster tunnel Remove a cluster's Cloudflare Tunnel: its routes, the DNS records Pyo made (with `restoreRecords`, the ones they replaced come back), the connector in the cluster, its certificate and the tunnel itself. Pick Public ports or Tailscale only for the cluster first. Team owners and admins. Prefer setClusterPaths. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Rotate agent token A new connect command for a cluster. The old one stops working. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Rotate tunnel token Give the cluster's Cloudflare Tunnel a new token and a new certificate. The old token can't connect from then on. Its connectors still connected are cut once the new ones are, or after 5 minutes. Team owners and admins. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set cluster free domain address Where the cluster's free domains (`..nip.io`) point: "public" (its public IP, for everyone) or "tailscale" (its Tailscale IP, only from the tailnet). With "tailscale", services are reachable from your tailnet on ports 80 and 443 whether or not the cluster takes public traffic. Free domains on it move to the new address in place, except ones on the public IP, which stay there while the cluster has one. By default it's public when the cluster takes public traffic and a server has its public IP itself (on a network card or as its ExternalIP), a load balancer gives it one, or its cloud maps one to it and Let's Encrypt reached it there. Behind NAT, it's Tailscale. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set cluster gateway A cluster's gateway settings. Unset fields stay as they are. `http3`: HTTP/3 on UDP port 443 next to HTTPS. It needs public ports on and UDP port 443 free on the servers, and the servers' firewalls must let UDP 443 in. Turning it on or off drops open connections on each server's public ports once, one server at a time. `tlsMin`: "1.2" or "1.3". Changing it drops every open HTTPS connection once. `compression`: Zstd, Brotli and Gzip on services' HTTPS domains. `requestTimeout` (seconds, 1 to 3600, or 0 for no limit) and `idleTimeout` (how long a WebSocket or stream may stay quiet, 60 to 86400 seconds, at least the request timeout): the defaults for services without their own. Compression and the defaults change routes only, without dropping connections. `drops` in the answer says whether open connections drop once. Team owners and admins. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set cluster paths Turn a cluster's traffic paths on or off: public ports 80 and 443 (`public`), Cloudflare Tunnel (`tunnel`, with `defaultDomain` and `accountId` as for setClusterTraffic) and websites on the tailnet (`tailnet`: ts.net names and free domains on the servers' Tailscale addresses; the servers stay on the tailnet). Unset fields stay as they are. At least one path stays on. Each domain takes one path, and a domain whose path is off isn't served. When a path turned off still has domains, nothing changes: `status` is "confirm" and `domains` lists them, each with `outcome` "moves" or "stops". Send it again with `confirm` to go ahead. Turning public ports off with the tunnel on moves the domains in the tunnel's Cloudflare account to the tunnel first (`moveToTunnel`, on by default), and the ports close once every one of them is on it (`status` "moving"): its record has moved and Cloudflare has had time to serve it. Published TCP and UDP ports pause for a few seconds when public ports go on or off, as they move between Services. Turning the tunnel off with public ports on switches its domains back first, then removes the tunnel at Cloudflare. `dashboardDrops`: switching Tailnet drops open connections to Pyo's dashboard on the tailnet once (the cluster Pyo runs on, with ts.net names, until its connect command has run for this release). Team owners and admins. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set cluster preview domain Set the domain previews on a cluster use (`-pr-.`, a wildcard record pointing at the cluster), or null for nip.io. Admins only. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set cluster public traffic Whether a cluster takes public traffic: the gateway answers on every server but build-only ones (ports 80 and 443, and public TCP and UDP ports through it). Off: services are only reachable inside the cluster. Prefer setClusterPaths. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set cluster traffic How a cluster takes web traffic: "public" (ports 80 and 443 on every server but build-only ones), "tailscale" (only from the tailnet, or only inside the cluster without Tailscale) or "tunnel" (through Cloudflare Tunnel, with no ports 80 and 443 open). For "tunnel", the team's Cloudflare token needs Cloudflare Tunnel:Edit and SSL and Certificates:Edit, and the cluster's install must be Pyo's (run its connect command first when it's older). Domains in zones of the tunnel's account move to the tunnel. Those with a DNS record Pyo didn't make wait for `setDomainTunnel` with `replace`. Pyo does the Cloudflare work in the background: the cluster's `tunnel` shows how it's going. Team owners and admins. Prefer setClusterPaths. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set cluster web proxy protocol Read the visitor's address from a PROXY protocol header on the cluster's websites (ports 80 and 443), for a cluster behind another load balancer. Connections without one still work. Prefer setClusterPaths. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Update cluster Rename a cluster or change its description, location or tags. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Update cluster agent On a hosted Pyo: update a cluster's agent to Pyo's version now. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Cron job runs A cron job's recent runs, newest first: when each started and finished, how it ended, and the end of what it printed. API key access: **read**. `GET /api/v1/cron-runs` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove cron job Remove a cron job from a service. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Run cron job Run a cron job now. API key access: **deploy**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Save cron job Add a cron job to a service, or change one (by id). API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Back up a database Checks the admin login from the cluster, makes a backup user with it, then saves the database and its schedule. Team owners and admins. API key access: **deploy**. `POST /api/v1/database-backups` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Check an import Everything `startDatabaseImport` checks, without importing. The cluster connects to the source, which must be reachable from there, and checks the login, TLS, its version, its extensions and that every table is readable. It also checks that the database to import into is empty. Owners and admins. API key access: **full**. `POST /api/v1/database-imports/check` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Finish an upload in parts Once every part is sent: Pyo puts the file together in the team's storage and checks it against `sha256`, when given. Then call `startDatabaseImport` with `uploadId`. Owners and admins. API key access: **full**. `POST /api/v1/database-imports/uploads/{id}/complete` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Connect database Connect a service to a database on its cluster. Postgres adds DATABASE_URL (through the pooler when it's on) and DATABASE_URL_DIRECT, plus DATABASE_URL_READ with read replicas. MySQL adds DATABASE_URL (mysql://, to the primary), MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD and MYSQL_DATABASE. KV adds REDIS_URL (which follows failover and sends reads to read replicas), plus KV_REST_API_URL, KV_REST_API_TOKEN and KV_REST_API_READ_ONLY_TOKEN (reads only) with its REST API. With `env`, it adds only those, under the service's own names. With `prefix`, it adds all of them with that prefix, so two databases' variables don't clash. They're secret variables and apply on the service's next deploy. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Create database Create a Postgres, MySQL or KV (Redis-compatible key-value, Valkey) database on one of the team's clusters. The first database on a cluster also sets up databases there, which takes a minute or two. `size` sets CPU and memory per instance: "small" (0.25 CPU, 512 MiB, 5 GiB), "medium" (0.5, 1 GiB, 10 GiB), "large" (1, 2 GiB, 20 GiB) or "xlarge" (2, 4 GiB, 50 GiB). MySQL needs 1 GiB, so "medium" or larger. `instances` is 1 for a single server with no automatic failover. For high availability, use a primary and 2 to 8 replicas for Postgres (instances 3 to 9), 2 to 4 for KV (3 to 5), or 2 or 4 for MySQL (3 or 5). A replica takes over when the primary's server is lost. MySQL has no pooler, read replicas or REST API. Developers and up. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Start an upload The first step of uploading a dump to import: say what it is and get where to send it. Then `PUT` the file to `uploadUrl` as it is, before `expiresAt`, with exactly the `headers` given and nothing else. Send no cookies or API key, since the URL may be on another host. Or send it in parts of `partSize` bytes with `uploadDatabaseDumpPart`, then `completeDatabaseDumpUpload`, so no request is bigger than a proxy in front takes. Then call `startDatabaseImport` with `uploadId`. Postgres takes `.sql`, `.sql.gz` or a custom-format `.dump` (pg_dump -Fc). MySQL takes `.sql` or `.sql.gz` (mysqldump). The dump stays in the team's storage in Pyo until its import succeeds, or for `PYO_DATABASE_IMPORT_RETENTION_HOURS` (24 by default) when unused. At most `PYO_DATABASE_IMPORT_MAX_BYTES` (10 GiB by default). Owners and admins. API key access: **full**. `POST /api/v1/database-imports/uploads` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Delete database Delete a database and its data. Refused while deletion protection is on or a service is connected. Owners and admins. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Delete database backup Stop backing up a database. Its existing backups stay in storage. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Disconnect database Disconnect a service from a database: removes the variables it added (on the next deploy). API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # A database One Postgres, MySQL or KV database, as `listDatabases` lists them. API key access: **read**. `GET /api/v1/databases/{id}` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # A database's analytics Its health over time, sampled about every 30 seconds. Per member (`members`: each instance, read replica, pooler and KV endpoint), its `role`, `server`, and series for `cpu` in cores, `memoryMi`, `diskUsedGi` (only where the volume reports its own space), `connections` and `lagSeconds`. For the whole database, `transactions` (Postgres), `queries` (MySQL), `poolerQueries` and `commands` (KV) per second, `connections` (`primary`, `replicas`, `limit`, and the pooler's `poolerActive`, `poolerWaiting`, `poolerServersActive`, `poolerServersIdle` and `poolerMaxWaitSeconds`), `cacheHitRatio`, `keyHitRatio`, `evictions` per second, `routing` (KV reads per second served by `replica`s or the `primary`, and `fallbacks` to the primary) and `storage` (`sizeBytes`, `memoryUsedBytes`, `maxmemoryBytes`, `keys`). Each series lines up with `times`, with `null` where nothing was measured. A series is `null` when the database doesn't report it. API key access: **read**. `GET /api/v1/databases/{id}/analytics` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # An upload in parts How far an upload's file got: `state` ("pending" before any part, "uploading", "uploaded"), `parts` and `received` (the next part to send is this). Owners and admins. API key access: **full**. `GET /api/v1/database-imports/uploads/{id}` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # A database's logs and events The recent output of each of its parts, oldest first: `at`, `level`, `source` (the instance), `role` ("primary", "replica", "read", "pooler", "read-pooler", "sentinel", "proxy" (KV's endpoint) or "other"), `message`, and `raw` for structured lines. `events`: what happened to it, newest first. To follow them live, open the WebSocket at `/databases/{id}/logs/follow`: it sends the last lines, then new ones as they're printed, each text frame `{"type":"lines","lines":[…]}`, and all events as `{"type":"events","events":[…]}` when they change (or `{"type":"error","message":…}`). It closes after an hour, so open it again with `since` set to the newest line's time. API key access: **read**. `GET /api/v1/databases/{id}/logs` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Database extensions The extensions Pyo's databases offer: Postgres extensions and KV modules. Each one's `name`, `engine` ("postgres" or "valkey"), `section` ("pyo" ones are turned on with `setDatabaseExtensions`, and the database's owner adds "additional" ones with CREATE EXTENSION), a one-line `description`, its `docs`, its `edition` when it's a limited build, `hidden` when it's obsolete (shown only while a database has it on), and whether turning it on or off `restart`s the database (every KV module does). API key access: **read**. `GET /api/v1/database-extensions` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Databases A team's Postgres and MySQL databases and Valkey (Redis-compatible) KV databases: engine, version, size, instances, the cluster's status (phase, primary, ready instances, failovers), the services connected to each and their variables, passwords masked. API key access: **read**. `GET /api/v1/databases` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Restore database Restore a Postgres or MySQL database into a new one, on the same cluster with the same size and availability: at `targetTime` (RFC 3339, within what its backups cover: from `status.backup.firstRecoverabilityPoint` to now for Postgres, to `status.backup.lastSuccessfulBackup` for MySQL) or the latest when omitted. Developers and up. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Retry an import Runs a failed import again, from the same source. After a failure, Pyo keeps the URL's password (sealed), and an uploaded dump for `PYO_DATABASE_IMPORT_RETENTION_HOURS` (24 by default). A new database made for the import is made again. A database that already existed must still be empty. Owners and admins. API key access: **full**. `POST /api/v1/database-imports/{id}/retry` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Reveal database password Show a database's password, and a KV database's REST token and read-only token. Owners and admins. Recorded in the activity log. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Run database backup Back up a database now. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set database backups Turn a database's backups on or off, to the team's Backups destination. Postgres: every change archived continuously and a base backup daily, so it can be restored to any moment in the last `retentionDays`. MySQL: a full backup daily with the changes since the last one, so it can be restored to any moment in the last `retentionDays` up to its latest backup. Both are stored in the team's folder of the destination. KV: a snapshot `schedule`d daily or weekly, the last `keep` kept, listed in Backups with the team's other databases. Developers and up. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set database extensions Turn a Postgres database's extensions or a KV database's modules on and off. `extensions` is the full list to have on, from `listDatabaseExtensions` with `section` "pyo" for its engine. The database's owner adds Postgres's "additional" ones with CREATE EXTENSION. Some load a library, which restarts the database (`restart`). With high availability, it restarts one instance at a time and the primary hands over last. Every KV module restarts the database and needs KV 8.1. Turning a Postgres extension off drops it (DROP EXTENSION, without CASCADE). Postgres refuses while other objects depend on it, and the database's `extensions` shows this. Developers and up. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Import into a database Copies a Postgres or MySQL database into one of the team's: a new one (`newDatabase`), or an empty one (`databaseId`). From `url` (the source must be reachable from the cluster) or `uploadId` (a dump uploaded first). It's checked first, as `checkDatabaseImport`. Then the database's `import` shows how it goes ("pending", "running", "succeeded" or "failed", with a `phase`), and its logs have the import's output. Writes made to the source during the import aren't copied. Owners and admins. API key access: **full**. `POST /api/v1/database-imports` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Update database Change a database's size, instances, storage, version, pooler, REST API, read replicas or deletion protection. Instances are 1 for a single server, or for high availability 2 to 8 replicas for Postgres, 2 to 4 for KV, or 2 or 4 for MySQL. MySQL instances only grow. Storage only grows and the version only goes up. Only owners and admins can turn deletion protection off. Connected services get changed variables on their next deploy. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Update database backup Change a backed-up database's schedule, or pause its backups. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Send an upload's file The second step: the file, as the request's body, to the `uploadUrl` that `createDatabaseDumpUpload` gave (its `token` is the only credential: send no API key). Once only, before its `expiresAt`, and exactly the size declared. No API key needed. `PUT /api/v1/database-imports/uploads/{id}/content` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Send a part of an upload's file Part `n` (from 0) of the file, as the request's body: exactly `partSize` bytes, the last part what's left. Parts go in order. Send a part again when its request failed: one that arrived already is taken once. `x-pyo-sha256` may carry the part's SHA-256 (hex), to check it on arrival. Owners and admins. API key access: **full**. `PUT /api/v1/database-imports/uploads/{id}/parts/{n}` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Cancel Cancel a deployment that hasn't finished. API key access: **deploy**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Finish an upload Once every part is sent: Pyo checks the archive against its SHA-256. Then deploy it with `deploy` (or `createService`) and its `uploadId`. API key access: **deploy**. `POST /api/v1/source-uploads/{id}/complete` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Create deploy hook Create a deploy hook: a secret URL that deploys a service, or every service of a project. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Start an upload The first step of deploying a folder: say what the archive is (a gzipped tar of the folder) and get where its parts go. Send each part with `uploadSourcePart`, then `completeSourceUpload`, then `deploy` (or `createService`) with the `uploadId`. At most `PYO_SOURCE_UPLOAD_MAX_BYTES` (500 MB by default). Kept for 2 hours. API key access: **deploy**. `POST /api/v1/source-uploads` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Delete preview Remove a pull request's preview of a service now. The next push to the pull request brings it back. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Deploy Deploy a service, roll back to an earlier deployment, or retry a failed one. API key access: **deploy**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # An upload Which parts of an upload Pyo has (`received`), to send the rest after a break, and its `state`: "uploading", "ready" (complete) or "used" (a deployment builds it). API key access: **deploy**. `GET /api/v1/source-uploads/{id}` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Redeploy preview Deploy a pull request's preview again from its head (a failed one tries again, a removed one comes back). API key access: **deploy**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove deploy hook Remove a deploy hook. Its URL stops working. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Reveal deploy hook Show a deploy hook's URL path (its secret token). Developers and up. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Send a part Part `n` (from 0) of an upload's archive, as the request's body: exactly `partSize` bytes, the last part what's left. Sending a part again replaces it. API key access: **deploy**. `PUT /api/v1/source-uploads/{id}/parts/{n}` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Create dns record Create a domain's DNS record in the team's Cloudflare account, when one of its connected zones covers the hostname: an A record to the cluster's public IP, with the comment "Made by Pyo ()". Pyo never overwrites a record. When another A, AAAA or CNAME record has the name, `status` is "conflict" and `existing` lists them. Send it again with `replace` to delete those and create Pyo's (team owners and admins). `status` "exists" means it already points there. With `proxied`, Cloudflare proxies it once the domain's certificate is issued. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Delete dns record Delete the DNS record Pyo made for a domain in Cloudflare. Only a record Pyo made, still with its comment, is deleted. Refused while other paths of the hostname still use it. Remove the domain after this. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove certificate Remove an uploaded certificate no domain uses. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove domain Remove a domain from a service. Traffic to it stops, in place, without a redeploy. A port no other domain uses stops being public. The DNS record Pyo made for it in Cloudflare is deleted too, unless `keepDnsRecord`. Only a record Pyo made, still with its comment, is deleted. For a domain through the Cloudflare Tunnel, `restoreRecords` puts back the records the tunnel replaced (team owners and admins). API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Replace certificate Replace a certificate with a renewed one. Services using it switch over in place, without a redeploy. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set domain tunnel Serve a domain through the cluster's Cloudflare Tunnel (`on`), or move it back. Pyo adds the tunnel's route first, then points the name at the tunnel with a proxied CNAME, so both paths answer while it moves. When records Pyo didn't make have the name, the domain's `dnsRecord.status` turns "conflict" and `existing` lists them (at once, in the answer too, when Cloudflare can be asked). Send it again with `replace` to replace them (team owners and admins): Pyo keeps a copy. Moving back with `restore` puts that copy back (team owners and admins), or without one, points the name at the cluster's public IP. A name one level under the tunnel's default domain always goes through the tunnel, so moving it back is refused unless a record it replaced comes back. A new name one level under the default domain gets no record of its own when nothing else at Cloudflare answers for it: the default domain's wildcard record has it, and the answer is `status: "active"`. A name that's already only through the tunnel stays that way while its own record is made. After the record moves, both paths stay open until Cloudflare's edge sends the name through the tunnel. With `on` and `finish` (Finish now, team owners and admins), a domain whose record is on the tunnel goes only through the tunnel at once: the direct path closes, and visitors Cloudflare still sends the old way get 404. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Upload certificate Upload a certificate for the team's domains: the chain and its private key, PEM. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Verify domain Check a domain's DNS now. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Add firewall rule Add an access rule to the end of a service's firewall. Allow and block rules are checked in order, and the first match decides. With no match, the client gets in. Rate limit rules then apply to websites, and each matching one counts the request, per client address and per server. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Add waf rule Add a custom web application firewall rule to a service. Custom rules run in order before the OWASP rules, while the service's WAF is on. It goes last in the list. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Firewall refusals What a service's firewall turned away: website requests (a 403, or a 429 over a rate limit) and connections to TCP ports through the gateway. It shows them over time (`series`), per rule, per source, country and website path, and the latest 50. A rule is its id, or "blocked" or "rate-limit" when no rule matches the source now. UDP ports and ports that bypass the gateway aren't counted. API key access: **read**. `GET /api/v1/firewall/blocked` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Your address The address (and its country) Pyo sees your requests come from, so the dashboard can warn before a firewall rule would shut you out. API key access: **read**. `GET /api/v1/firewall/me` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # WAF findings What a service's web application firewall found: requests it blocked, and ones it only logged in log-only mode. It shows them over time (`series`), per rule, domain, source, country and path, and the latest 50 with the rules that matched. `custom` shows how often each custom rule matched, by its number. Query strings are kept with sensitive values redacted. API key access: **read**. `GET /api/v1/waf/hits` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove firewall rule Remove a firewall access rule. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove waf rule Remove a custom web application firewall rule. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Reorder firewall rules Put a service's firewall access rules in this order: allow and block rules are checked from the first. List every one of its rules. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Reorder waf rules Put a service's custom web application firewall rules in this order. List every one of its rules. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set service behind cdn Put a service's websites behind a CDN, or take them out of it. Behind Cloudflare, only Cloudflare's address ranges reach its websites, and the visitor is the address Cloudflare forwards (taken only from connections that come from those ranges): firewall rules, rate limits and analytics see that visitor. Over plain HTTP only Cloudflare's connections are checked, so set Cloudflare's SSL mode to Full (strict). Let's Encrypt's challenges always get through. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set service waf A service's web application firewall (WAF) settings, for all its domains. "log" or "block" turns it on: the WAF starts on the service's cluster with the first service there that turns it on, and stops after the last one turns it off. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Update firewall rule Change a firewall access rule. Omitted fields stay as they are (as in `addFirewallRule`). API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Update waf rule Change a custom web application firewall rule. Omitted fields stay as they are. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Git build file The Dockerfile a build of a repository of the team's Git connections would use by default, in the build context. Null: the build is zero-config (Railpack). API key access: **read**. `GET /api/v1/git/build-file` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Git branches A repository's branches, through one of the team's Git connections. API key access: **read**. `GET /api/v1/git/branches` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Git repositories The repositories the team's Git connections (GitLab) can deploy: those their token has the Maintainer role on, latest activity first. API key access: **read**. `GET /api/v1/git/repos` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove git connection Disconnect a Git connection, and remove the webhooks Pyo made. Not while a service deploys from it. Team owners and admins. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Test git connection Check what a Git connection's token can do now. `problems` says what's missing, and `working` whether it works at all. Team owners and admins. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # The Dockerfile a Git build of a repository would use by default, in the build context. None: the build is zero-config (Railpack). API key access: **read**. `GET /api/v1/github/build-file` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # GitHub install URL The GitHub page where a team installs the GitHub App. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # GitHub repositories The repositories the team's GitHub installations can see, to deploy from. API key access: **read**. `GET /api/v1/github/repos` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove GitHub installation Unlink a GitHub installation from a team. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Create registry token Create a token to push (or only pull) the team's own images in Pyo registry, as `///:`. These are slugs, and `` is the registry's name on the installation's tailnet (registry..ts.net). A push needs that project and service to exist. It works over HTTPS from a device on the installation's tailnet. Team owners and admins. The token comes back only once, with the username, address and team path to log in and push with. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Pyo registry Pyo's registry, where the images it builds from Git and the team's own pushes are kept, as one team sees it: its address, where it runs (when the team has that cluster), whether Pyo reaches it, the space the team's images take, the team's repositories (tags, size, last build) and its cleanup: how many deployments' images are kept per service, and when images were last removed (within the last week). Read only. API key access: **read**. `GET /api/v1/registry` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Images Every image a team's services deployed, by repository, with each version's deployments, the services that used it and whether one runs it now. API key access: **read**. `GET /api/v1/images` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove registry login Remove a registry login. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Revoke registry token Revoke a Pyo registry token. Team owners and admins. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Save registry login Save a login for a private registry, one per host. Pyo checks it with the registry first. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Check secret import The key names at a path of a secret store, to check it before importing. Never values. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Connect cloudflare Connect the team's Cloudflare account, or replace its token. The token needs Zone:Read and DNS:Edit on the zones Pyo may use, and for Cloudflare Tunnel also Cloudflare Tunnel:Edit and SSL and Certificates:Edit. Pyo lists its zones and their accounts, checks it can edit DNS in each (it makes and deletes a TXT record `_pyo-check.`), checks the tunnel permissions (it makes and deletes a tunnel `pyo-check--` once per account, and reads each zone's Origin CA certificates), then keeps it encrypted. It's never shown again. Each zone's `tunnel` says whether it can use Cloudflare Tunnel. Team owners and admins. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Cloudflare zones The team's Cloudflare connection: the zones its token covers as of the last test, and whether Pyo can edit DNS in each. Pyo creates a domain's DNS record when one of these zones covers it. Never the token: owners and admins also see its last four characters (`hint`). API key access: **read**. `GET /api/v1/cloudflare` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove cloudflare Forget the team's Cloudflare token. DNS records Pyo made stay in Cloudflare. Team owners and admins. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove hetzner Forget the team's Hetzner token. Servers Pyo made there keep running. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Save hetzner Connect a team to Hetzner Cloud (team admins): a project API token with Read & Write, from the project's Security page. Pyo checks it by listing the locations, and keeps it encrypted. Servers join over your tailnet, so Tailscale comes first. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Test cloudflare Check the saved Cloudflare token again: the zones it covers now, whether each can use Cloudflare Tunnel, and what it's missing (`problems`). Team owners and admins. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Test hetzner List the locations the team's Hetzner token sees. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Request log The web server's log of requests to a team's websites, newest first, filtered like the traffic figures. Requests stay in each website's cluster (1 GB or 7 days by default, the team's `requestLogs` preference), which answers within seconds, up to 500 at a time. API key access: **read**. `GET /api/v1/access-logs` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Domain traffic Requests per domain of a team over a range, each with its series: a point per minute for an hour, per half hour for a day, per four hours for a week, per day for 30 days. Only domains that had requests are listed, busiest first. No domains while observability is off. API key access: **read**. `GET /api/v1/observability/domains` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Server and service usage CPU, memory, disk and network over time for a team's servers and services, sampled once a minute. Servers also get load and disk reads and writes. Each series lines up with `times`, with `null` where nothing was measured. API key access: **read**. `GET /api/v1/metrics` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Website traffic Visitors, requests, errors, response times, countries, pages and referrers for a team's websites: all of them, one project's, one service's, or one domain. Read from per-minute totals each cluster sends (kept 12 months by default), so it works with a cluster offline. Top lists count page views (referrers, pages, devices, browsers) or requests (paths, countries, query parameters). API key access: **read**. `GET /api/v1/observability` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Observability settings Whether observability is on for this installation (it's off on a new install on a server with under 3.5 GB of memory). For the installation's admin also what it keeps of visitors' IP addresses, how long it keeps data (`retention`: `analyticsMonths`, `metricsDays`, `buildLogDays`) and `small`: the server Pyo runs on has under 3.5 GB of memory now. The installation's admin turns it on or off with `setObservability`. API key access: **read**. `GET /api/v1/observability/settings` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Service connections Connections to a service's public TCP and UDP ports through the gateway: per port, over time, by country and outcome ("ok", "blocked" by an IP rule, "limited" by the connection limit, "unreachable" when the service didn't answer), and the latest 50. A connection is counted when it closes (a UDP exchange after a minute without packets). Ports that bypass the gateway aren't counted. API key access: **read**. `GET /api/v1/services/{id}/connections` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set observability Turn observability (analytics, request logs, firewall and WAF history, usage history) on or off for the whole installation. Only the installation's admin can do this. Off stops storing and showing history and frees its memory. What was stored is kept for when it's back on. Live logs, current usage, deploys and the firewall keep working. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Create project Create a project in a team. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Delete project Delete a project and its services. Its volumes are kept, detached, unless `deleteVolumes`. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Get an import from another platform How an import started with `startPlatformImport` is doing: its status, what it makes and what became of each item so far. Owners and admins. API key access: **read**. `GET /api/v1/platform-imports/{id}` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Import Docker Compose Create a project and its services from a Docker Compose plan (from `POST /compose/preview`, edited if you like), and deploy them in order. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # List imports from other platforms A team's imports of the last 30 days, newest first (at most 20). Owners and admins. API key access: **read**. `GET /api/v1/platform-imports` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Plan a Docker Compose sync What applying a Compose file to the project made from it would change, service by service: added, changed (and what), unchanged, or not in the file. Only what the file sets is compared, so settings changed in Pyo that the file doesn't mention stay. A secret's value is never changed. An image's tag follows the file only when the file changed it. What can't change in place is listed under `manual` and left as it is. Nothing changes. Pass `file` to the `syncCompose` operation to apply it, or to `importCompose` when there's no `project` yet. Besides Compose, each service's `x-pyo` can set `domains`, `behindCdn` ("cloudflare" or "none"), `health` (a path like "/healthz", "tcp" or "none"), `replicas`, `placement` (`{"servers": [...], "tags": [...]}`) and `secrets` (variable names; their values are set in Pyo). API key access: **read**. `POST /api/v1/compose/sync-plan` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Preview a Docker Compose import What importing a Compose file would create: a project, and a service per Compose service with its source, ports, variables, volumes and health check, in deploy order. It adds a warning for each thing that isn't carried over. Nothing is created. Edit the plan if you like, then pass it to the `importCompose` operation. API key access: **read**. `POST /api/v1/compose/preview` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Preview an import from another platform Reads a Coolify or Dokploy installation, or a Railway or Vercel account, through its API with a token you give, and shows what importing would create: per project there, its services (source, ports, domains, variable names, volumes), Compose stacks and databases, each with what doesn't carry over. Nothing is created and the token isn't kept. Things an earlier import made are marked (`existingId`). Owners and admins. API key access: **full**. `POST /api/v1/platform-imports/preview` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set project isolation Isolate a project's network: only its own services and the web server reach them. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Import from another platform Starts an import and answers at once with it (`getPlatformImport` follows it). On the server, whatever happens to this request, Pyo reads the platform again (as `previewPlatformImport`) and creates the picked things (`items`, all by default): a project per project there, its services with their variables (secret ones sealed), domains (live after the first deploy), ports and empty volumes, a project per Compose stack, and databases. A Postgres or MySQL database reachable from outside the platform is copied by a database import. Others are made empty or left for you. Services aren't deployed unless `deploy`. Running it again skips what an earlier import made. The token is kept in memory for the import only, never stored. Owners and admins. API key access: **full**. `POST /api/v1/platform-imports` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Sync Docker Compose Bring a project in line with a Docker Compose file: `file` from `POST /compose/sync-plan`, which shows what this does. Only what the file says differently changes, so settings changed in Pyo that the file doesn't mention stay, and a secret's value is never changed. An image's tag or digest follows the file only when the file changed it since the last sync, so one a deploy set stays. Services whose settings change are deployed. What can't change in place (a volume that would move, another kind of source) is left as it is. A service no longer in the file stays, unless `prune`. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Update project Rename a project or change its description. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Add a sandbox server Makes a server's one-time join code and the command to run on it. The code works once, for 15 minutes. The command, `curl -fsSL /server.sh | bash -s -- sandbox `, runs pyo-server with one token that carries the code. It installs Pyo's sandbox daemon, checks what the server can run (Firecracker where it has KVM, gVisor elsewhere) and joins Pyo. The server then gets its work from Pyo over HTTPS: Pyo never calls it. With Tailscale set up, the command also joins your tailnet, and the terminal, files and desktop open there. Without, the server joins with its code alone at Pyo's public HTTPS address, the terminal and files go through Pyo, and the desktop needs Tailscale. Adding a server that hasn't joined yet again makes a new code. With `id`, asking again changes that server until it joins. Team owners and admins. On Pyo Cloud, use createSandboxJoinCode. API key access: **full**. `POST /api/v1/sandbox-servers` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Close a sandbox port Stops serving the port at its URL. Closing a port that isn't open is fine. API key access: **sandboxes**. `DELETE /api/v1/sandboxes/{id}/ports/{port}` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Buy a sandbox server at a cloud provider Makes a server in the team's Hetzner project and sets it up as a sandbox server, the way Pyo makes a cluster's servers there. Read the locations, server types and prices with getCloudOptions first. On its first boot pyo-server joins your tailnet and sets it up with a one-time code. Hetzner Cloud servers have no KVM, so it runs sandboxes on gVisor. Follow it in the server's `cloud` (creating, booting, joining, ready) and `state`. Without `confirm` it answers 409 with the monthly price. Confirm that with the user, then send it again with `confirm: true`. Team owners and admins. Needs Tailscale and the team's Hetzner connection. API key access: **full**. `POST /api/v1/sandbox-servers/cloud` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Create a sandbox Makes an isolated machine from a sandbox template on one of the team's sandbox servers (or the installation's), within the team's limits. It runs until its lifetime ends or it's deleted. The answer has the `connection`: the server's address and a token, valid an hour, for exec, terminals, files and ports there. A server with Tailscale answers on your tailnet. One without is called through Pyo, at the `url` the connection gives, and its desktop and web pages don't open until it has Tailscale. Ask for a new token with `createSandboxToken`. `teamId` may be left out when the API key (or you) can use only one team. `server` runs it on that server only. A server that doesn't have Pyo's template `base` (or `desktop`) yet makes it first: the first sandbox from it there takes a minute or so longer, and later ones start at once. API key access: **sandboxes**. `POST /api/v1/sandboxes` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Make a sandbox server's join code On Pyo Cloud: adds a sandbox server to the team, or makes a new code for one that hasn't joined yet, and the command to run on it. The code works once, for 15 minutes. The command, `curl -fsSL /server.sh | bash -s -- sandbox `, runs pyo-server with one token that carries the code. It installs Pyo's sandbox daemon and joins Pyo over HTTPS. The server then gets its work from Pyo. With Tailscale on Integrations, the command also joins your tailnet with a key from your team's Tailscale, and the terminal, files and desktop open there. Without, the server joins with its code alone, the terminal and files go through Pyo, and the desktop needs Tailscale. With `id`, asking again changes that server until it joins. Team owners and admins. API key access: **full**. `POST /api/v1/sandbox-servers/join-codes` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Create a sandbox server's DNS record Creates the wildcard record `*.` in the team's Cloudflare connection: A (and AAAA) to the public addresses the server reports, not proxied. Records already on the name are never changed: another one there is a conflict. Team owners and admins, or the installation's admin for its own servers. API key access: **full**. `POST /api/v1/sandbox-servers/{id}/dns-record` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Create a sandbox template A template made from an OCI image, like "node:22", or an image in Pyo's registry. Every sandbox server that may use it pulls the image and makes a root disk from it. A Firecracker server boots it once and snapshots it, and a gVisor server starts sandboxes from the disk. The template is ready once one server has it. API key access: **sandboxes**. `POST /api/v1/sandbox-templates` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # New sandbox token A new token for the sandbox's server, valid an hour. Ask before the last one runs out. API key access: **sandboxes**. `POST /api/v1/sandboxes/{id}/token` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Delete a sandbox Ends the sandbox and throws away its files. When its server can't be reached right now, it shows as stopping and Pyo tries again. API key access: **sandboxes**. `DELETE /api/v1/sandboxes/{id}` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Delete a sandbox template Deletes it here and on the sandbox servers. Refused while sandboxes run from it. API key access: **sandboxes**. `DELETE /api/v1/sandbox-templates/{id}` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Extend a sandbox Sets when the sandbox ends: `ttl` from now, or never with `"none"`. API key access: **sandboxes**. `POST /api/v1/sandboxes/{id}/extend` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # A sandbox One sandbox, as `listSandboxes` lists them, with a fresh `connection` for its server when you may use it. API key access: **read**. `GET /api/v1/sandboxes/{id}` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Get a sandbox server's certificate Gets a Let's Encrypt certificate for `*.` with a DNS-01 challenge in the team's Cloudflare connection, and puts it on the server, whose edge serves it at once. It runs in the background: the server's `edge.cert.state` says how it goes. Pyo renews it 30 days before it runs out. Also renews it now. The zone must be connected and editable. Team owners and admins, or the installation's admin for its own servers. API key access: **full**. `POST /api/v1/sandbox-servers/{id}/certificate` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Keep a sandbox server that hasn't joined A server added with an `id` that never joins is removed a day after its last code runs out. This keeps it until it's removed, with resetSandboxServerAccess for a new command. Fine for a server that's kept already. Team owners and admins, or the installation's admin for its own servers. API key access: **full**. `POST /api/v1/sandbox-servers/{id}/keep` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Sandbox servers The servers a team's sandboxes run on: its own and the installation's. API key access: **read**. `GET /api/v1/sandbox-servers` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Sandbox templates What a team's sandboxes can start from: its own templates and the installation's. API key access: **read**. `GET /api/v1/sandbox-templates` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Sandboxes A team's sandboxes: their template, size, state, server and lifetime. Env values are never shown, only their names. API key access: **read**. `GET /api/v1/sandboxes` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Open a sandbox port Serves a port the sandbox listens on at its own URL. A public port answers anyone. A private one needs a sandbox token, in `Authorization: Bearer` or once as `?pyo_token=` in a browser. API key access: **sandboxes**. `POST /api/v1/sandboxes/{id}/ports` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Pause a sandbox Stops its machine and keeps its memory and files on the server, so it resumes where it was. Connections to it drop. API key access: **sandboxes**. `POST /api/v1/sandboxes/{id}/pause` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove a sandbox server Deletes its sandboxes where it still answers, and forgets it. To take the daemon off the server, run `pyo-server uninstall` there. A server set up with sandbox.sh before 0.53.0 takes `sandbox.sh --uninstall`. A server Pyo made at a cloud provider leaves your tailnet and is deleted there, which takes `confirm`. With `draft`, only a server that never joined is removed, and one that joined is left alone. API key access: **full**. `DELETE /api/v1/sandbox-servers/{id}` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Rename a sandbox Gives the sandbox another name. Its id stays the same, so scripts that use it keep working. Works on ended sandboxes too. API key access: **sandboxes**. `PATCH /api/v1/sandboxes/{id}` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Reset a sandbox server's access The server's key stops working at once, and its waiting commands fail. Answers with a new command for the same server, which works once, for 15 minutes. Run it there to join again. On a self-hosted Pyo, a server that shows `needsUpdate` gets the command that updates it instead (Update): it takes no commands until the command runs there. Its sandboxes keep running. The new command joins the server the way that fits now: on your tailnet once Tailscale is set up, without it otherwise. So it also moves a server onto the tailnet, or off it. Team owners and admins, or the installation's admin for its own servers. API key access: **full**. `POST /api/v1/sandbox-servers/{id}/reset-access` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Resume a sandbox Starts a paused sandbox again where it was. API key access: **sandboxes**. `POST /api/v1/sandboxes/{id}/resume` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Cancel server removal Stop a server removal that's waiting or failed. The server takes work again. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Create cloud server Make a server at a cloud provider and join it to a cluster over your tailnet (team admins). Read the locations, server types and prices with getCloudOptions first. Its startup script holds only one-time keys: on its first boot it joins your tailnet, then fetches its join details from Pyo over the tailnet. Pyo labels it as this installation's and puts it behind a firewall that allows only the web (80 and 443) and Tailscale. Follow it in `cloudServers` of getState: creating, booting, joining, then ready. Without `confirm` it answers 409 with the monthly price. Confirm that with the user, then send it again with `confirm: true`. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Delete cloud server Delete a server Pyo made at a cloud provider (team admins): its services move off it, it leaves the cluster and your tailnet, then it's deleted at the provider. Only servers with this installation's label are ever deleted there. A cluster's first server goes once the cluster is removed. Without `confirm` it answers 409 with the monthly cost that stops. Confirm that with the user, then send it again with `confirm: true`. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Whether the team may add a server The same check Pyo makes as a new server, cluster or builder server is added. Always yes when self-hosted. On Pyo Cloud, no without a subscription that covers one more server, with the reason. API key access: **read**. `GET /api/v1/can-add-server` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Server types and prices What a new server at a cloud provider can be, read live from it with the team's token: its locations, and its server types with their specs, architecture, where each can be made now and its monthly price in each location (before VAT, with its IPv4 address). Pyo's servers run x86-64, so Arm types have `supported` false. API key access: **read**. `GET /api/v1/cloud/options` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Machines waiting for a Tailnet Lock signature With Tailnet Lock on, a new server stays off the tailnet until a signing device signs its key. These are the ones on the team's clusters' tailnets that wait, with the command to run on a signing device, as each cluster last saw them. Empty without Tailscale set up. API key access: **read**. `GET /api/v1/tailnet/lock` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Join server The command that joins a new server to a cluster: `curl -fsSL /server.sh | bash -s -- join `, which runs pyo-server with one token (valid for an hour). API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove server Take a server out of its cluster, moving its services off first. `force` removes it at once, for a machine that's gone. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set server region Set a server's region: a name ("US East", "Singapore, SG"), or "" to detect it again. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set server maintenance Put a server in maintenance (its services move elsewhere), or bring it back. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set server regular services On a GPU server: also run regular services, or keep it for GPU work. Null goes back to the default. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set server schedulable Whether new work may be placed on a server. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set server tags Set a server's tags. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Create service Create a service and deploy it. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Delete service Delete a service and stop it everywhere. Its volumes are kept, detached, unless `deleteVolumes`. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Recent logs The last lines each of a service's replicas printed, read from its cluster on request. Takes up to 15 seconds. To follow them, open the WebSocket at `/services/{id}/logs/follow` with the same query: it sends these lines, then new ones as they're printed, each text frame `{"type":"lines","lines":[…]}` (or `{"type":"error","message":…}`). It closes after an hour, so open it again with `since` set to the newest line's time. API key access: **read**. `GET /api/v1/services/{id}/logs` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Can the site be previewed Whether a service's site can be shown in the dashboard's preview frame: it answers, and doesn't forbid framing (X-Frame-Options, CSP frame-ancestors). Only the service's own first domain is asked, and never a private address. API key access: **read**. `GET /api/v1/services/{id}/preview` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # How traffic reaches a service Its domains and the addresses they point at, the servers that take public traffic and their regions, where its replicas run, and anything that keeps visitors from reaching it. API key access: **read**. `GET /api/v1/services/{id}/traffic` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Restart service Restart a service's replicas one by one, with the same configuration. API key access: **deploy**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Reveal secret Show a secret environment variable's value. Admins only, and logged. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Save service Save a service's configuration. With `deploymentId`, roll it out too. Changes to its `domains` go live without a deploy once it has been deployed. A variable sent back hidden (`•••`, as reads show it) keeps its saved value. `removeDomain` removes a domain without sending the whole service. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Scale service Change a service's number of replicas without a new deployment: 1 or more, with no maximum. Replicas that don't fit on the servers wait until there's room, and the response's `warning` says so. API key access: **deploy**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set autoscale Turn autoscaling on or change it. Null turns it off. API key access: **deploy**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Stop service Stop a service. Deploy it again to start it. API key access: **deploy**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Everything you can see One snapshot of every team you're in (or the API key's teams): their projects, services and deployments, clusters and servers, domains, certificates, volumes, backups, registry logins, builders and recent activity. The dashboard renders from this, and scripts can read it too. API key access: **read**. `GET /api/v1/state` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Create team Create a team. You become its owner. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Delete team Delete a team and everything in it. Owners only. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Invite member Invite someone to a team by email, as owner, admin, developer or viewer. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Audit log Who did what in a team, newest first: when, the account, the action, how (dashboard, API key or assistant) and the address and browser it came from, as the team keeps them. Sign-ins, failed sign-ins and two-factor changes are here too. For the team's owners and admins. API key access: **read**. `GET /api/v1/audit-log` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Remove member Remove a member from a team, or revoke an invite. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Resend invite Make a new invite link (the earlier one stops working) and mail it, or with `send: false` only return it to share. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Reset member sign in Owners only: a one-time link for a member who lost their password, to choose a new one. It's emailed to them. Without email set up, it's returned to pass on, for an account in this team alone. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Rotate data key Give the team a new data key and seal its stored secrets again with it. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Set team observability A team's observability: what its servers collect and keep. Owners and admins. Left out, a setting stays as it is. Address and query string settings are at most the installation's limit, and "default" follows the installation's default. Passwords, tokens and other sensitive query values are never kept. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Update member role Change a member's role: "owner", "admin", "developer" or "viewer". API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Update team Rename a team, change its description, default cluster or preferences. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Add volume Add a persistent volume to a service, mounted at `mountPath` from its next deploy. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Attach volume Attach a detached volume to a service on its cluster, mounted at `mountPath` from the service's next deploy. A service of another project (or any project, for a volume whose project was deleted) gets the volume moved into its project first, data, id and backups kept: the volume shows `moving` until its cluster has moved it, then it's attached (or `moveError` says why not). A volume can't move to another cluster. A volume on a one-server storage class keeps its data on that server, so the service must be able to run there. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Delete volume Delete a detached volume and its data, for good. Admins only. The volume stays listed, being deleted, until its cluster confirms. Also deletes a volume Pyo has no record of, listed in its cluster's `strayVolumes`: pass that `volumeId` as `id`, with `clusterId`. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Delete a volume snapshot Deletes one of a volume's backups from the team's restic repository, with a short job on its cluster that waits for the volume's other backups and restores. The space it held is freed shortly after. Deleting one that's already gone succeeds. Owners and admins. API key access: **full**. `DELETE /api/v1/volumes/{id}/snapshots/{snapshotId}` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Detach volume Detach a volume from its service: unmounted from the next deploy. The volume and its data stay, to attach again or delete. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # A volume's snapshots Its backups in the team's restic repository, newest first, read from its cluster on request (a short job there). Takes up to two minutes. API key access: **read**. `GET /api/v1/volumes/{id}/snapshots` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Resize volume Grow a volume to `sizeGi` GB (never shrink it). Owners and admins. Only on a storage class that can grow volumes (`allowVolumeExpansion`). A `local-path` volume has no size limit of its own, so there's nothing to grow. The volume shows `resizeTo` until its cluster reports the new size. Some storage classes finish when its service next starts. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Restore volume Restore a volume from one of its snapshots (see `listVolumeSnapshots`), replacing its data. Owners and admins. Its service stops while the restore runs and starts again afterwards, even when it fails. The snapshot is restored next to the data and swapped in only once complete, so a failed restore leaves the data as it was. The volume needs room for the snapshot while this runs. The volume shows `restore` while it runs, then `restoredAt`, or `restoreError` with why it failed. API key access: **full**. `POST /api/v1/ops` The full request and response schemas are in the OpenAPI spec: https://pyo.dev/openapi.json --- # Audit log See who did what in your team, how, and from where. The audit log records who did what in your team, and when. Each entry also says how it was done and where it came from. Team owners and admins find it under **Audit log**, in the sidebar's **Team** section. ## What's in it Each entry shows: - **When** it happened - **Person:** the account's name and email - **Action:** what was done, like a deploy, a changed role or a new domain. Failed ones are marked **Failed**. - **How:** **Dashboard**, **API key** or **Assistant**, with the key's or assistant's name - **From:** the IP address and browser, as your team keeps them Choose an entry to see all of it, like its target and the full browser details. Everything a person does in your team is recorded, like what shows in [Activity](https://pyo.dev/docs/activity). Security events are recorded too: - sign-ins, and failed ones with a wrong password or code - [two-factor authentication](https://pyo.dev/docs/two-factor) turned on or off, and recovery codes used or replaced - [passkeys](https://pyo.dev/docs/passkeys) added or removed - API keys created or revoked - secrets shown An account's security events go to every team it's a member of. Entries can't be changed or deleted. They're only removed once they're older than the log keeps them. ## Filter and download Filter by person, by kind of action and by dates. Choose **CSV** to download everything that matches your filters, up to 50,000 entries. Times in the file are in UTC. ## IP addresses Each team chooses what its audit log keeps of addresses. Open **Security**, in the sidebar's Infrastructure section, and pick one under **Audit log**: | Setting | What's kept | | --- | --- | | Full addresses | The whole address (the default) | | Anonymized | The address without its last part, which points to a network, not a person | | No addresses | No address | The setting applies to new entries. Entries already written keep what they have. ## How long it's kept | Where | How long | | --- | --- | | Pyo Cloud | 1 year | | Self-hosted | 90 days, 180 days, 1 year (the default) or 2 years | On a self-hosted Pyo, the installation's admin sets this under **Settings › Security**. It applies to every team. ## API and assistants `GET /audit-log` returns a team's entries, newest first, 100 at a time. A read key is enough, but only owners and admins of the team get an answer. ```bash curl "https://your-pyo/api/v1/audit-log?team=..." \ -H "Authorization: Bearer $PYO_API_KEY" ``` | Parameter | Description | | --- | --- | | `team` | The team (required) | | `person` | Only what this account did, by its user id | | `action` | One action, like `member.role_changed`, or a kind of action, like `member` | | `from`, `to` | A time range, in milliseconds | | `cursor` | The `next` value from the page before | | `format` | `csv` for a download instead | [AI assistants](https://pyo.dev/docs/mcp) read it with the `list_audit_log` tool. --- # Backing up data Back up volumes and databases to your own storage. Set up backups under **Backups**, in the Infrastructure section. They run daily or weekly at the hour you choose. They go to Pyo's built-in backup store or an S3-compatible bucket of your own. The bucket's endpoint needs `https://`. On a private network, plain `http://` works too. The exception is when the installation turns off private networks with [`PYO_ALLOW_PRIVATE_NETWORKS`](https://pyo.dev/docs/system-reference#installation-settings), as Pyo Cloud does. ## Where backups go - **This server:** Pyo's built-in backup store, on the cluster Pyo runs on. It runs [Garage](https://pyo.dev/docs/system-reference#what-runs-on-your-server), an S3-compatible store. Each team has its own bucket there, with a key that reaches only that bucket. Only that cluster can reach the store, so services and databases on other clusters need a bucket of your own. The store is on the same disks as your data, so keep a copy somewhere else too. Deleting a team deletes its bucket and the backups in it. - **An S3-compatible bucket** of your own. Pyo Cloud has no **This server**, so its teams back up to a bucket of their own. The same goes for a self-hosted Pyo without a backup store. Until a team adds a bucket, admins get **Add bucket** on the **Backups** page. ## What's backed up - **Databases:** PostgreSQL, MySQL, MariaDB, MongoDB and Redis or Valkey are dumped with their own tools, so each backup is consistent. - **Other volumes:** backed up as files. ### Supported versions | Database | Versions | Dumped with | | --- | --- | --- | | PostgreSQL | 9.2 to 18 | pg_dump 18 | | MySQL | 5.7 to 8.4 | mysqldump 8.4 | | MariaDB | 10.3 to 11.8 | mariadb-dump 11.8 | | MongoDB | 4.2 and newer | mongodump | | Redis or Valkey | Redis 6 and newer, any Valkey | valkey-cli | Redis needs version 6 or newer for its ACLs, which the backup user relies on. Postgres databases that Pyo runs for you have their own continuous backups, with point-in-time recovery. See [Databases](https://pyo.dev/docs/databases#backups-and-point-in-time-recovery). ## Back up volumes Choose **Add backup**, then **Volume**, and pick the volumes to back up. Then pick when: - **Daily** or **Weekly**, at an hour in UTC. Pyo keeps the last 7, 14, 30 or 90 backups. - **Off**, to back up only by hand. **Also back up new volumes** includes the volumes of services you add later. Team owners and admins choose these settings. The **Volumes** list on **Backups** shows each volume's last backup. **Back up now** starts one right away. Developers can use it too. Owners and admins can leave a volume out with **Stop backing up**. The same actions are in each volume's menu under **Clusters → Volumes**: **Turn on backups**, **Turn off backups** and **Back up now**, with a **Backup** column showing how the last backup went. Volumes that aren't attached are backed up too, once a service has used them. This includes volumes of a deleted project. ## Restoring Team owners and admins restore a volume from its **…** menu: **Restore**, pick a backup, confirm. Pyo stops the volume's service, puts the backup back and starts the service again. See [restore a volume](https://pyo.dev/docs/volumes#restore-a-volume). A backup you no longer want can be [deleted](https://pyo.dev/docs/volumes#delete-a-backup) there too. Backups are made with [restic](https://restic.net) and encrypted. You can reveal the repository password in the dashboard, so you can restore with restic even without Pyo. **Restore** on **Backups** shows the repository and the commands. Restore a PostgreSQL dump with pg_restore 18 or newer. Restore it into a server of the same major version as the source, or newer. ## Backing up Pyo itself An installation admin can also back up Pyo's own data on a schedule, under **Settings → Backups** (`/backups`). Backups go to the server's backup store, or to a bucket elsewhere for off-site copies. That bucket can be on a private network. --- # Setting up builders Where Pyo builds images from your Git code. Builds run on a builder. You need one to deploy from Git. Manage them under **Builders**. On a fresh install, Pyo adds a builder on the server it runs on, named after that server. You can remove or replace it like any other builder. ## Where a builder can run Choose **Add builder**, then where it runs: - **This machine:** the server Pyo runs on, alongside Pyo. It's not offered on Pyo Cloud. - **In a cluster:** another server in one of your clusters, sharing that machine with your services. - **New server:** a dedicated build server. Run the command Pyo shows on the machine, and it joins a cluster as a build-only server. Nothing else runs there, so heavy builds don't slow your services down. Each server runs at most one builder. ## Remove a builder Choose **Remove builder** from its menu. A builder in a cluster takes its build cache with it, and builds running on it fail. On a build-only server, the builder stops and the server stays in its cluster. [Remove the server](https://pyo.dev/docs/uninstall#remove-a-server) too if you don't need it. ## How it works A builder runs BuildKit and connects out to Pyo with its own token. It picks up build jobs, streams the logs and hands back the finished image. BuildKit only runs while there are builds, so an idle builder uses almost no memory. A build starts it, and its log shows **Starting the builder…** for the few seconds that takes. After 10 minutes without builds, it stops again. The build cache stays on the server's disk, so the next build is as fast as before. ## How long a build may take A build runs as long as its builder keeps reporting on it. It fails when the builder goes quiet for 5 minutes, or when the build takes longer than 60 minutes. A build that no builder starts within 60 minutes fails too. To change the 60 minutes, set `PYO_BUILD_TIMEOUT_MINUTES` on Pyo. See the [System reference](https://pyo.dev/docs/system-reference#builds). ## Memory BuildKit gets a memory limit, so a large build can't take its whole server. The limit is a share of the server's memory, by its [memory tier](https://pyo.dev/docs/system-reference#memory-tiers): | Server memory | BuildKit's limit | | --- | --- | | Under 3.5 GiB | Half | | 3.5 to 8 GiB | 60% | | 8 GiB or more | Three quarters | BuildKit asks for only 8 MiB up front, since it sleeps between builds. To give every builder the same amounts instead, set `PYO_BUILDKIT_MEMORY_REQUEST` and `PYO_BUILDKIT_MEMORY_LIMIT` on Pyo, like `4Gi`. See the [System reference](https://pyo.dev/docs/system-reference#builds). --- # Managing certificates Upload your own TLS certificates, including wildcards. Pyo gets Let's Encrypt certificates for public domains automatically. You only need this page to use your own certificate. ## Upload a certificate Open **Certificates**, in the sidebar's **Domains** menu, and upload a certificate with its private key. One certificate can cover a single domain, or many with a wildcard like `*.example.com`. The private key is stored encrypted on the server and is only sent to your team's clusters. ## Use it on a domain Set a domain's HTTPS to your own certificate, then pick one that covers that hostname. ## Replace or remove Replace a certificate before it expires, using the same page. Domains using it switch to the new one without a redeploy. Removing one deletes its private key from Pyo. ## Cloudflare Tunnel's certificate A cluster with a [Cloudflare Tunnel](https://pyo.dev/docs/cloudflare-tunnel) gets a Cloudflare Origin CA certificate, listed here as **Cloudflare Tunnel** with the cluster's name. Pyo makes its key and issues it for every name that goes through the tunnel, for 15 years. Only the tunnel's connector sees it, and visitors see Cloudflare's own certificate. Pyo issues a new one when a new name needs it, and when you rotate the tunnel. ## Mutual TLS (mTLS) If a CDN sits in front of your services, it can present a certificate to prove that a request came through it. This is called mTLS. [Securing Pyo](https://pyo.dev/docs/securing-pyo#require-the-cdns-certificate-with-mtls) shows how to require it on your servers. You can create a certificate when you turn on mTLS in a cluster's **Settings** tab. You can also create one ahead of time from **Mutual TLS**, in the sidebar's **Domains** menu. Give it a name, a common name and how long it's valid for. Team owners and admins can do this from the dashboard, but not with an API key. You get a certificate and a private key to upload to your CDN. Pyo installs the matching CA certificate on your clusters for you. > Save the certificate and private key in a password manager before you close the dialog. Pyo doesn't keep them, so they can't be recovered. Anyone with the private key can pass as your CDN. If you lose the private key, create a new certificate and replace the old one. ### Replace a certificate Pyo warns you in the activity feed 30 days and 7 days before a certificate expires. To replace one without downtime: 1. Create a new certificate. 2. In your cluster's **Settings** tab, choose **Manage** under **mTLS** and select both certificates, so your cluster accepts either. 3. Upload the new certificate and key to your CDN. 4. Choose **Manage** again and clear the old certificate. You can't remove a certificate while a cluster requires it. Removing one only takes it off this page. Your CDN keeps presenting it until you change it there. ### Turn mTLS off without the dashboard The dashboard isn't behind mTLS, so you can usually turn mTLS off there. If you've put the dashboard on a domain that mTLS blocks, run this on the server: ```bash sudo k3s kubectl -n kube-system delete tlsoption default ``` --- # The pyo CLI Deploy and manage your services from a terminal or CI. The CLI is separate from Pyo itself. Pyo runs on your server, and the CLI runs on your computer or in CI. `pyo` is for a laptop and CI. [`pyo-server`](https://pyo.dev/docs/pyo-server) sets up a server. ## Install On Linux and macOS: ```bash curl -fsSL https://pyo.dev/cli.sh | sh ``` It downloads the CLI for your system from Pyo's latest release on GitHub and checks it against the release's checksum. It works on Linux and macOS, on both x86-64 and Arm. It installs to `/usr/local/bin` when you can write there, and `~/.local/bin` otherwise. Set `PYO_INSTALL_DIR` to choose another folder, or `PYO_VERSION` for a release other than the latest. ### Windows In PowerShell: ```powershell $dir = "$env:LOCALAPPDATA\Programs\pyo" $url = "https://github.com/upsetdev/pyo/releases/latest/download/pyo-windows-x86_64.exe" New-Item -ItemType Directory -Force $dir | Out-Null $ProgressPreference = "SilentlyContinue" Invoke-WebRequest $url -OutFile "$dir\pyo.exe" Invoke-WebRequest "$url.sha256" -OutFile "$dir\pyo.exe.sha256" $want = (Get-Content "$dir\pyo.exe.sha256").Split(" ")[0] Remove-Item "$dir\pyo.exe.sha256" if ((Get-FileHash "$dir\pyo.exe").Hash -ne $want) { Remove-Item "$dir\pyo.exe"; throw "The download doesn't match its checksum. Try again." } $path = [Environment]::GetEnvironmentVariable("Path", "User") if ($path -notlike "*$dir*") { [Environment]::SetEnvironmentVariable("Path", "$path;$dir", "User") } ``` This installs `pyo.exe` in your user folder and adds it to your `Path`. Open a new terminal to use it. The CLI runs on Windows on x86-64. ### Download it yourself Each [release on GitHub](https://github.com/upsetdev/pyo/releases) has the CLI for every system, each with a `.sha256` checksum: | System | File | | --- | --- | | Linux, x86-64 | `pyo-linux-x86_64` | | Linux, Arm | `pyo-linux-aarch64` | | macOS, Apple silicon | `pyo-macos-aarch64` | | macOS, Intel | `pyo-macos-x86_64` | | Windows, x86-64 | `pyo-windows-x86_64.exe` | Rename it to `pyo` (or `pyo.exe` on Windows) and put it in a folder on your `PATH`. On Linux and macOS, make it runnable with `chmod +x pyo`. > macOS blocks a CLI you download in a browser from opening. Clear the block with `xattr -d com.apple.quarantine pyo`. The `curl` install above doesn't need this. On other systems, build the CLI from source with `cargo build --release -p pyo-cli`. ## Sign in ```bash pyo login --url https://your-pyo ``` This shows a code and opens your browser. Type the code there to approve the sign-in. It works over SSH too: open the link it prints on any device. It makes an API key for this computer that lasts a year. Run `pyo login` again for a new one. It remembers your Pyo, so `--url` is only needed the first time. Without it, it asks for the address. Use `--expires` to choose 30d, 90d, 1y or never. Your Pyo shows these commands with its own address under **API keys**. ## Link a folder Choose which service this folder deploys. This writes [`pyo.jsonc`](https://pyo.dev/docs/cli/pyo-jsonc). ```bash pyo link ``` ## Deploy ```bash pyo deploy ``` This applies `pyo.jsonc`, deploys and follows the rollout to the end. The build and deploy logs show as it goes, and `pyo deploy` exits with an error when the deploy fails. Use `--detach` to start it and exit. ### Another service Commands work on the service `pyo.jsonc` is linked to. Pass `-s` to name another one: ```bash pyo deploy -s shop/worker ``` The folder's `pyo.jsonc` belongs to its own service, so its settings don't apply to the one `-s` names. `pyo deploy` says so and deploys without them. A deploy that would send this folder to the other service stops instead, so its files never go there. Run that deploy from the other service's own folder. ## Deploy a folder You don't need a Git repository. In a folder no service is linked to, `pyo deploy` makes a service from it: ```bash cd my-app pyo deploy ``` It asks for a name (the folder's by default) and a project, creates the service, links the folder in `pyo.jsonc` and deploys it. In CI, pass `--name` and `--project` instead (a project that doesn't exist yet is created). `--team` and `--cluster` choose where it runs. The folder is packed and uploaded to Pyo, which hands it to a builder in the service's cluster. It's built like a repository: with its Dockerfile, or without one by detecting the language. Pyo deletes the upload once the builder has it. ```text ✓ Packed 214 files, 1.8 MB ✓ Uploaded 1.8 MB ✓ Created acme/shop/my-app and linked it in pyo.jsonc Deploying my-app https://your-pyo/acme/shop/my-app/deployments/dpl_8f2k1m3x9q ``` Run `pyo deploy` again to send the folder as it is now. The dashboard shows each of these deployments as **Uploaded from** your computer's name, and you can roll back to any of them. What's sent: - Every file in the folder, except what `.gitignore` leaves out. A `.pyoignore` file, written like a `.gitignore`, leaves out more, or keeps something back in with `!`. - Never `.git`. Never `node_modules`, unless `.pyoignore` keeps it with `!node_modules/`. - No `.env` files, since they usually hold secrets. `.env.example` and the like are sent. Pass `--include-env` to send `.env` files too, or set the variables with `pyo env push` instead. - At most 500 MB, packed. A bigger folder stops before it uploads and says what's biggest. A service built from Git deploys its branch as usual. To try your working copy on it without a commit, send the folder instead: ```bash pyo deploy --local ``` ## Everyday commands ```bash pyo status # state, live version and domains pyo logs --follow # follow the logs pyo env set KEY=value # set a variable pyo rollback # put back the previous version pyo exec # open a shell in the service pyo open # open it on the dashboard ``` ## Logs ```bash pyo logs # the last lines of every replica pyo logs -f # and new ones as they come pyo logs --since 10m # only the last 10 minutes pyo logs --replica x2kfp # one replica pyo logs --build # the latest deployment's build and deploy log pyo logs --build -f # followed until it's done ``` Each line starts with its time and the replica it came from. Times are in UTC. `pyo logs -f` keeps one stream open to the cluster, and opens it again if it drops. ## JSON output Add `--json` to a read command to print its data as JSON and nothing else, for scripts and agents: ```bash pyo status --json # the whole service pyo logs --json # the lines, as one array pyo logs -f --json # one object per line, as they come pyo env list --json # the variables, secrets with an empty value ``` It works with `whoami`, `status`, `logs`, `env list`, `domain list`, `firewall list`, `volume list`, `volume snapshots`, `cloudflare zones` and `cloudflare tunnel status`. In `pyo sandbox`, it works with `create`, `ls`, `get`, `token`, `ports ls`, `servers ls` and `templates ls`. It can go before or after the command. Other commands stop with an error that lists these. Exit codes are the same as without it. ## Run a command ```bash pyo exec # a shell pyo exec -- bin/rails db:migrate # one command pyo exec -- sh -c 'echo $DATABASE_URL' # through a shell pyo exec -- pg_dump app > app.sql # output to a file cat seed.sql | pyo exec -- psql app # input from a pipe ``` Everything after `--` runs as it is, in a running replica, and `pyo exec` exits with its exit code, so scripts can check it. It runs without a shell, so use `sh -c` for pipes or variables. A command gets a terminal when you run it from one, else its output and errors stay apart and piped input goes to it. `-t` always gives it a terminal, `-T` never does, and `-i` sends what you type without one. `--replica` picks the replica. Running a command needs the Developer role, and an API key with deploy or full access. A shell needs full access. ## Variables to a .env file ```bash pyo env pull # write the variables to .env pyo env pull --file .env.prod # or another file pyo env pull --secrets # with the secrets' values ``` It won't overwrite a file unless you pass `--force`. Secrets are written with an empty value and a comment, unless you pass `--secrets`. Only team owners and admins can pull secrets' values, and each one is logged like when it's revealed on the dashboard. The file is readable only by you. ## Volumes ```bash pyo volume list # your teams' volumes pyo volume snapshots shop/web-data # its backups, newest first pyo volume restore shop/web-data # pick a backup and restore it pyo volume delete-backup shop/web-data # pick a backup and delete it pyo volume resize shop/web-data 50 # grow it to 50 GB pyo volume attach web-data -s blog/api # attach it, moving it to blog if needed ``` `pyo volume restore` stops the volume's service, restores the backup and starts the service again. It waits until the restore is done, and so does `pyo volume attach` when it moves a volume. Add `--detach` to not wait. Team owners and admins can restore, delete backups and resize. ## Variables from a .env file ```bash pyo env push # set the variables in .env pyo env push .env.production --secret STRIPE_KEY pyo env push --dry-run # see what would change ``` New keys are saved as variables. Pass `--secret KEY` to save one as a secret, or `--secrets` for all of them. A secret you overwrite stays a secret. For keys that are already set, it asks you on a terminal. In CI, pass `--overwrite` or `--skip-existing`. Changes apply on the next deploy, or add `--deploy` to deploy now. ## Domains ```bash pyo domain list # domains, their status and HTTPS pyo domain add shop.example.com # prints the DNS record to create pyo domain add --free # a free nip.io domain, no DNS needed pyo domain add shop.example.com --wait pyo domain remove shop.example.com ``` Domains apply right away, without a redeploy. `--wait` waits until the domain is live. A tailnet name, like `blog..ts.net`, needs no DNS record. ## Backups ```bash pyo backup now # the service's volume pyo backup now --volume shop/web-data --wait pyo backup now --db cache # a KV database, or one added under Backups ``` Backups go to the team's backup destination, set up under **Backups** on the dashboard. `--wait` follows the backup and prints its size and time. ## Set up coding agents ```bash pyo agents # pick the clients from a list pyo agents --client claude,cursor # or name them pyo agents --dry-run # see what would change ``` It writes a Pyo section in `AGENTS.md`, or in `CLAUDE.md` when the folder has only that one. The section has your Pyo's address, the service `pyo.jsonc` links, the commands to deploy, check status, read logs and roll back, and the docs index at `https://pyo.dev/llms.txt`. It goes between `` and ``. Run it again and it replaces only that part. `--client` adds Pyo's [MCP server](https://pyo.dev/docs/mcp) to each client's project config, and keeps everything else in the file: | Client | `--client` | File | | --- | --- | --- | | Claude Code | `claude` | `.mcp.json` | | Cursor | `cursor` | `.cursor/mcp.json` | | VS Code | `vscode` | `.vscode/mcp.json` | | Codex | `codex` | `.codex/config.toml` | No key or token goes in these files. Each client signs in to Pyo with OAuth the first time it uses it. Codex reads `.codex/config.toml` only in projects you trust. Sign it in with `codex mcp login pyo`. It shows the changes and asks before it writes. `--yes` writes without asking. A config file it can't change safely, like JSON with comments, is left as it is, and it prints what to add yourself. It points the agents to the Pyo you signed in to, or to `--url` or `PYO_URL` when set. ## Import from another platform ```bash pyo import coolify --from https://coolify.example.com --source-token ``` It shows what each project, service and database becomes, then asks before it imports. Use `dokploy` for Dokploy. See [Importing from another platform](https://pyo.dev/docs/import-platforms). ## Upgrade ```bash pyo upgrade ``` This replaces `pyo` with the latest release for your system, after checking its checksum. It says when you already have the latest. Add `--version 0.3.0` for a particular release. If you can't write to the folder `pyo` is in, run it as a user who can, or install it again into a folder of yours. Once a day, the CLI looks for a new release. When there is one, it says so after a command: ```text Pyo CLI 0.3.0 is out (you have 0.2.5). Run pyo upgrade. ``` It looks in the background, so commands never wait for it, and it stays quiet when you're offline. It doesn't look in CI, when its output isn't a terminal, or when `PYO_NO_UPDATE_CHECK=1` is set. The CLI can be newer than your Pyo. When it is a minor version or more ahead, `pyo login` and `pyo link` say so, since newer commands may not work until you update Pyo under **Settings › Updates**. See every command in the [command reference](https://pyo.dev/docs/cli/commands). --- # Deploy from CI Use the CLI in a pipeline with an API key. In CI there's no browser to sign in with, so use an API key. Create one with deploy access and an expiry you'll remember to renew. Then give the CLI your Pyo's URL and the key: ```bash curl -fsSL https://pyo.dev/cli.sh | sh export PATH="$HOME/.local/bin:$PATH" export PYO_URL=https://your-pyo export PYO_API_KEY= pyo deploy ``` You can pass `--url` and `--token` instead. Both work on every command. If the folder has no `pyo.jsonc`, say which service to deploy: ```bash pyo deploy --service shop/api ``` A service built from a folder gets the folder CI checked out, the same as `pyo deploy` on your computer. A new one needs its name and project, since there's no one to ask, and an API key with full access: ```bash pyo deploy --name web --project shop ``` `pyo deploy` exits with an error when the build or deploy fails, so the pipeline fails too. ## Deploy a tag or digest When CI builds and pushes the image itself, deploy exactly that image with `--ref`. A key with deploy access is enough: ```bash pyo deploy --service shop/web --ref v1.2.3 pyo deploy --service shop/web --ref sha256:<64 hex> ``` - It's for services that run an image. It changes only the tag or digest, never the image's registry or repository. - The service keeps the reference, so the next `pyo deploy` runs it again. - Pyo looks a tag up in its registry before the rollout and runs the digest the tag points to now. An older image a server has under that tag never runs. A digest is safest when the same tag is pushed more than once. - If the deploy fails, is rolled back or is cancelled, the service gets its reference from before back. Two cases print a warning and still deploy: - The cluster's agent is older than 0.52.1. It may run an older image already on the server for that tag. Update the cluster, or deploy a digest. - Pyo can't reach the registry to look the tag up, for example on a cluster that pulls through a registry mirror. The servers then pull the tag fresh, and Pyo records the digest they run. Rollbacks use that digest. A registry that answers but has no such tag, or refuses Pyo's login, fails the deploy. Nothing changes then. The same works over a [deploy hook](https://pyo.dev/docs/deploy/hooks#deploy-a-tag-or-digest), the `deploy` operation's `reference` in the [API](https://pyo.dev/docs/api), and the `reference` of the MCP tool `deploy_service`. ## Without the CLI A [deploy hook](https://pyo.dev/docs/deploy/hooks) is simpler when all you need is to trigger a deploy. --- # Command reference Every command of the pyo CLI. Add `--help` to any command to see this in your terminal. `--url` and `--token`, or `PYO_URL` and `PYO_API_KEY`, work on every command. `--json` works on the read commands. See [JSON output](https://pyo.dev/docs/cli#json-output). ## `pyo login` Sign in through the browser, or with --token for CI ```text Sign in through the browser, or with --token for CI Usage: pyo login [OPTIONS] Options: --expires When the new API key expires [default: 1y] [possible values: 30d, 90d, 1y, never] --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -h, --help Print help -V, --version Print version ``` ## `pyo logout` Forget this computer's sign-in ```text Forget this computer's sign-in Usage: pyo logout [OPTIONS] Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -h, --help Print help -V, --version Print version ``` ## `pyo whoami` Who you're signed in as ```text Who you're signed in as Usage: pyo whoami [OPTIONS] Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -h, --help Print help -V, --version Print version ``` ## `pyo observability` Whether observability (analytics, request logs, usage history) is on for this Pyo, or turn it on or off. Turning it is for the installation's admin, with a full-access key. ```text Whether observability (analytics, request logs, usage history) is on for this Pyo, or turn it on or off. Turning it is for the installation's admin, with a full-access key. With --team, the team's: whether its servers collect, whether they keep request logs, and what they keep of visitors' IP addresses and query strings. Changing those is for the team's owners and admins. Usage: pyo observability [OPTIONS] [STATE] Arguments: [STATE] [possible values: on, off] Options: --team Show or change this team's settings (slug or id) instead of the installation's --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --request-logs Whether the team's servers keep its request logs [possible values: on, off] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --ip What the team keeps of visitors' IP addresses, up to the installation's limit [possible values: none, anonymized, full, default] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --query-strings What the team keeps of query strings, up to the installation's limit [possible values: keep, names, none, default] -h, --help Print help (see a summary with '-h') -V, --version Print version ``` ## `pyo link` Link this folder to a service (writes pyo.jsonc) ```text Link this folder to a service (writes pyo.jsonc) Usage: pyo link [OPTIONS] [SERVICE] Arguments: [SERVICE] "api", "shop/api" or "team/shop/api". Without it, pick from a list Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -h, --help Print help -V, --version Print version ``` ## `pyo agents` Set up AI coding agents in this folder to use Pyo. ```text Set up AI coding agents in this folder to use Pyo. Writes a Pyo section in AGENTS.md (or CLAUDE.md when that's the only one) and the Pyo MCP server in the clients' project config. Shows the changes and asks first. Running it again replaces only the Pyo section. Usage: pyo agents [OPTIONS] Options: --client The MCP clients to set up, split by commas. Without it, pick from a list Possible values: - claude: Claude Code: .mcp.json - cursor: Cursor: .cursor/mcp.json - vscode: VS Code: .vscode/mcp.json - codex: Codex: .codex/config.toml --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] -y, --yes Write without asking --dry-run Show what would change, and write nothing --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -h, --help Print help (see a summary with '-h') -V, --version Print version ``` ## `pyo deploy` Apply pyo.jsonc and deploy, then follow it to the end. ```text Apply pyo.jsonc and deploy, then follow it to the end. A service built from a folder gets this folder, packed and uploaded (.gitignore and .pyoignore apply). In a folder no service is linked to, it makes one and links it. With -f, deploy a Docker Compose file instead: the first time it makes a project of it, and after that it changes only what the file says differently. Usage: pyo deploy [OPTIONS] Options: -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --detach Start it and exit, without following it --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --local Send this folder, also for a service built from Git --include-env Send .env files too (they're left out by default) --name A new service's name. Defaults to the folder's --project A new service's project (name or id), made when there's none by that name. With -f, the project the file goes to -f, --file A Docker Compose file to deploy as a project (a .env next to it is read too) --dry-run With -f: show what would change, and change nothing --prune With -f: also delete the services made from the file that are no longer in it. Their volumes are kept --team The team of a new service or Compose import (slug or id). Defaults to your first team --cluster The cluster to run it on (name or id). Defaults to the team's default cluster -y, --yes Don't ask: deploy the Compose file (and delete with --prune), or go ahead with a very large replica change --ref For a service that runs an image: deploy this tag (v1.2.3) or digest (sha256:…) of its image, and keep it as the service's -h, --help Print help (see a summary with '-h') -V, --version Print version ``` ## `pyo status` The service's state, live version and domains ```text The service's state, live version and domains Usage: pyo status [OPTIONS] Options: -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -h, --help Print help -V, --version Print version ``` ## `pyo logs` The service's logs, from every replica ```text The service's logs, from every replica Usage: pyo logs [OPTIONS] Options: -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] -f, --follow Keep printing new lines --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --since Only lines since then: 30s, 10m, 2h or 1d --replica One replica, by its name as the lines show it --build The latest deployment's build and deploy log instead -h, --help Print help -V, --version Print version ``` ## `pyo env` Environment variables ```text Environment variables Usage: pyo env [OPTIONS] [COMMAND] Commands: list List variables (secrets stay hidden) set Set KEY=value pairs unset Remove variables push Set the variables of a .env file pull Write the variables to a .env file help Print this message or the help of the given subcommand(s) Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help -V, --version Print version ``` ### `pyo env list` List variables (secrets stay hidden) ```text List variables (secrets stay hidden) Usage: pyo env list [OPTIONS] Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help -V, --version Print version ``` ### `pyo env set` Set KEY=value pairs ```text Set KEY=value pairs Usage: pyo env set [OPTIONS] ... Arguments: ... Options: --secret Store them as secrets: encrypted, never shown again --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --deploy Deploy right away --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help -V, --version Print version ``` ### `pyo env unset` Remove variables ```text Remove variables Usage: pyo env unset [OPTIONS] ... Arguments: ... Options: --deploy Deploy right away --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help -V, --version Print version ``` ### `pyo env push` Set the variables of a .env file. ```text Set the variables of a .env file. New keys are variables unless marked secret. A secret that's overwritten stays a secret. In a terminal, you're asked about keys that are already set. Elsewhere, pass --overwrite or --skip-existing. Usage: pyo env push [OPTIONS] [FILE] Arguments: [FILE] [default: .env] Options: --overwrite Overwrite keys that are set already --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --skip-existing Keep keys that are set already --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --secret Make this key a secret (repeatable) --secrets Make every key a secret --dry-run Show what would change, without saving --deploy Deploy right away -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help (see a summary with '-h') -V, --version Print version ``` ### `pyo env pull` Write the variables to a .env file. ```text Write the variables to a .env file. Secrets are listed with an empty value, unless --secrets: owners and admins get their values. Usage: pyo env pull [OPTIONS] [FILE] Arguments: [FILE] The file to write [default: .env] Options: -o, --file The file to write, as an option --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --force Overwrite the file --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --secrets Write secrets' values too. Owners and admins -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help (see a summary with '-h') -V, --version Print version ``` ## `pyo rollback` Put back the previous version (or a deployment by id) ```text Put back the previous version (or a deployment by id) Usage: pyo rollback [OPTIONS] [DEPLOYMENT] Arguments: [DEPLOYMENT] A deployment id. Defaults to the previous version Options: -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -h, --help Print help -V, --version Print version ``` ## `pyo restart` Restart the service, one replica at a time ```text Restart the service, one replica at a time Usage: pyo restart [OPTIONS] Options: -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -h, --help Print help -V, --version Print version ``` ## `pyo place` Where the service runs: any server, or only the servers and tags given. It moves over right away, without a redeploy. Without options, shows where it runs now ```text Where the service runs: any server, or only the servers and tags given. It moves over right away, without a redeploy. Without options, shows where it runs now Usage: pyo place [OPTIONS] Options: -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --server A server to run on, by name (repeatable) --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --tag Run on every server with this tag, tagged now or later (repeatable) --any Run on any server -h, --help Print help -V, --version Print version ``` ## `pyo scale` How many replicas the service runs. It changes right away, without a redeploy, and in pyo.jsonc too. Without a number, shows how many run now and where ```text How many replicas the service runs. It changes right away, without a redeploy, and in pyo.jsonc too. Without a number, shows how many run now and where Usage: pyo scale [OPTIONS] [REPLICAS] Arguments: [REPLICAS] The number of replicas, 1 or more Options: -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] -y, --yes Don't ask: go ahead with a very large change --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -h, --help Print help -V, --version Print version ``` ## `pyo exec` A shell in the service, or one command: pyo exec -- ``. ```text A shell in the service, or one command: pyo exec -- . A command runs as it is, without a shell (use sh -c for one). It gets a terminal when stdin and stdout are one, else its output and errors stay apart, piped input goes to it, and pyo exits with its exit code. Usage: pyo exec [OPTIONS] [-- ...] Arguments: [COMMAND]... The command and its arguments, after -- Options: -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --replica A replica name. Defaults to any ready replica --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --shell bash, sh, zsh or ash. Defaults to whichever the service has -t, --tty Give the command a terminal -T, --no-tty Never give the command a terminal -i, --interactive Send stdin to the command even from a terminal (end it with Ctrl-D) -h, --help Print help (see a summary with '-h') -V, --version Print version ``` ## `pyo open` Open the service on the dashboard ```text Open the service on the dashboard Usage: pyo open [OPTIONS] Options: -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -h, --help Print help -V, --version Print version ``` ## `pyo registry` Pyo registry, for the team's own images ```text Pyo registry, for the team's own images Usage: pyo registry [OPTIONS] Commands: login Log Docker in with a new 30-day token, to push // images. Only works from a device on Pyo's tailnet help Print this message or the help of the given subcommand(s) Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -h, --help Print help -V, --version Print version ``` ### `pyo registry login` Log Docker in with a new 30-day token, to push ``/``/`` images. Only works from a device on Pyo's tailnet ```text Log Docker in with a new 30-day token, to push // images. Only works from a device on Pyo's tailnet Usage: pyo registry login [OPTIONS] Options: --team The team (slug or id). Defaults to your first team --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --pull-only A token that can only pull --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -h, --help Print help -V, --version Print version ``` ## `pyo sandbox` Sandboxes: isolated machines on your sandbox servers. exec, shell and cp reach the sandbox's server directly over your tailnet, or through Pyo when the server has no Tailscale ```text Sandboxes: isolated machines on your sandbox servers. exec, shell and cp reach the sandbox's server directly over your tailnet, or through Pyo when the server has no Tailscale Usage: pyo sandbox [OPTIONS] Commands: create Make a sandbox from a sandbox template and print its id ls The team's sandboxes get One sandbox rename Give a sandbox another name. Its id stays the same rm Delete a sandbox and its files pause Pause a sandbox. It resumes where it was resume Resume a paused sandbox extend Make a sandbox end this long from now token A new token for the sandbox's server, valid an hour exec Run a command in a sandbox and print its output. Exits with its code shell A terminal in a sandbox cp Copy a file into or out of a sandbox: : on one side. Up to 64 MB ports Serve a sandbox's ports at their own URLs servers The servers sandboxes run on templates What sandboxes start from help Print this message or the help of the given subcommand(s) Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo sandbox create` Make a sandbox from a sandbox template and print its id ```text Make a sandbox from a sandbox template and print its id Usage: pyo sandbox create [OPTIONS] [TEMPLATE] Arguments: [TEMPLATE] The sandbox template, like node-22 (see pyo sandbox templates ls). Default base: Ubuntu 24.04 with git, Python, uv, Node.js, pnpm, Bun, Deno, the GitHub and Docker CLIs, Claude Code, Codex and opencode. desktop adds a desktop and a browser: CDP on port 9222, the screen on port 6080. A server makes these the first time they're used there Options: --name A name to tell it apart. Pyo makes up a short one when left out --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --server The sandbox server to run it on, by name or id. Pyo picks one when left out --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --cpus CPUs. Default 1 (2 for desktop) --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --memory Memory in MiB. Default 512 (2048 for desktop) --disk Writable disk in MiB. Default 2048 --ttl How long it lives, like 30m, 1h or 7d, up to 365d. "none" keeps it until you delete it. Default 5m --pause-when-idle Pause after this many seconds without use -e, --env An environment variable, KEY=VALUE. Repeat for more --label A label, key=value. Repeat for more --network internet or none [possible values: internet, none] --isolation auto (Firecracker where the server has KVM, gVisor elsewhere) or vm (Firecracker only) [possible values: auto, vm] --project A project of the team (id), as a label --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo sandbox ls` The team's sandboxes ```text The team's sandboxes Usage: pyo sandbox ls [OPTIONS] Options: -a, --all Ended ones too (the latest 500) --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo sandbox get` One sandbox ```text One sandbox Usage: pyo sandbox get [OPTIONS] Arguments: The sandbox's id, sbx_… Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo sandbox rename` Give a sandbox another name. Its id stays the same ```text Give a sandbox another name. Its id stays the same Usage: pyo sandbox rename [OPTIONS] Arguments: The sandbox's id, sbx_… The new name Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo sandbox rm` Delete a sandbox and its files ```text Delete a sandbox and its files Usage: pyo sandbox rm [OPTIONS] Arguments: The sandbox's id, sbx_… Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo sandbox pause` Pause a sandbox. It resumes where it was ```text Pause a sandbox. It resumes where it was Usage: pyo sandbox pause [OPTIONS] Arguments: The sandbox's id, sbx_… Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo sandbox resume` Resume a paused sandbox ```text Resume a paused sandbox Usage: pyo sandbox resume [OPTIONS] Arguments: The sandbox's id, sbx_… Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo sandbox extend` Make a sandbox end this long from now ```text Make a sandbox end this long from now Usage: pyo sandbox extend [OPTIONS] Arguments: The sandbox's id, sbx_… Like 30m, 1h or 7d. "none" keeps it until you delete it Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo sandbox token` A new token for the sandbox's server, valid an hour ```text A new token for the sandbox's server, valid an hour Usage: pyo sandbox token [OPTIONS] Arguments: The sandbox's id, sbx_… Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo sandbox exec` Run a command in a sandbox and print its output. Exits with its code ```text Run a command in a sandbox and print its output. Exits with its code Usage: pyo sandbox exec [OPTIONS] ... Arguments: The sandbox's id, sbx_… ... One argument runs with /bin/sh -c, more run as they are Options: --cwd The working directory --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --timeout Kill the command after this many seconds. Default 60 --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo sandbox shell` A terminal in a sandbox ```text A terminal in a sandbox Usage: pyo sandbox shell [OPTIONS] Arguments: The sandbox's id, sbx_… Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo sandbox cp` Copy a file into or out of a sandbox: ``:`` on one side. Up to 64 MB ```text Copy a file into or out of a sandbox: : on one side. Up to 64 MB Usage: pyo sandbox cp [OPTIONS] Arguments: A local file, - for stdin, or : A local file or folder, - for stdout, or : Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo sandbox ports` Serve a sandbox's ports at their own URLs ```text Serve a sandbox's ports at their own URLs Usage: pyo sandbox ports [OPTIONS] Commands: open Serve a port the sandbox listens on and print its URL close Stop serving a port ls The sandbox's open ports help Print this message or the help of the given subcommand(s) Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo sandbox servers` The servers sandboxes run on ```text The servers sandboxes run on Usage: pyo sandbox servers [OPTIONS] Commands: add Add a sandbox server: prints the command to run on it. Owners and admins ls The sandbox servers the team can use rm Remove a sandbox server (name or id). Its sandboxes end help Print this message or the help of the given subcommand(s) Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo sandbox templates` What sandboxes start from ```text What sandboxes start from Usage: pyo sandbox templates [OPTIONS] Commands: ls The sandbox templates the team can use create Make a sandbox template from an image help Print this message or the help of the given subcommand(s) Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ## `pyo db` Built-in databases ```text Built-in databases Usage: pyo db [OPTIONS] Commands: import Copy a Postgres or MySQL database, or a dump file, into an empty database, and follow it. Owners and admins help Print this message or the help of the given subcommand(s) Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -h, --help Print help -V, --version Print version ``` ### `pyo db import` Copy a Postgres or MySQL database, or a dump file, into an empty database, and follow it. Owners and admins ```text Copy a Postgres or MySQL database, or a dump file, into an empty database, and follow it. Owners and admins Usage: pyo db import [OPTIONS] Arguments: The database to import into: its name or id Options: --from The database to copy, as a URL: postgres://user:password@host:5432/db or mysql://… (it must be reachable from the cluster). PYO_IMPORT_URL keeps the password out of your shell's history [env: PYO_IMPORT_URL] --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] -f, --file A dump instead: .sql, .sql.gz, or a Postgres .dump (pg_dump -Fc) --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --retry Run the last failed import again, from the same source --team The team (slug or id), when several have a database by that name --detach Start it and exit, without following it -h, --help Print help -V, --version Print version ``` ## `pyo volume` Volumes: their backups, restoring and growing them, attaching them ```text Volumes: their backups, restoring and growing them, attaching them Usage: pyo volume [OPTIONS] Commands: list Your teams' volumes snapshots A volume's backups, newest first restore Replace a volume's data with one of its backups. Its service is stopped while it runs and started again after delete-backup Delete one of a volume's backups for good. Owners and admins resize Grow a volume (it never shrinks), where its storage class can attach Attach a detached volume to a service on its cluster. For a service in another project, the volume moves there first help Print this message or the help of the given subcommand(s) Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service to attach a volume to (pyo volume attach): "api", "shop/api" or an id -h, --help Print help -V, --version Print version ``` ### `pyo volume list` Your teams' volumes ```text Your teams' volumes Usage: pyo volume list [OPTIONS] Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service to attach a volume to (pyo volume attach): "api", "shop/api" or an id -h, --help Print help -V, --version Print version ``` ### `pyo volume snapshots` A volume's backups, newest first ```text A volume's backups, newest first Usage: pyo volume snapshots [OPTIONS] Arguments: The volume: an id, "name" or "project/name" Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service to attach a volume to (pyo volume attach): "api", "shop/api" or an id -h, --help Print help -V, --version Print version ``` ### `pyo volume restore` Replace a volume's data with one of its backups. Its service is stopped while it runs and started again after ```text Replace a volume's data with one of its backups. Its service is stopped while it runs and started again after Usage: pyo volume restore [OPTIONS] [SNAPSHOT] Arguments: [SNAPSHOT] A snapshot id (see `pyo volume snapshots`). Without it, pick from a list Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] -y, --yes Don't ask to confirm --detach Start it and exit, without following it --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service to attach a volume to (pyo volume attach): "api", "shop/api" or an id -h, --help Print help -V, --version Print version ``` ### `pyo volume delete-backup` Delete one of a volume's backups for good. Owners and admins ```text Delete one of a volume's backups for good. Owners and admins Usage: pyo volume delete-backup [OPTIONS] [SNAPSHOT] Arguments: [SNAPSHOT] A snapshot id (see `pyo volume snapshots`). Without it, pick from a list Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] -y, --yes Don't ask to confirm --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service to attach a volume to (pyo volume attach): "api", "shop/api" or an id -h, --help Print help -V, --version Print version ``` ### `pyo volume resize` Grow a volume (it never shrinks), where its storage class can ```text Grow a volume (it never shrinks), where its storage class can Usage: pyo volume resize [OPTIONS] Arguments: The new size in GB Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service to attach a volume to (pyo volume attach): "api", "shop/api" or an id -h, --help Print help -V, --version Print version ``` ### `pyo volume attach` Attach a detached volume to a service on its cluster. For a service in another project, the volume moves there first ```text Attach a detached volume to a service on its cluster. For a service in another project, the volume moves there first Usage: pyo volume attach [OPTIONS] Arguments: Options: --path The folder in the service (default: where it was, or /data) --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --detach Start a move and exit, without following it --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service to attach a volume to (pyo volume attach): "api", "shop/api" or an id -h, --help Print help -V, --version Print version ``` ## `pyo domain` The service's domains ```text The service's domains Usage: pyo domain [OPTIONS] Commands: list The service's domains and their status add Serve the service on a hostname, or on a path of one. It applies without a redeploy redirect Redirect a domain, or a path of it, to another hostname or path. The query is kept. Live without a redeploy header Header rules of a domain: headers to set or remove on its responses, or with --request on requests to the service. Without changes, lists them remove Stop serving the service on a hostname. Deletes the DNS record Pyo made for it in Cloudflare tunnel Serve a domain through the cluster's Cloudflare Tunnel, or move it back dns Create a domain's DNS record in Cloudflare, or try again. Never overwrites a record help Print this message or the help of the given subcommand(s) Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help -V, --version Print version ``` ### `pyo domain list` The service's domains and their status ```text The service's domains and their status Usage: pyo domain list [OPTIONS] Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help -V, --version Print version ``` ### `pyo domain add` Serve the service on a hostname, or on a path of one. It applies without a redeploy ```text Serve the service on a hostname, or on a path of one. It applies without a redeploy Usage: pyo domain add [OPTIONS] [HOSTNAME] Arguments: [HOSTNAME] e.g. app.example.com, or app.example.com/api for a path Options: --path Only this path of the hostname, like /api. Other services of the team can serve its other paths --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --strip-prefix Send /api/x to the service as /x --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --free A free nip.io domain instead, or a tunnel domain in tunnel mode (no DNS record needed) --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --port The HTTP port to route to, by name or number (default: the first) --wait Wait until it's live --no-cloudflare Don't create the DNS record in Cloudflare, even when a connected zone covers it --proxied Proxied by Cloudflare (once its certificate is issued) --redirect-to Only redirect it, like www.example.com to example.com. No port -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's --status The redirect's status: 301 (default) or 302 [possible values: 301, 302] -h, --help Print help -V, --version Print version ``` ### `pyo domain redirect` Redirect a domain, or a path of it, to another hostname or path. The query is kept. Live without a redeploy ```text Redirect a domain, or a path of it, to another hostname or path. The query is kept. Live without a redeploy Usage: pyo domain redirect [OPTIONS] Arguments: What to redirect: www.example.com, or example.com/old Options: --to Where to: example.com, example.com/new or /new --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --status 301 (default) or 302 [possible values: 301, 302] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --no-keep-path Send every request to the target path itself, not the rest of its path --remove Remove the redirect -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help -V, --version Print version ``` ### `pyo domain header` Header rules of a domain: headers to set or remove on its responses, or with --request on requests to the service. Without changes, lists them ```text Header rules of a domain: headers to set or remove on its responses, or with --request on requests to the service. Without changes, lists them Usage: pyo domain header [OPTIONS] Arguments: e.g. example.com Options: --set "Name: value". Repeat for more --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --remove A header to remove. Repeat for more --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --request On requests to the service instead of responses --unset Stop setting or removing these headers (by name) -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help -V, --version Print version ``` ### `pyo domain remove` Stop serving the service on a hostname. Deletes the DNS record Pyo made for it in Cloudflare ```text Stop serving the service on a hostname. Deletes the DNS record Pyo made for it in Cloudflare Usage: pyo domain remove [OPTIONS] Arguments: e.g. app.example.com, or app.example.com/api for a path Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] -y, --yes Don't ask to confirm --keep-dns-record Keep the DNS record Pyo made in Cloudflare --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help -V, --version Print version ``` ### `pyo domain tunnel` Serve a domain through the cluster's Cloudflare Tunnel, or move it back ```text Serve a domain through the cluster's Cloudflare Tunnel, or move it back Usage: pyo domain tunnel [OPTIONS] Arguments: e.g. app.example.com Options: --replace Replace the records in the way. Owners and admins --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --back Move it back from the tunnel. Not for a name under the tunnel's default domain --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --no-restore Moving back: don't put back the records the tunnel replaced --finish Finish now: close the direct path without waiting for Cloudflare. Visitors it still sends the old way get 404. Owners and admins -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help -V, --version Print version ``` ### `pyo domain dns` Create a domain's DNS record in Cloudflare, or try again. Never overwrites a record ```text Create a domain's DNS record in Cloudflare, or try again. Never overwrites a record Usage: pyo domain dns [OPTIONS] Arguments: e.g. app.example.com Options: --proxied Proxied by Cloudflare (once its certificate is issued) --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --replace Replace the records in the way. Owners and admins --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help -V, --version Print version ``` ## `pyo cloudflare` The team's Cloudflare account: Pyo creates DNS records for domains in its zones. Owners and admins connect it ```text The team's Cloudflare account: Pyo creates DNS records for domains in its zones. Owners and admins connect it Usage: pyo cloudflare [OPTIONS] Commands: connect Connect Cloudflare, or replace its token. The token needs Zone:Read and DNS:Edit test Check the token: the zones it covers and what it's missing zones The zones Pyo can create records in remove Forget the token. Records Pyo made stay in Cloudflare tunnel A cluster's Cloudflare Tunnel: websites through Cloudflare, no open ports help Print this message or the help of the given subcommand(s) Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo cloudflare connect` Connect Cloudflare, or replace its token. The token needs Zone:Read and DNS:Edit ```text Connect Cloudflare, or replace its token. The token needs Zone:Read and DNS:Edit Usage: pyo cloudflare connect [OPTIONS] Options: --token-file A file with the token, or - for stdin. Or set CLOUDFLARE_API_TOKEN --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo cloudflare test` Check the token: the zones it covers and what it's missing ```text Check the token: the zones it covers and what it's missing Usage: pyo cloudflare test [OPTIONS] Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo cloudflare zones` The zones Pyo can create records in ```text The zones Pyo can create records in Usage: pyo cloudflare zones [OPTIONS] Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo cloudflare remove` Forget the token. Records Pyo made stay in Cloudflare ```text Forget the token. Records Pyo made stay in Cloudflare Usage: pyo cloudflare remove [OPTIONS] Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] -y, --yes Don't ask to confirm --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo cloudflare tunnel` A cluster's Cloudflare Tunnel: websites through Cloudflare, no open ports ```text A cluster's Cloudflare Tunnel: websites through Cloudflare, no open ports Usage: pyo cloudflare tunnel [OPTIONS] Commands: status The tunnel, its connectors and its domains on Take the cluster's websites through Cloudflare Tunnel. Owners and admins off Take websites on public ports or Tailscale only again. The tunnel stays until removed remove Remove the tunnel, its records and its connector. Owners and admins rotate A new token and certificate for the tunnel. Owners and admins help Print this message or the help of the given subcommand(s) Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ## `pyo cluster` A cluster's settings: its traffic paths ```text A cluster's settings: its traffic paths Usage: pyo cluster [OPTIONS] Commands: paths Show or turn the cluster's traffic paths on and off: public ports 80 and 443, Cloudflare Tunnel and websites on the tailnet. Turning one off that domains use lists them first. Owners and admins gateway Show or change the cluster's gateway: HTTP/3, compression, the TLS minimum and the timeout defaults for services without their own. HTTP/3 and the TLS minimum drop open connections once. Owners and admins help Print this message or the help of the given subcommand(s) Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team -h, --help Print help -V, --version Print version ``` ### `pyo cluster paths` Show or turn the cluster's traffic paths on and off: public ports 80 and 443, Cloudflare Tunnel and websites on the tailnet. Turning one off that domains use lists them first. Owners and admins ```text Show or turn the cluster's traffic paths on and off: public ports 80 and 443, Cloudflare Tunnel and websites on the tailnet. Turning one off that domains use lists them first. Owners and admins Usage: pyo cluster paths [OPTIONS] Arguments: The cluster, by name or id Options: --public Ports 80 and 443 on the servers: on or off --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --tunnel Cloudflare Tunnel: on or off. Off removes it at Cloudflare --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --tailnet Websites on the tailnet: on or off. Servers stay on the tailnet --team The team (slug or id). Defaults to your first team --ports TCP and UDP ports on the servers while public ports are off: on or off --move-to-tunnel Turning public ports off: move domains in the tunnel's Cloudflare account to the tunnel first (on by default): on or off --restore-records Turning the tunnel off: put back the records it replaced (on by default): on or off -y, --yes Go ahead when domains move or stop -h, --help Print help -V, --version Print version ``` ### `pyo cluster gateway` Show or change the cluster's gateway: HTTP/3, compression, the TLS minimum and the timeout defaults for services without their own. HTTP/3 and the TLS minimum drop open connections once. Owners and admins ```text Show or change the cluster's gateway: HTTP/3, compression, the TLS minimum and the timeout defaults for services without their own. HTTP/3 and the TLS minimum drop open connections once. Owners and admins Usage: pyo cluster gateway [OPTIONS] Arguments: The cluster, by name or id Options: --http3 HTTP/3 on UDP port 443: on or off. Needs public ports, and UDP 443 open in the servers' firewall --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --compression Zstd, Brotli and Gzip on services' HTTPS domains: on or off --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --team The team (slug or id). Defaults to your first team --tls-min The oldest TLS version HTTPS accepts: 1.2 or 1.3 --request-timeout Seconds a request may take, 1 to 3600, or 0 for no limit --idle-timeout Seconds a WebSocket or stream may stay quiet, 60 to 86400 -y, --yes Go ahead when open connections drop -h, --help Print help -V, --version Print version ``` ## `pyo firewall` Who may reach the service: its firewall rules, and a CDN in front ```text Who may reach the service: its firewall rules, and a CDN in front Usage: pyo firewall [OPTIONS] Commands: list The rules, in the order they're checked add Add a rule at the end remove Remove a rule, by its number in the list or its id behind Put the service's websites behind a CDN, or "off" help Print this message or the help of the given subcommand(s) Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help -V, --version Print version ``` ### `pyo firewall list` The rules, in the order they're checked ```text The rules, in the order they're checked Usage: pyo firewall list [OPTIONS] Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help -V, --version Print version ``` ### `pyo firewall add` Add a rule at the end. ```text Add a rule at the end. Values: IP addresses and ranges, two-letter country codes, or presets: cloudflare, fastly, bunny, cloudfront (a CDN's current ranges), tailnet, private. None: any client. Usage: pyo firewall add [OPTIONS] [VALUES]... Arguments: allow, block or rate-limit [VALUES]... The values to match Options: --not Match clients not in the values instead --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --requests A rate limit's requests from each client address --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --per A rate limit's window: second or minute [possible values: second, minute] --name A name for it -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help (see a summary with '-h') -V, --version Print version ``` ### `pyo firewall remove` Remove a rule, by its number in the list or its id ```text Remove a rule, by its number in the list or its id Usage: pyo firewall remove [OPTIONS] Arguments: Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] -y, --yes Don't ask to confirm --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help -V, --version Print version ``` ### `pyo firewall behind` Put the service's websites behind a CDN, or "off". ```text Put the service's websites behind a CDN, or "off". Behind Cloudflare, only Cloudflare reaches them, and rules, rate limits and analytics see the visitor it forwards. Usage: pyo firewall behind [OPTIONS] Arguments: [possible values: cloudflare, off] Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's -h, --help Print help (see a summary with '-h') -V, --version Print version ``` ## `pyo import` Bring services over from Coolify, Dokploy, Railway or Vercel: see what they become, then import them. Owners and admins ```text Bring services over from Coolify, Dokploy, Railway or Vercel: see what they become, then import them. Owners and admins Usage: pyo import [OPTIONS] --source-token Arguments: The platform: coolify, dokploy, railway or vercel [possible values: coolify, dokploy, railway, vercel] Options: --from Its address, e.g. https://coolify.example.com. Not for Railway or Vercel --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --source-token Its API token (Coolify's with read and read:sensitive, a Railway account, workspace or project token, a Vercel token). Used for this import only [env: PYO_IMPORT_TOKEN] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --source-team Vercel only: the team to read (its slug or id). The token's own scope by default --team The team to import into (slug or id). Defaults to your first team --cluster The cluster to run it on (name or id). Defaults to the team's default cluster --deploy Deploy the services once they're made -y, --yes Import without asking -h, --help Print help -V, --version Print version ``` ## `pyo backup` Backups of volumes and databases ```text Backups of volumes and databases Usage: pyo backup [OPTIONS] Commands: now Back up a volume or database now help Print this message or the help of the given subcommand(s) Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -h, --help Print help -V, --version Print version ``` ### `pyo backup now` Back up a volume or database now. ```text Back up a volume or database now. Without --volume or --db: the service's volume, when it has one. Usage: pyo backup now [OPTIONS] Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --volume The volume: an id, "name" or "project/name" --db The database: its name or id -s, --service The service: a name ("api", "shop/api") or id. Default: pyo.jsonc's --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only --wait Wait until it's done -h, --help Print help (see a summary with '-h') -V, --version Print version ``` ## `pyo version` The CLI's version, like --version ```text The CLI's version, like --version Usage: pyo version [OPTIONS] Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -h, --help Print help ``` ## `pyo upgrade` Update the CLI to the latest release. ```text Update the CLI to the latest release. Once a day, the CLI looks for a new release and says when one is out. PYO_NO_UPDATE_CHECK=1 turns that off. Usage: pyo upgrade [OPTIONS] Options: --url Your Pyo, e.g. https://pyo.example.com (default: the one you signed in to) [env: PYO_URL] --version A release instead of the latest, e.g. 0.3.0 --token An API key, for CI (default: the one `pyo login` saved) [env: PYO_API_KEY] --json Print the data as JSON and nothing else, for scripts and agents. Read commands only -h, --help Print help (see a summary with '-h') ``` --- # pyo.jsonc Keep a service's settings next to its code. `pyo link` writes this file, and `pyo deploy` applies it. Every setting is optional. What's set here wins, and the rest stays as it is in the dashboard. Pyo looks in the current folder, then in the folders above it. The file is JSON with comments and trailing commas: ```jsonc { "$schema": "https://pyo.dev/schema/pyo.json", "service": "svc_abc123", // written by pyo link // Image services only. A tag or an @sha256 digest. "image": "ghcr.io/acme/api:1.2", "build": { "branch": "main", "dockerfilePath": "Dockerfile", "context": ".", "args": { // used on the next deploy "RAILPACK_SPA_OUTPUT_DIR": "dist", }, }, "deploy": { "replicas": 2, "port": 8080, // the port it listens on for HTTP "health": "/healthz", // checked before traffic moves over, or "tcp" or "none" "autoRollback": true, "serveAs": "static", // a static site's build served as files, or "service" "timeout": 300, // seconds a request may take, up to 3600, 0 for no limit }, "resources": { "cpu": "500m", // limit: "500m" or "1" (cores) "memory": "512Mi", // limit: "512Mi" or "1Gi" }, "env": { "LOG_LEVEL": "info", }, } ``` Unknown settings are rejected, so a typo fails instead of being ignored. With `$schema` in the file, editors like VS Code complete each setting and explain it as you type. `deploy.timeout` is the service's [request timeout](https://pyo.dev/docs/domains#request-timeout): how many seconds Pyo Gateway waits for an answer before it returns 504. It's 300 by default, and 0 means no limit. It doesn't close WebSockets. The file's settings are for the service it's linked to. With `-s`, a command that names another service leaves them out. See [Another service](https://pyo.dev/docs/cli#another-service). ## Secrets `env` is for variables, not secrets, because this file is usually committed. Keep secrets in Pyo: ```bash pyo env set --secret STRIPE_KEY=sk_live_... ``` Build arguments can end up in the image, so keep secrets out of `build.args` too. --- # Pyo Cloud Pyo, run for you. Your services run on your own servers. > Pyo Cloud is coming soon. It isn't open for sign-ups yet. Pyo Cloud is Pyo run by us at `cloud.pyo.dev`. You sign up, connect your own servers, and deploy. We run and update the dashboard, the API and Pyo's database. Your services, databases, builds and traffic stay on your servers. It's the same Pyo as self-hosted, with the same dashboard, [CLI](https://pyo.dev/docs/cli), [API](https://pyo.dev/docs/api) and [MCP](https://pyo.dev/docs/mcp). It costs $5 per server per month, with everything included and unlimited users. See [Billing](https://pyo.dev/docs/cloud/billing). ## How it works Each server runs k3s and the Pyo agent, which the connect command installs. The agent dials out to Pyo Cloud over HTTPS, so nothing on your server listens for us. Every command Pyo Cloud sends to it is signed, and the agent refuses anything that isn't. See [Security](https://pyo.dev/docs/cloud/security). Visitors reach your services directly on your servers, through [Pyo Gateway](https://pyo.dev/docs/gateway). Their traffic never goes through Pyo Cloud. ## Where to start - [Getting started](https://pyo.dev/docs/cloud/getting-started): Sign up, connect a server and deploy. - [Server requirements](https://pyo.dev/docs/cloud/server-requirements): What a server needs to join. - [Security](https://pyo.dev/docs/cloud/security): What Pyo Cloud can and can't do. - [Cloud and self-hosted](https://pyo.dev/docs/cloud/differences): What's different on Pyo Cloud. - [Moving to self-hosted](https://pyo.dev/docs/cloud/moving-to-self-hosted): Move your team to a Pyo you run. ## Support Email [support@pyo.dev](mailto:support@pyo.dev). --- # Agent updates How the Pyo agent on your servers stays up to date. We update Pyo Cloud. The agent on your servers follows its version. ## Automatic By default, Pyo Cloud updates each cluster's agent within a minute of a new version. The update is a signed command, like any other. Your services keep running while the agent restarts. ## When you choose To choose when instead, open **Settings**, and under **Agents**, turn off **Update agents automatically**. Owners and admins change this. A cluster whose agent is behind then shows **Update available** in its **Settings** tab. Choose **Update** to update it. ## What an update changes An update changes only the agent. It doesn't touch k3s, your services or the agent's limits. Those change only when you run the connect command again on the server. See [Refresh a cluster](https://pyo.dev/docs/clusters#refresh-a-cluster). ## Refresh a cluster Some of our updates change more than the agent. Your cluster then shows **Update needed** in its **Settings** tab. Run the command under **Refresh this cluster** on the cluster's first server. Your services keep running until you do. Your databases don't restart when we update Pyo Cloud, or when the agent updates. They move to their new images when you run that command. The panel says **Restarts your databases once** when it will restart them, so you choose the moment. Each restart is recorded in your team's **Activity**, like "Restarting the database main for an update". See [When databases restart](https://pyo.dev/docs/updating-pyo#when-databases-restart). ## Automatic updates on your server The connect command and the command under **Refresh this cluster** come with **Keep this cluster up to date automatically**, ticked. It sets up automatic updates on the cluster's first server. Pyo Cloud only names its version. Your server checks that version's signed release itself, and never moves to an earlier one. Pyo Cloud can't push anything to your cluster this way. For now, automatic updates only set themselves up. After an update, your cluster still shows **Update needed**, and you still run the command under **Refresh this cluster**. The panel there says "Automatic updates are set up on this cluster". To leave them off, untick the box before you copy the command. To pause them on a server, set `hold=true` in `/etc/pyo/verify.conf`. ## Which versions Agents update only to versions we've released. The signing service refuses any other. See [Signed commands](https://pyo.dev/docs/cloud/security#signed-commands). --- # Billing $5 per server per month, with everything included. > Pyo Cloud is coming soon. It isn't open for sign-ups yet. See [pricing](/pricing). ## The price - **$5 per server per month.** Each connected server counts once, whatever it runs. A [sandbox server](https://pyo.dev/docs/sandbox#on-pyo-cloud) counts as one too, once it joined. Its sandboxes cost nothing more. - **20% off** when you pay yearly. - **Everything included.** Clusters, projects, services, databases and users are unlimited. There are no request or traffic limits. - **No trial.** Self-hosted Pyo is free if you want to try it first. See [Installing Pyo](https://pyo.dev/docs/install). ## Paying Open **Settings → Billing** and add a payment method. A team needs one before its first server connects. - **Card,** anywhere, through Polar. It renews by itself. Polar sends invoices and handles sales tax and VAT. - **QRIS, bank transfer or e-wallet,** in Indonesia, through Midtrans. You pay in rupiah, a month or a year at a time. Your bill follows your servers: - **Adding a server** charges for the rest of the month. - **Removing a server** credits your next invoice. ## When a payment fails Your services keep running. After 7 days, your team is paused until you pay. While paused, you can't deploy, connect new servers or change settings on your servers. **Settings → Billing** says when. If the payment is still unpaid 30 days after it failed, your subscription ends. Your team's data is kept 30 more days, then deleted. ## While a plan is paused or ended Your team's servers get no changes. Changes you ask for are refused with a message that says why. - Your services keep running. - You can still see everything, read logs and delete things. Paying resumes your plan at once. Pyo then sends the updates it held back, like routes, firewall rules and cron jobs. ## Canceling Cancel anytime from **Settings → Billing**, or remove all your servers. You keep access until the end of the period you paid for. If you removed your servers, connecting one before then keeps your subscription. When it ends, your servers get no changes. Your services keep running on them. To remove what Pyo put there, see [Disconnect a cluster](https://pyo.dev/docs/uninstall#disconnect-a-cluster). Moving to a Pyo you run yourself? See [Moving to self-hosted](https://pyo.dev/docs/cloud/moving-to-self-hosted). ## Questions Email [support@pyo.dev](mailto:support@pyo.dev). --- # Data and analytics What stays on your servers, and what Pyo Cloud keeps. > Coming soon. This is how analytics will work when Pyo Cloud opens. Your visitors' requests stay on your servers. Pyo Cloud keeps only totals. ## On your servers - **Every request,** in compressed files on a small volume in your cluster. The last 7 days or 1 GB by default, whichever comes first. A team setting changes both. - **Visitors' IP addresses.** Countries and the daily [visitor hash](https://pyo.dev/docs/observability#analytics) are worked out on your servers, so IP addresses never leave them. Your team chooses what its servers keep of visitors' IP addresses and query strings, under its **Settings → Observability**. **Request logs** and their live view ask your cluster through the agent, so they need the cluster online. ## On Pyo Cloud Totals for each service and domain, per minute: - requests by status and method, and bytes sent - response times - visitors - countries, top pages and referrers - requests the [firewall](https://pyo.dev/docs/firewall) and [WAF](https://pyo.dev/docs/waf) blocked Totals are kept for 12 months. Your team can choose 3 or 6 months instead in its settings. **Analytics** reads only totals, so it works while a cluster is offline. ## Everything else - **Build logs** are kept for 90 days. - **Service logs** come from your servers live, when you open them. - **Backups** go from your servers straight to your own bucket. See [Backups](https://pyo.dev/docs/cloud/differences#backups). - **Your services' data,** databases and volumes stay on your servers. - **Sandboxes** run on your own sandbox servers. Their terminal and file data go over your tailnet. For a server without Tailscale they pass through Pyo Cloud, which stores none of it. See [Sandbox servers](https://pyo.dev/docs/cloud/security#sandbox-servers). - **Static sites' files** stay on your cluster, in a store Pyo starts there with its first static site. Pyo Cloud keeps each deploy's list of files. --- # Pyo Cloud and self-hosted What's different when we run Pyo for you. Pyo Cloud runs the same Pyo you can install yourself. These are the differences. | | Self-hosted | Pyo Cloud | | --- | --- | --- | | Who runs Pyo | You, on your server | Us, at `cloud.pyo.dev` | | Price | Free | $5 per server per month | | Updates to Pyo | You [update it](https://pyo.dev/docs/updating-pyo) | We do | | The server Pyo runs on | Your first cluster | Not offered. Every server connects with a command | | Buying servers at Hetzner | Yes | Not for now | | [Sandbox servers](https://pyo.dev/docs/sandbox#add-a-sandbox-server) | With a command or bought at Hetzner | [With a command](#sandbox-servers) | | Several servers in a cluster | Over your tailnet | Over your tailnet | | Backups | Built-in store or your own bucket | Your own S3-compatible bucket | | Images | Pyo's registry | Each cluster's own registry | | Agent updates | With each Pyo update | Automatic, or when your team chooses | | Commands to servers | From your Pyo | Signed, with keys in AWS KMS | | Your own domains | A DNS record | A DNS record and a TXT record | ## No "This machine" Pyo Cloud doesn't run on any of your servers, so **Add cluster** has no **This machine** choice. Every server connects with the [connect command](https://pyo.dev/docs/cloud/getting-started#3-connect-a-server). Hetzner servers aren't sold through Pyo Cloud for now. Buy one at any provider and connect it. ## Tailscale A cluster with several servers joins them over your own tailnet, as on [self-hosted](https://pyo.dev/docs/tailscale). Set it up once for the team under **Integrations**, and every cluster of the team joins it. You paste a Tailscale token in the dashboard, Pyo passes it to one of your clusters' agents in a signed command, and that agent keeps the credential on your server and does the Tailscale work for the team's other clusters. Pyo Cloud never joins your tailnet and never stores your Tailscale credentials. ## Sandbox servers A team adds a [sandbox server](https://pyo.dev/docs/sandbox#on-pyo-cloud) with one command. It needs no cluster. With your team's [Tailscale](#tailscale) set up, it joins your tailnet, and the terminal, files and desktop of its sandboxes open there. Without Tailscale, it joins with its one-time code alone, the terminal and files go through Pyo Cloud, and the desktop doesn't open. Either way the server joins Pyo Cloud over HTTPS and gets its work there with a key of its own. Pyo Cloud never connects to it. See [Security](https://pyo.dev/docs/cloud/security#sandbox-servers). Pyo Cloud doesn't make sandbox servers at Hetzner. Each team has only its own sandbox servers. There are none shared by every team. ## Backups There's no built-in backup store on Pyo Cloud. Add an S3-compatible bucket of your own under **Backups**, like Backblaze B2, Cloudflare R2 or AWS S3. Backups go from your servers straight to your bucket. See [Backing up data](https://pyo.dev/docs/backups). Its address needs `https://`. Private network addresses aren't allowed on Pyo Cloud. ## Your own domains Before a service takes a domain, Pyo Cloud asks for a TXT record that proves you own it: | Type | Name | Value | | --- | --- | --- | | TXT | `_pyo-verify.` | Your team's token, shown in the dashboard | Pyo reads the record from your domain's own name servers, so it counts as soon as they have it. No DNS cache stands in the way. With [Cloudflare](https://pyo.dev/docs/cloudflare) connected and a zone that covers the domain, Pyo adds the record for you. It deletes that record again once the domain is proven, or when you remove the domain. A record you added yourself stays. Point the domain at your servers as usual. See [Adding a domain](https://pyo.dev/docs/domains#custom-domains). Free domains need no TXT record, but they must point at your own servers. ## Images Builds run on your cluster's builder, and images stay in your cluster's own registry. They never go through Pyo Cloud. To [push your own images](https://pyo.dev/docs/registries#push-your-own-images), set up [Tailscale](#tailscale) on the cluster first. **Registry** then shows each cluster's push address on your tailnet. ## Secret stores and other addresses [External secret stores](https://pyo.dev/docs/external-secrets), backup buckets and other addresses you enter must use `https://` on a public address. Private network addresses aren't allowed on Pyo Cloud. --- # Getting started with Pyo Cloud Sign up, pay, connect a server and deploy. > Pyo Cloud is coming soon. It isn't open for sign-ups yet. ## 1. Sign up Create an account at [cloud.pyo.dev](https://cloud.pyo.dev). You get a team of your own. Invite others from **Members**. Users are unlimited. ## 2. Add a payment method Open **Settings → Billing** and pay by card. In Indonesia you can also pay with QRIS, bank transfer or an e-wallet. A team needs a payment method before its first server connects. There's no trial. See [Billing](https://pyo.dev/docs/cloud/billing). ## 3. Connect a server Pick a server that meets the [requirements](https://pyo.dev/docs/cloud/server-requirements): Linux on x86-64, 2 CPU cores, 2 GB of memory and 40 GB of disk at least. A fresh server is best. In **Clusters**, choose **Add cluster**, name it, and copy the command. Run it on the server: ```bash curl -fsSL https://pyo.dev/v/0.53.0/server.sh | bash -s -- connect pyoc1_eyJhcGkiOi... --auto-update ``` The dashboard fills in the release and the token. It runs [`pyo-server`](https://pyo.dev/docs/pyo-server), after checking it against the SHA-256 that the release's `server.sh` on pyo.dev carries. `--auto-update` follows the **Keep this cluster up to date automatically** checkbox. See [Agent updates](https://pyo.dev/docs/cloud/agent-updates). The command works once, for an hour. If it expires, get a new one from the cluster's page. It asks for `sudo` if it needs root. The command installs k3s, the Pyo agent, [Pyo Gateway](https://pyo.dev/docs/gateway) and a [builder](https://pyo.dev/docs/builders) with its own registry. The cluster shows as connected once the agent reports in. The command works once, for an hour. If it expires, the cluster offers a new one. ## 4. Deploy Deploy from Git, a container image, a template or a Docker Compose file, as on self-hosted Pyo. See [Making your first deploy](https://pyo.dev/docs/first-deploy). Builds run on your server, and images stay in your cluster's registry. On a server with a public IP, your service opens on a [free domain](https://pyo.dev/docs/domains#free-domains) with HTTPS. To use your own domain, Pyo Cloud also asks for a TXT record that proves it's yours. See [Your own domains](https://pyo.dev/docs/cloud/differences#your-own-domains). ## Next - Set up [backups](https://pyo.dev/docs/backups) to an S3-compatible bucket of your own. - [Connect GitHub](https://pyo.dev/docs/github) to deploy on every push. - Read what's [different from self-hosted](https://pyo.dev/docs/cloud/differences). --- # Moving to self-hosted Move a team from Pyo Cloud to a Pyo you run yourself. > Pyo Cloud is coming soon. It isn't open for sign-ups yet. Your services, databases and volumes already run on your servers. Moving to self-hosted Pyo means setting up your own Pyo, recreating your team in it, and moving your servers over. Pyo can't export a team from Pyo Cloud and import it elsewhere yet. You recreate your setup by hand, with Pyo Cloud open next to it. See [What Pyo can't do yet](#what-pyo-cant-do-yet). ## Before you start > Removing k3s from a server deletes everything on it, including volumes and databases. Don't remove anything until your data is in your new Pyo. - **A spare server keeps downtime short.** Your services keep running on Pyo Cloud while you set up the new Pyo next to it. Without one, see [Without a spare server](#without-a-spare-server). - **Services with a database go down for a short time.** Writes made after you copy a database aren't copied, so its services stop while it moves. - **Lower the TTL** of your DNS records, to 5 minutes for example, a day ahead. Domains then move faster. ## 1. Save your setup 1. **Save a copy of your team.** It lists your projects, services, clusters and their settings, without secret values: ```bash curl https://cloud.pyo.dev/api/v1/state \ -H "Authorization: Bearer $PYO_API_KEY" > pyo-cloud.json ``` 2. **Save each service's variables** with the [CLI](https://pyo.dev/docs/cli), signed in to Pyo Cloud: ```bash pyo env pull -s shop/api shop-api.env ``` Secrets are left out. Team owners and admins can show each one under the service's **Settings → Environment**. Each time is recorded in **Activity**. Keep them somewhere safe. 3. **Save your backups' password.** On **Backups**, choose **Restore** and reveal the repository password. Without it, the backups Pyo Cloud made can't be read once your team is gone. ## 2. Install Pyo Pick a server that meets the [requirements](https://pyo.dev/docs/install#requirements). A new one is best. Run: ```bash curl -fsSL https://pyo.dev/install.sh | bash ``` It becomes your first cluster. See [Installing Pyo](https://pyo.dev/docs/install). Then: 1. Set up [email](https://pyo.dev/docs/email), so you can invite your team. 2. Set up the [GitHub App](https://pyo.dev/docs/github#set-up-the-github-app), if you deploy from GitHub. 3. Set up [Tailscale](https://pyo.dev/docs/tailscale). You need it to connect more servers later. ## 3. Recreate your team Logins and tokens can't be read back from Pyo Cloud. Enter them again, or make new ones. | What | Where in your Pyo | | --- | --- | | Members | Invite them under **Members**. Each one sets up passkeys and two-factor again. | | API keys | Make new ones. Update `PYO_URL` and `PYO_API_KEY` in your CI. | | GitHub, GitLab, Cloudflare, secret stores | **Integrations** | | Registry logins | **Integrations → Container registries** | | Alert channels | **Notifications** | | Backups | Add your bucket under **Backups**. The same bucket works. | | Firewall and WAF rules | **Security** | | Deploy hooks | Make new ones and update the URLs where you call them. | ## 4. Recreate your services 1. **Create each project and service** in your Pyo, with the same names. Copy their settings from Pyo Cloud, or from `pyo-cloud.json`. Add volumes, cron jobs and scaling the same way. Leave domains for [step 6](#6-move-your-domains). 2. **Services with `pyo.jsonc`:** sign in to your Pyo with `pyo login`, then run `pyo link` in the repository. It points the file at the new service and keeps your settings. `pyo deploy` applies them. Commit the file. See [pyo.jsonc](https://pyo.dev/docs/cli/pyo-jsonc). 3. **Set the variables** from the files you saved: ```bash pyo env push -s shop/api shop-api.env pyo env set -s shop/api --secret STRIPE_KEY=sk_live_... ``` 4. **Deploy.** Your Pyo builds each service again. Images built on Pyo Cloud stay in your old cluster's registry. Push images you pushed there yourself again, to your Pyo's [registry](https://pyo.dev/docs/registries). 5. **Check each service** on its free domain. Leave services that use a database for the next step. Docker Compose projects can be imported again with `pyo deploy -f`. See [Docker Compose](https://pyo.dev/docs/deploy/compose). ## 5. Move your data ### Postgres and MySQL Do this for one database at a time. Its services are down from step 1 until step 6. 1. **Stop** each service that writes to the database on Pyo Cloud, from its **⋯** menu. 2. **Dump it on its server.** On the database's **Connect** tab in Pyo Cloud, find its address, like `main-rw.pyo-db-abc.svc.cluster.local`. For Postgres with a connection pooler, use `DATABASE_URL_DIRECT`. The name before the first dot is the service, and the part after it is the namespace. Open a tunnel to it: ```bash sudo k3s kubectl -n pyo-db-abc port-forward svc/main-rw 15432:5432 ``` 3. In a second terminal on the server, dump it with the URL from **Connect**, using `127.0.0.1:15432` as the host. The tool must be the database's version or newer: ```bash pg_dump --no-owner --no-acl -Fc "postgres://app:@127.0.0.1:15432/app" -f main.dump ``` For MySQL, use port `3306` in the tunnel and `mysqldump` as in [Migrating a database](https://pyo.dev/docs/migrating#with-a-dump-file). 4. **Import it** in your Pyo: **New → Import database**, then **Dump file**. Or copy the file to your computer and run `pyo db import main --file main.dump`. See [Import data](https://pyo.dev/docs/databases#import-data). 5. **Connect** the new database to its services, and deploy them. 6. **Move their domains** right away, as in [step 6](#6-move-your-domains). Pyo can't import KV data yet. KV databases start empty in your Pyo. ### Volumes Pyo can't copy a volume to another Pyo yet. Get its files from a backup with restic: **Restore** on **Backups** in Pyo Cloud shows the repository and the commands, and you saved the password in step 1. Then put the files back in the new service's volume with your own tools. A database you run as a service, from a template, keeps its data in a volume. Dump it with its own tool instead, and load it into the new one. ## 6. Move your domains For each domain: 1. Add it to the service in your Pyo. See [Adding a domain](https://pyo.dev/docs/domains#custom-domains). 2. Point its DNS record at your new server. 3. Wait for HTTPS. The domain shows **Issuing certificate** until Let's Encrypt reaches the new server, usually a minute or two. 4. Check the site. Visitors whose DNS isn't updated yet still reach Pyo Cloud's copy, so keep it running for a day. Once every domain has moved, delete the `_pyo-verify` TXT records you added. Your Pyo doesn't need them. Pyo already deleted the ones it added through Cloudflare. Free domains change, so update any links to them. ## 7. Move your servers Do this for each old server once nothing on it is needed. 1. **Check** that its domains point elsewhere and its data is in your new Pyo. 2. **Remove k3s** on the server. This stops its services and deletes everything on it: ```bash sudo /usr/local/bin/k3s-uninstall.sh ``` If k3s was there before you connected the server, don't remove it. See [Disconnect a cluster](https://pyo.dev/docs/uninstall#disconnect-a-cluster) instead. 3. **Remove it from Pyo Cloud.** Once the cluster has been unreachable for 10 minutes, choose **Remove anyway** on its **Settings** tab and confirm. Your next invoice credits the server. 4. **Connect it to your Pyo,** as a [cluster](https://pyo.dev/docs/clusters) of its own or as a [server](https://pyo.dev/docs/servers) in one you have. Until you remove k3s, the server's services keep running. Removing the cluster from Pyo Cloud alone changes nothing on the server. ## Without a spare server Install your Pyo on one of your servers. Its services are down from when you remove k3s until they're deployed again. 1. [Save your setup](#1-save-your-setup). 2. Stop the services that write to its databases, and dump each one, as in [step 5](#5-move-your-data). Copy the dumps and your volumes' files off the server. 3. [Remove k3s](#7-move-your-servers) and remove the cluster from Pyo Cloud. 4. [Install Pyo](#2-install-pyo) on the server, then do steps 3 to 5. 5. Add your domains. They already point at this server, so HTTPS starts right away. ## 8. Cancel Pyo Cloud Do this last, once everything runs on your Pyo. 1. Cancel under **Settings → Billing**. See [Billing](https://pyo.dev/docs/cloud/billing#canceling). 2. On GitHub and GitLab, remove Pyo Cloud's app and tokens. 3. Revoke your Pyo Cloud API keys. ## What Pyo can't do yet - Export a team from Pyo Cloud and import it into another Pyo. - Take over services, databases or volumes already running on a server. - Copy a database or a volume from one Pyo to another. - Restore Pyo Cloud's backups in another Pyo. Restic can read them with the password. - Import KV data. - Read back logins and tokens for Git, registries, alert channels and other integrations. Questions? Email [support@pyo.dev](mailto:support@pyo.dev). --- # Security on Pyo Cloud How Pyo Cloud reaches your servers, and what it can and can't do there. Your servers run your services. Pyo Cloud only tells them what to run, and every instruction it sends is signed. This page explains what that means in practice. ## How your servers talk to Pyo Cloud - **The agent dials out.** It connects to `agent.pyo.dev` over HTTPS. Nothing on your server listens for Pyo Cloud, and you don't open any port for it. - **The agent has its own key.** It makes a key on your server when it connects and swaps it for a new one every 12 hours. The key never leaves your server. - **Connect commands work once.** Each one works for an hour, for one cluster. It can't be used again once its agent reports in. ## Signed commands Every command Pyo Cloud sends to your servers is signed by a separate signing service, on its own server. Its key is kept in AWS KMS, a hardware security module. The key can't be copied out, not even by us. The agent checks every command before it acts. It refuses a command that's unsigned, changed, sent twice, expired or meant for another cluster. Answers the agent acts on, like a certificate, are signed too. Signing protects your servers from: - A stolen copy of Pyo Cloud's database. It holds no key that can sign. - Commands changed or sent again on the way to your server. - A command signed for one cluster being run on another. - Commands that would widen what the agent may do. The signing service refuses them. - Agent images we haven't released. See [Agent updates](https://pyo.dev/docs/cloud/agent-updates). The signing service also limits how many commands each cluster gets, and logs every signature. Signing doesn't protect against someone who takes over Pyo Cloud's own servers or changes its database. Apart from agent updates, the signing service sees only each command's kind and hash. It signs the commands Pyo Cloud's servers ask for. So that person could get a command like a deploy signed for your cluster. The agent's own limits still apply to every command. See [What the agent may do](#what-the-agent-may-do). ## What the agent may do The agent only changes your projects and Pyo's own parts. It can't read Kubernetes Secrets outside those or run privileged services. See [On your clusters](https://pyo.dev/docs/encryption#on-your-clusters). These limits come from the connect command you ran. Pyo Cloud can't widen them. Only running a new connect command on your server changes them. ## Sandbox servers A [sandbox server](https://pyo.dev/docs/sandbox#on-pyo-cloud) dials out too. Nothing on it listens for Pyo Cloud. - **Its own key.** The server makes a key when it joins. Pyo Cloud keeps only the public half. The key opens only that server's own commands, reports and results. It lasts a day, and the server renews it by itself. **Reset access** or removing the server ends it at once. - **Signed commands.** Every command to a sandbox server is signed by the signing service, for that one server and your team. The server refuses a command for another server, one it has seen, or one that expired. - **The join code.** It works once, for 15 minutes, and Pyo Cloud keeps only its hash. With Tailscale, Pyo Cloud also checks that your tailnet lists the server. Where the terminal and file data of a sandbox go depends on the server: | The server joined | Terminal, command and file data | | --- | --- | | With Tailscale | Go from your device to the server over your tailnet. Pyo Cloud isn't in that path | | Without Tailscale | Pass through Pyo Cloud in flight. Pyo Cloud stores none of it | To keep Pyo Cloud out of that path, set up Tailscale and [move the server onto your tailnet](https://pyo.dev/docs/sandbox#move-a-server-onto-your-tailnet). Commands sent through [MCP](https://pyo.dev/docs/mcp) and Pyo's API go through Pyo Cloud on every server, as signed commands. What a breach could do: | Breached | What it could do | What it can't | | --- | --- | --- | | Pyo Cloud's own servers | Get commands signed for your sandbox servers, like creating a sandbox or running a command in one. It also carries terminal and file data in flight for servers without Tailscale | Reach into your tailnet. Use a server's key. Run a command the signing service didn't sign | | A sandbox server | Use that server's key: read that server's commands and send false reports for it | Act as another server, team or agent | | A stolen join code, for a server without Tailscale | Register a machine of their own as that server before yours does. Your server's join then fails. **Reset access** gives a new command | Use the code after your server joined. It works once | ## Teams are kept apart - Each team's data is kept apart in Pyo's database, so one team can never read another's. - Each team's environment variables are encrypted with the team's own key. See [Protecting secrets](https://pyo.dev/docs/encryption). - Builds run on your own servers, and images stay in your cluster's registry. - A team can't take a domain another team has proven it owns. See [Your own domains](https://pyo.dev/docs/cloud/differences#your-own-domains). ## What Pyo Cloud can and can't see | Pyo Cloud keeps | Stays on your servers | | --- | --- | | Your account, team and members | Your services and their data | | Project and service settings | Databases and volumes | | Environment variables, encrypted | Images and build cache | | Build logs, for 90 days | Backups, which go to your own bucket | | Analytics totals and metrics | Request logs and visitors' IP addresses | | Activity | Your Tailscale credentials | Pyo Cloud decrypts environment variables only when it deploys, to send them to your agent. Service logs and shells come from your servers live, when someone on your team opens them. A sandbox's terminal and file data stay between your devices and your sandbox server when it's on your tailnet. For a server without Tailscale they pass through Pyo Cloud, which stores none of it. See [Sandbox servers](#sandbox-servers). See [Data and analytics](https://pyo.dev/docs/cloud/data) for what analytics keep. --- # Server requirements What a server needs to connect to Pyo Cloud. ## Minimum - **System:** Linux on x86-64, with root or `sudo` access. A fresh server is best. - **Resources:** 2 CPU cores, 2 GB of memory and 40 GB of disk. - **Network:** outgoing HTTPS to `agent.pyo.dev`. Nothing needs to reach the server for Pyo Cloud. - **Ports:** 80 and 443 free, plus 6443 if k3s isn't installed yet. Only 80 and 443 need to be reachable from the internet, for your services. ## Sizes | Size | Good for | | --- | --- | | 2 cores, 2 GB, 40 GB | The minimum. A few small services. Builds are slower and there's little room for databases. | | 2 to 4 cores, 4 GB, 80 GB | Recommended. Services, a database or two, and builds on the same server. | | 4 cores or more, 8 GB or more | Many services, several databases and frequent builds. | ## What Pyo uses on your server On Pyo Cloud your servers run only the agent side of Pyo. Pyo's dashboard, API and database run on Pyo Cloud. On a server, Pyo uses about 1 GB of memory at rest: | Part | Memory | | --- | --- | | k3s and its container runtime | 500 to 700 MB | | [Pyo Gateway](https://pyo.dev/docs/gateway) | about 100 MB | | Certificates (cert-manager) | about 90 MB | | k3s's DNS, metrics and storage | about 80 MB | | Request logs and metrics (Vector) | about 30 MB | | The agent, builder, registry and small helpers | about 40 MB | | Database operators, once you have a database | about 90 MB | | Static sites' file server and store, once you have a static site | about 20 MB | On a 2 GB server, about 900 MB is left for your services and databases. A small database takes 128 MB of that, and a static site around 15 MB. Builds use more while they run. Their cache keeps up to 20 GB of disk, which is why 40 GB is the minimum. Pyo's parts use about a tenth of one core at rest. They ask k3s to keep 0.4 cores for them. ## More servers Connect more servers to spread the load. Each one is a cluster of its own until [several servers in a cluster](https://pyo.dev/docs/cloud/differences#tailscale) come to Pyo Cloud. Each server counts once on your bill, whatever it runs. --- # Connecting Cloudflare Let Pyo create the DNS records of your domains. When your domain's DNS is on [Cloudflare](https://www.cloudflare.com), Pyo can create the record for each domain you add to a service. There's nothing to copy and paste. ## Create the token In the Cloudflare dashboard, open **My Profile → API Tokens** and choose **Create Token**. Start from **Create Custom Token** and give it these permissions: | Type | Resource | Permission | | --- | --- | --- | | Zone | Zone | Read | | Zone | DNS | Edit | For [Cloudflare Tunnel](https://pyo.dev/docs/cloudflare-tunnel), add these too: | Type | Resource | Permission | | --- | --- | --- | | Zone | SSL and Certificates | Edit | | Account | Cloudflare Tunnel | Edit | Under **Zone Resources**, include only the zones Pyo may use, like `example.com`. Under **Account Resources**, include only the account they're in. Leave the rest as it is, then create the token and copy it. Cloudflare shows it once. ## Connect it Team owners and admins save the token on the **Cloudflare** card under **Integrations**, in the sidebar's **Team** section. Pyo checks it first: - It lists the zones the token can read. - In each zone, it makes and deletes a TXT record named `_pyo-check`, to check it can edit DNS there. - Once in each account, it makes and deletes a tunnel named `pyo-check-…`, and in each zone it reads the Origin CA certificates. That checks the tunnel permissions. The card shows the zones Pyo can use, and the permission it lacks in the others. Zones that can use Cloudflare Tunnel show in green, and zones without its permissions say **DNS only**. Choose **Test** to check again after you change the token in Cloudflare. **Replace** saves a new token, and **Remove** forgets it. Records Pyo made stay in Cloudflare when you remove it. A team with a Cloudflare Tunnel must remove the tunnel first. The token is stored encrypted, like your other keys, and never shown again. Members without the owner or admin role can't see or change it. Pyo only sends it to `https://api.cloudflare.com`. From the CLI: ```bash pyo cloudflare connect --token-file cloudflare-token.txt pyo cloudflare test pyo cloudflare zones pyo cloudflare remove ``` `connect` also reads the token from `CLOUDFLARE_API_TOKEN`, or from stdin with `--token-file -`. ## Adding a domain When a connected zone covers a domain you add, **Create the DNS record in Cloudflare** is on in the dialog. It's in the new service wizard too. Pyo picks the longest matching zone, so `shop.eu.example.com` goes to `eu.example.com` when you connected both. Pyo creates an A record that points to the cluster's public IP address, the same record it would ask you to create yourself. A cluster without a public IP address gets no record, and Pyo says so. Each record Pyo makes has the comment `Made by Pyo ()`. The domain's row on the service's **Domains** tab shows how its record stands: - **Record created:** Pyo made it. - **Record already there:** the name already pointed to the cluster. Pyo leaves that record alone. - **Cloudflare already has a record for it:** another A, AAAA or CNAME record has the name. Pyo never overwrites a record. It shows you what's there, and a team owner or admin can choose to replace it. Pyo then edits one of those records in place to point to the cluster and removes the others, so the name always answers. - An error, with Cloudflare's reason and **Try again**. When you remove the domain, Pyo offers to delete its record too. It only deletes a record it made, and only while that record still has its comment. While other [paths](https://pyo.dev/docs/domains#routes) still use the domain, the record stays. With the CLI, `pyo domain add` creates the record when a connected zone covers the hostname. Add `--no-cloudflare` to skip it, or `--proxied` to proxy it. `pyo domain dns ` tries again, with `--replace` to replace what's in the way. `pyo domain remove` deletes the record Pyo made, unless you add `--keep-dns-record`. ## Proxied by Cloudflare **Proxied by Cloudflare** is off by default. Turn it on to send visitors through Cloudflare's network. Pyo first creates the record without the proxy, so Let's Encrypt reaches your cluster directly to issue the certificate. Once the certificate is issued, Pyo turns the proxy on. Certificates renew through Cloudflare, so set these in Cloudflare under **SSL/TLS**: - **Encryption mode:** Full (strict). Your cluster has a valid certificate. - **Always Use HTTPS:** off. Pyo already sends visitors from HTTP to HTTPS, and Let's Encrypt checks your domain over plain HTTP. To see your visitors' own addresses and let only Cloudflare reach the service, turn on [Behind Cloudflare](https://pyo.dev/docs/firewall#behind-cloudflare) on the service's **Firewall** tab. ## Cloudflare Tunnel With the tunnel permissions, a cluster can take its websites in through [Cloudflare Tunnel](https://pyo.dev/docs/cloudflare-tunnel), with no open ports on its servers. Pyo makes the tunnel, its records and its certificate. ## Wildcard certificates Pyo's certificates are for one hostname each. For `*.example.com`, upload [your own certificate](https://pyo.dev/docs/certificates). A cluster's [preview domain](https://pyo.dev/docs/deploy/previews#preview-domain) is the exception. Pyo creates its wildcard record and certificate through Cloudflare. --- # Cloudflare Tunnel Take websites in through Cloudflare with no open ports on your servers. With Cloudflare Tunnel, your servers open no ports for websites. A small connector in your cluster dials out to Cloudflare, and Cloudflare sends your visitors through it to [Pyo Gateway](https://pyo.dev/docs/gateway). Pyo sets up the tunnel, its routes, the DNS records and the certificate for you. It also lets Pyo run on a server where another program already uses ports 80 and 443, like Traefik or nginx. ## What you need - Your domains in a Cloudflare account. - A [Cloudflare token](https://pyo.dev/docs/cloudflare#create-the-token) with these permissions: | Type | Resource | Permission | | --- | --- | --- | | Zone | Zone | Read | | Zone | DNS | Edit | | Zone | SSL and Certificates | Edit | | Account | Cloudflare Tunnel | Edit | - Your servers can reach Cloudflare on TCP port 7844. After you add the permissions in Cloudflare, choose **Test** on the **Cloudflare** card under **Integrations**. Zones that can use the tunnel show in green. A zone that lacks one of the two tunnel permissions says which one. A zone with neither is **DNS only**. ## Turn it on 1. Open your cluster's **Settings** and find **Traffic**. 2. Turn on **Cloudflare Tunnel**. 3. Pick a **default domain** if you want one. Services get names under it, like `web.example.com`. 4. Select **Turn on**. Pyo creates the tunnel and starts two connectors, on different servers when it can. Your domains stay where they are. Move them [one at a time](#move-one-domain), or all at once by [closing public ports](#close-public-ports). If the switch is greyed out, the cluster's agent can't run a tunnel yet, or its install is older than Pyo's. Run the command under **Refresh this cluster** in the cluster's settings, then try again. Team owners and admins change a cluster's traffic. It works the same on Pyo Cloud. Your Cloudflare token stays with Pyo, and your cluster only gets the tunnel's own token. On Pyo Cloud, run the command under **Refresh this cluster** once before you turn it on. ## Close public ports Turn off **Public ports** while the tunnel is on. Pyo moves the domains in your Cloudflare account to the tunnel first, and closes the ports once every one of them is on it. A domain waiting for **Replace and switch** holds the ports open until you decide. Domains outside your account stop answering from the internet. ## Move one domain On a service's **Domains** tab, select **Switch to Tunnel**. Pyo adds the tunnel's route first, then points the name at the tunnel with a proxied CNAME record. While the record moves, the domain answers both ways, through the tunnel and directly. Once Cloudflare sends visitors through the tunnel, Pyo Gateway only lets the tunnel in. A client that connects to your server directly gets a 403. Paths of the domain on other services, like `/api` on an API service, move with it. Pyo points the name at the tunnel only once every one of them answers through it. Switch back takes them back the same way. Hover the Cloudflare logo before the name to see the record it points at. To move it back, open the domain's menu and choose **Switch back from Tunnel**. The domain's own page has a **Switch back** button too. If Cloudflare already has a record for the name, Pyo shows it and asks before it replaces it. Pyo keeps a copy, so **Switch back** puts it back. Developers can switch a domain when nothing is in the way. Replacing a record, or putting one back, is for team owners and admins. Pyo edits the record at the name in place. It never deletes it first and then makes a new one, so DNS resolvers never get an empty answer to cache. When the name has several records, Pyo keeps one, removes the others, and then edits the kept one. Switch back edits Pyo's record back into yours, then makes your other records again. ### When the old way closes After the record moves, the old way keeps working until Cloudflare sends visitors through the tunnel. Pyo waits at least 90 seconds, or the old record's TTL plus 30 seconds when it wasn't proxied. Then it checks that a request to the name arrives through the tunnel, 3 times in a row, before it closes the old way. The check asks for `/.well-known/pyo-tunnel/…` on the name, like a visitor would. Through the tunnel, the connector answers it itself, so it never reaches your service, its logs or its analytics. Until Cloudflare follows, the check goes the old way, to the origin the old record pointed at. If Cloudflare still sends visitors the old way 15 minutes after the wait, the domain says so, and both ways stay open. Pyo keeps checking. Team owners and admins can select **Finish now** next to that line to close the old way at once. Visitors Cloudflare still sends the old way then get a 404. Use it too when the zone's security settings, like Bot Fight Mode or **Under Attack** mode, challenge the check. ```bash pyo domain tunnel app.example.com --finish ``` ### Switch back **Switch back** puts the record back first. The domain shows **Switching back**, and the tunnel keeps answering for the name until Cloudflare and DNS resolvers have the record: 90 seconds when the record put back is proxied, 5 and a half minutes when it isn't. After that, Pyo also waits until requests to the name no longer arrive through the tunnel. The domain's own certificate comes back as soon as the record is back: the one you uploaded, or a new one from Let's Encrypt. A domain that had no HTTPS before keeps the tunnel's certificate until it's off the tunnel. When you add a domain on a cluster with the tunnel on, you pick its path in the dialog and in the new service wizard. See [Traffic path](https://pyo.dev/docs/domains#traffic-path). ## Tunnel domains With a default domain, a cluster in tunnel mode gives each service a tunnel domain under it, like `web-shop.example.com`. Pyo makes one wildcard record, `*.example.com`, that points at the tunnel. Tunnel domains need no record of their own. A record you made for a name still comes first, so your existing sites aren't touched. A name under the default domain that no service has gets a 404. A name under the default domain always goes through the tunnel, so it has no **Switch back**. That goes for a tunnel domain and for a domain you add under it. Pyo refuses to move it back while the default domain covers it. The one exception is a name whose old record Pyo replaced. **Switch back** puts that record back, and it answers before the wildcard. Pyo checks the wildcard record every 2 minutes. When Pyo made it and it still points at an old tunnel, Pyo edits it in place to point at the current one. A wildcard someone else made stays as it is. The **Traffic** panel and `pyo cloudflare tunnel status` then say so, and your other domains keep moving to the tunnel. The default domain must be one of your zones itself, like `example.com`. Cloudflare's free certificate covers one level below a zone, so a name like `web.apps.example.com` wouldn't work. Without a default domain, a cluster in tunnel mode has no tunnel domains. Only domains you switch go through the tunnel. ## Move sites from Traefik with no downtime 1. Connect the server to Pyo. Turn on **Cloudflare Tunnel** for the cluster. 2. Deploy each site as a service in Pyo and add its domain. 3. Select **Switch to Tunnel** on the domain. Traefik keeps serving until Cloudflare points at the tunnel. 4. Check the site. If something's wrong, choose **Switch back from Tunnel** in the domain's menu. 5. When every site has moved, stop Traefik. ## Visitors Pyo Gateway takes the visitor's address only from the connectors. Firewall rules, rate limits, the WAF, country rules, analytics and the audit log all see the real visitor. A service doesn't need [Behind Cloudflare](https://pyo.dev/docs/firewall#behind-cloudflare) for its tunnel domains. Your service gets the visitor's address in `X-Forwarded-For`, as the only address there. While a domain is still moving, a client that connects directly shows up with its own address, whatever header it sent. Visitors who type `http://` are sent to HTTPS, whatever your zone's **Always Use HTTPS** says. ## TCP and UDP ports Cloudflare Tunnel carries websites only. Public TCP and UDP ports stay on your servers' public addresses, or on [Tailscale](https://pyo.dev/docs/tailscale). They don't go through the tunnel. To close them too, turn off **Publish TCP and UDP ports** under **Traffic** while public ports are off. ## Status The **Traffic** panel shows how the tunnel is doing: - **Tunnel connected**, with its connectors and Cloudflare's locations. - **Tunnel degraded**, when a connector is down. - **Tunnel down**, when no connector reaches Cloudflare. Its websites don't answer. Pyo sends an [alert](https://pyo.dev/docs/alerts) after 5 minutes. A connector that can't start says why, like `ImagePullBackOff`. Each domain on a service's **Domains** tab shows where it is: moving to the tunnel, on it, or **Switching back**. A domain that waits for Cloudflare's edge longer than 15 minutes says so there, with **Finish now**. From the CLI: ```bash pyo cloudflare tunnel status --cluster eu ``` ## Certificate and token Pyo issues a Cloudflare Origin CA certificate for the tunnel's names. Only cloudflared sees it. Your visitors see Cloudflare's own certificate. It's valid for 15 years, and Pyo issues a new one when a name it doesn't cover goes through the tunnel. It's listed under **Certificates** as **Cloudflare Tunnel**. The connector runs with the tunnel's own token, kept in your cluster. Pyo never sends your Cloudflare token to the cluster. **Rotate** gives the tunnel a new token and a new certificate. ## Cloudflare's limits - Uploads over 100 MB fail on the Free and Pro plans. - Cloudflare waits 100 seconds for a response to start. - WebSockets work. gRPC needs the zone's gRPC setting in Cloudflare. Don't change Pyo's tunnel in Cloudflare. Pyo puts its routes back. ## Turn it off Turn off **Cloudflare Tunnel** under **Traffic**. Pyo lists the domains it touches first. With public ports on, each domain switches back: the records Pyo replaced come back, or Pyo points the name at your server. Then Pyo deletes the tunnel, its certificate and only the records it made. Names under the default domain stop answering. With public ports off, the tunnel's domains stop answering. Deleting a service or a cluster cleans up its tunnel records the same way. From the CLI: ```bash pyo cloudflare tunnel on --cluster eu --default-domain example.com pyo domain tunnel blog.example.com pyo domain tunnel blog.example.com --replace pyo domain tunnel blog.example.com --finish pyo domain tunnel blog.example.com --back pyo cloudflare tunnel off --cluster eu pyo cloudflare tunnel remove --cluster eu pyo cloudflare tunnel rotate --cluster eu ``` --- # Connecting a cluster The groups of servers that run your services. A cluster is one or more servers running k3s. A team can have several, such as `production` and `staging`, all in one dashboard. ## The server Pyo runs on On a fresh install, the server Pyo runs on is connected for you as your first cluster, named after its hostname. Rename it in its **Settings** tab. ## Add a cluster Choose **Add cluster** to get a command that sets up k3s and the Pyo agent on a new machine: ```bash curl -fsSL https://pyo.dev/v/0.53.0/server.sh | bash -s -- connect pyoc1_eyJhcGkiOi... ``` Copy the command from the dashboard. It runs [`pyo-server`](https://pyo.dev/docs/pyo-server) with a token that carries Pyo's address for servers, the cluster's connect token, a single-use Tailscale key and the cluster's login to Pyo's registry. `pyo-server token show` prints it with the secrets hidden. The address in it is where the new machine reaches Pyo. It can differ from the address you use in your browser. It's Pyo's name on your tailnet, like `https://pyo.tail1234.ts.net`. Connecting a cluster needs [Tailscale](https://pyo.dev/docs/tailscale) set up in Pyo. The command carries a single-use key that joins the machine to your tailnet. A public address must use `https://`. Plain `http://` works only for a private network or tailnet address. The command works once, for an hour. If it expires, the cluster offers a new one. It asks for `sudo` when it needs root. The agent connects out to Pyo, so you don't have to open anything on the machine. If something on the machine already serves sites on ports 80 and 443, like nginx, ingress-nginx or k3s's Traefik, the command connects the cluster with [public traffic](#public-traffic) off, so those sites keep working. It leaves the machine's firewall as it is and says so in one line: ```text ● Ports 80 and 443 are in use by Traefik. Public traffic stays off, so your sites keep working. ``` Pyo installs its own cert-manager and Pyo Gateway. If the machine already runs cert-manager or Envoy Gateway that Pyo didn't install, the command stops before it changes anything. Pyo won't change them: ```text This server already runs cert-manager that Pyo didn't install. Pyo won't change it. Remove it, or connect a server without it. ``` Remove it and run the command again, or connect another server. Pyo can also make the cluster's first server at [Hetzner](https://pyo.dev/docs/hetzner). ## Inside a cluster Open a cluster from **Clusters**. Its tabs are: | Tab | What it shows | | --- | --- | | Overview | Its state at a glance | | Servers | The machines in it | | Workloads | Everything running, down to the server it's on. See [Workloads](#workloads) | | Networking | HTTP routes and ports | | Storage | Volumes and storage classes | | Settings | Its details, public traffic, free domains, how traffic is routed, mTLS, its connection and removal | ### Workloads The **Workloads** tab opens on your team's **Services**, with their project, kind, status, CPU and memory. Switch to **System** to see what Pyo and the cluster run themselves. Each part is one row, with its replicas, CPU and memory added up and the worst status among them: | Part | What it is | | --- | --- | | Agent | The Pyo agent that runs the cluster for Pyo | | Builds | Builders and Pyo's registry | | Databases | What runs your databases | | Gateway | [Pyo Gateway](https://pyo.dev/docs/gateway), certificates, the WAF and static sites | | Logs | What collects request logs, analytics and metrics | | Pyo | Pyo itself, on the server it runs on | | Cluster | Everything else the cluster runs, like k3s's DNS | ## Traffic [#public-traffic] Traffic reaches your cluster's websites on up to three paths. Turn each on or off under **Settings › Traffic**. A cluster always keeps one on. Until Tailscale is set up, the card links to **Integrations**. - **Public ports**: ports 80 and 443 on every server except [build-only servers](https://pyo.dev/docs/builders#where-a-builder-can-run). Point your domains at any of them. Every server runs [Pyo Gateway](https://pyo.dev/docs/gateway) there, with your public TCP and UDP ports. With public ports off, **Publish TCP and UDP ports** keeps your services' TCP and UDP ports on the servers. - **Cloudflare Tunnel**: websites through Cloudflare, with no open ports. See [Cloudflare Tunnel](https://pyo.dev/docs/cloudflare-tunnel). - **Tailscale**: websites on ts.net names and on your servers' Tailscale addresses. Servers stay on your tailnet when it's off. See [Tailscale switch](https://pyo.dev/docs/tailscale#tailscale-switch). Each domain takes one path. When you turn off a path that domains use, Pyo lists them first. A domain whose path is off shows **Not served** and keeps its settings. Turn the path on again to serve it. With public ports off, services keep running without a restart. They still reach each other inside the cluster on all their ports. On the server Pyo runs on, the dashboard and registry stay reachable over your [tailnet](https://pyo.dev/docs/tailscale). Let's Encrypt can't renew certificates over HTTP until public ports are back on. If another program in the cluster still holds ports 80 and 443 on a server, like k3s's Traefik, the gateway can't get them there. The cluster's **Networking** tab and its setup checklist then say `Ports 80 and 443 are in use on `, and so does `pyo status`. Your services' sites don't answer on that server until you stop that program. The gateway takes the ports once they're free. Or use **Cloudflare Tunnel**, which needs neither port. Pyo doesn't check whether a server can be reached from the internet. A server with only a private or tailnet address runs the gateway too. It answers anyone who can reach that address. Team owners and admins can change it, and each change is recorded in **Activity**. ## Refresh a cluster A cluster's **Settings** tab shows the command under **Refresh this cluster**. Run it on the cluster's first server to apply Pyo's latest host settings, like the [memory reserve for k3s](https://pyo.dev/docs/system-reference#k3s): ```bash curl -fsSL https://your-pyo/install/server.sh | bash -s -- connect ``` The dashboard fills in your Pyo's address. `connect` without a token reads Pyo's address and the agent's token from the agent already there. On a server that has `pyo-server` already, `sudo pyo-server connect` does the same. On the server Pyo runs on, the command is `curl -fsSL http://127.0.0.1:8000/install/connect.sh | bash`. After some updates, a cluster shows **Update needed** until you run this command. The server Pyo runs on runs it by itself after an update. If the update moves your databases to new images, the panel says **Restarts your databases once**. See [Refresh a cluster after an update](https://pyo.dev/docs/updating-pyo#refresh-a-cluster-after-an-update). ## Reconnecting Rotating a cluster's token from its **Settings** tab stops the current token from working. Run the new command to reconnect the agent. ## Disconnecting **Remove cluster**, on its **Settings** tab, deletes nothing on the cluster. Its servers leave your tailnet, as in [Removing a cluster](https://pyo.dev/docs/tailscale#removing-a-cluster). To also remove what Pyo put into it, see [Disconnect a cluster](https://pyo.dev/docs/uninstall#disconnect-a-cluster). Pyo removes a cluster once its services are deleted or moved. If a cluster has been unreachable for 10 minutes, you can remove it with its services. Choose **Remove anyway** and confirm. Pyo forgets the cluster and its services, databases and volumes. Anything still running there is left alone. ## High availability Extra servers only run services, so a cluster has one main server. If that server goes down, services on other servers keep running. Deploys and rescheduling stop until it's back. --- # Core concepts The few things you need to know to use Pyo. ## Teams Everything in Pyo belongs to a team. Invite people as owners, admins, developers or viewers. See [Inviting your team](https://pyo.dev/docs/teams). ## Projects A project groups related services, like a website with its API and database. Services in a project share a Kubernetes namespace, so they can reach each other by name. New projects are [isolated](https://pyo.dev/docs/network-isolation): other projects' services can't reach them. ## Services A service is one thing you run, like a website, an API, a database or a background worker. It comes from a Git repository, a container image or a template. ## Deployments A deployment is one build and rollout of a service. Pyo keeps the history, so you can see what ran when and go back to an earlier version. ## Clusters and servers A cluster is a group of servers running k3s. A team can have [several](https://pyo.dev/docs/clusters), for example `production` and `staging`. Each cluster runs an agent that connects out to Pyo, so you don't have to open anything on the server for Pyo to reach it. See [how Pyo fits together](/architecture). ## Replicas A replica is one running copy of a service. More replicas handle more traffic, and they can run on different servers. See [Scaling a service](https://pyo.dev/docs/scaling). --- # Databases Postgres or MySQL with failover, or Redis-compatible KV, run on your own servers. Pyo can run databases for you on your clusters: **Postgres**, **MySQL** or **KV**. KV is a Redis-compatible key-value store. It runs Valkey, which works with Redis clients. A database belongs to your team, not to one project, so any of the team's services on the same cluster can use it. | Engine | High availability | Read replicas | Connection pooler | Backups | REST API | | --- | --- | --- | --- | --- | --- | | Postgres | Yes | Yes | Yes | Point-in-time recovery | No | | MySQL | Yes | No | No | Point-in-time recovery, up to the latest backup | No | | KV | Yes | Yes | No | Scheduled snapshots | Yes | Databases are built into Pyo. The first database on a cluster sets them up there, which takes a minute or two. Until then, its status says **Setting up databases on this cluster**. Pyo keeps them up to date when it updates itself. If the cluster already runs CloudNativePG or a MySQL operator that Pyo didn't install, Pyo doesn't set up databases there, and doesn't change it. The database says so. Remove it, or make the database on another cluster. ## Create a database Open **Databases** in the sidebar, then **Postgres**, **MySQL** or **KV**. Choose **New database** and pick: - **Engine:** the one you opened, or switch to **Postgres**, **MySQL** or **KV**. - **Name** and **Cluster:** any of your connected clusters. - **Size**, per instance: | Size | CPU | Memory | Set aside | Storage | | --- | --- | --- | --- | --- | | Small | 0.25 | 512 MiB | 128 MiB | 5 GiB | | Medium | 0.5 | 1 GiB | 1 GiB | 10 GiB | | Large | 1 | 2 GiB | 2 GiB | 20 GiB | | X-Large | 2 | 4 GiB | 4 GiB | 50 GiB | **Memory** is the most an instance can use. **Set aside** is what the server keeps free for it, so it fits where there's that much room. A small database at rest holds 60 to 100 MiB, so it sets aside 128 MiB and uses more as it needs, up to 512 MiB, while the server has it free. Custom sizes set aside all their memory. MySQL needs at least 1 GiB of memory, so it starts at **Medium**. - **Availability:** **Single server** has no automatic failover. **High availability** runs a primary and some **Replicas**. A replica takes over when the primary's server is lost. Postgres can have 2 to 8 replicas, KV 2 to 4 and MySQL 2 or 4. The default is 2. 2 replicas are enough for failover. More only help if your service reads from the **Replicas** address, shown on the database's **Overview**. Each replica keeps a full copy of the data, and for KV that copy is in memory. Replicas spread across your servers only as far as there are servers to spread to. - **Connection pooler** (Postgres, on by default): many client connections share a few connections to the database, through PgBouncer. See [the pooler](#the-pooler). - **REST API** (KV, off by default): Redis commands over HTTP, for serverless and edge code. Developers and up can create a database. It's ready in a minute or two and starts empty. To fill it from another database or a dump file, choose **Import** at the top right instead. See [import data](#import-data). To make one from a database's backups, use its [**Restore…**](#restore). ## Import data You can copy data into a Postgres or MySQL database from another database, or from a dump file. Moving from another provider? See [migrating a database](https://pyo.dev/docs/migrating). To open the **Import** page, choose **New → Import database**, or **Import** at the top right of **New database**. From a database, **⋯ → Import…** opens it with that database already picked. Then pick: - **Engine:** **Postgres** or **MySQL**. - **From:** a **Connection URL** or a **Dump file** (see below). - **Into:** a **New database** or an **Existing database**. For a new one, set its name and cluster, with size and availability under **Options**. Pyo creates it, then fills it. An existing database must be empty. Pyo checks it first and refuses one that has tables, views, functions, routines or events. Databases Pyo knows aren't empty are marked **Not empty**. With a URL, **Check connection** runs the checks below without importing. **Import** starts the import and opens the database, which shows its progress. The source: - **Connection URL:** the database to copy, like `postgres://user:password@host:5432/database` or `mysql://user:password@host:3306/database`. It must accept connections from your cluster's servers. For TLS, add `?sslmode=require`, or `verify-ca` or `verify-full`. MySQL URLs also take `ssl-mode=REQUIRED`. Pyo copies only the database the URL names. - **Dump file:** for Postgres, a `.sql`, `.sql.gz` or custom-format `.dump` (`pg_dump -Fc`). For MySQL, a `.sql` or `.sql.gz` (`mysqldump`). The file is uploaded to Pyo and kept until the import succeeds, or for 24 hours, then deleted. Files can be up to 10 GiB. The installation sets both limits with `PYO_DATABASE_IMPORT_MAX_BYTES` and `PYO_DATABASE_IMPORT_RETENTION_HOURS`. Uploads need Pyo's built-in store, but the database itself can be on any cluster. The dashboard and `pyo db import --file` send the file in parts of 16 MiB, so no request is bigger than a proxy in front of Pyo takes, like Cloudflare's 100 MB. A part that fails is sent again, and the upload goes on from there. Through the API, send the parts with [`uploadDatabaseDumpPart`](https://pyo.dev/docs/api/reference/databases/upload-database-dump-part), then finish with [`completeDatabaseDumpUpload`](https://pyo.dev/docs/api/reference/databases/complete-database-dump-upload). ### What's checked first Before anything is created or copied, your cluster connects to the source and to the database you import into. You get a clear error when the source: - can't be found or reached - refuses the user and password - requires TLS, or doesn't offer it - doesn't have the database - has tables its user can't read Postgres also checks: - **Version:** the source must not be newer than the database it goes into, and at most Postgres 18. A new database gets the newest version unless you pick one. - **Extensions:** the ones Pyo turns on for you, like `vector` or `pg_cron`, are turned on first. The ones the database's role can add, like `citext` or `pgcrypto`, are created by the import. If Pyo's Postgres doesn't have an extension, the error names it. Drop it from the source, then import. A dump file gives less to check. Pyo reads the version it was dumped from and the extensions it creates from the start of the file. MySQL sources can be MySQL 5.7 to 8.4. MariaDB isn't supported. ### What's copied **Postgres:** tables and their data, views, functions, triggers, sequences, schemas, comments and extensions. Owners and privileges aren't copied. Everything belongs to the database's own role. A new database copied from a URL is filled by CloudNativePG's import as it's created. Otherwise Pyo loads `pg_dump`'s output, or your file, in a single transaction, so a failed import leaves nothing behind. Publications, subscriptions and security labels are left out. **MySQL:** tables and their data, views, routines, triggers and events, through `mysqldump --single-transaction --routines --triggers --events`. `DEFINER` clauses are removed, so the database's own user becomes the definer. Statements only an administrator may run, like `SET @@GLOBAL.GTID_PURGED` and `SQL_LOG_BIN`, are skipped. A dump made with `--databases` or `--all-databases` loads into this one database. If the import fails, Pyo removes what was loaded. The source's users and roles aren't copied. Services connect with the database's own login. ### Progress While the import runs, the database's status is **Importing…** and its **Overview** shows the current step. Its output is in the **Logs** tab, under **Import**. The team's activity shows when it started, finished or failed. If it fails, the **Overview** says why: - **A new database:** nothing is kept. Choose **Retry** to run it again from the same source, or delete the database. Deletion protection doesn't block deleting a database whose import failed. - **An existing database:** it's left empty and usable. Retry, or start another import. **Retry** reuses the source. The URL's password is kept encrypted until the import succeeds. An uploaded file can be retried for as long as it's kept. To change the URL, start a new import. Team owners and admins can import. The source's password is encrypted with the team's key. It reaches the cluster only while the import runs, and is removed afterwards. ## Inside a database A database's page has these tabs: | Tab | What it shows | | --- | --- | | Overview | Its state, engine, size, ready instances, the current primary, failovers, and its addresses inside the cluster | | Connect | The services it's connected to, and its connection details | | Logs | Its [logs and events](#logs-and-events) | | Backups | Postgres and MySQL: [backups and restoring](#backups-and-point-in-time-recovery). KV: [scheduled snapshots](#kv-backups) | | Extensions | Postgres: its [extensions](#extensions). KV: its [modules](#kv-modules) | | Settings | Size, storage, availability, the pooler or REST API, read replicas (not MySQL), and deletion protection | A database is only reachable from inside its cluster, by the services running there. ## Connect it to a service On the **Connect** tab, pick a service and connect it. The service must run on the same cluster. Pyo adds the connection variables to the service as [secrets](https://pyo.dev/docs/encryption): | Engine | Variables | | --- | --- | | Postgres | `DATABASE_URL`, through the pooler when it's on, and `DATABASE_URL_DIRECT`, straight to the database, plus `DATABASE_URL_READ` with [read replicas](#read-replicas) on | | MySQL | `DATABASE_URL` (`mysql://`), `MYSQL_HOST`, `MYSQL_PORT`, `MYSQL_USER`, `MYSQL_PASSWORD` and `MYSQL_DATABASE`, all to the primary. See [MySQL](#mysql) | | KV | `REDIS_URL`, through [Pyo's endpoint](#kv-redis_url), plus `KV_REST_API_URL`, `KV_REST_API_TOKEN` and `KV_REST_API_READ_ONLY_TOKEN` with [the REST API](#kv-rest-api) on | They take effect on the service's next deploy, so redeploy it. If the service already has one of these variables, rename or remove it first. Disconnecting removes them, also on the next deploy. Two databases can add the same variable. Postgres and MySQL both add `DATABASE_URL`, for example. To connect a service to both, give the second one a **Prefix**. With `MYSQL`, its variables become `MYSQL_DATABASE_URL`, `MYSQL_HOST` and so on. The **Connection details** show the user and database name. Only team owners and admins can reveal the password and tokens. ### KV: `REDIS_URL` A KV database's `REDIS_URL` goes through Pyo's endpoint, which runs on two servers: - It follows a failover within seconds, so clients need no Sentinel support. - With [read replicas](#read-replicas), it sends reads to them. Each connection still reads its own writes. - Transactions, pub/sub and blocking commands work. After a failover, pub/sub connections reconnect. Messages published during the switch are lost. - `WAIT` works, but more slowly. - Admin commands are refused: `CONFIG`, `MONITOR`, `CLIENT TRACKING`, `REPLICAOF`, `ACL` and the like. ### KV: REST API With the REST API on, `KV_REST_API_URL` takes Redis commands over HTTP. Send the token as `Authorization: Bearer `: ```sh curl "$KV_REST_API_URL" -H "Authorization: Bearer $KV_REST_API_TOKEN" -d '["SET", "my-key", "hello"]' curl "$KV_REST_API_URL/get/my-key" -H "Authorization: Bearer $KV_REST_API_TOKEN" ``` | Request | Body | Runs | | --- | --- | --- | | `POST /` | `["SET", "my-key", "hello"]` | One command | | `GET /get/my-key`, `GET /set/my-key/hello?EX=60` | None, or for `POST` the last argument | One command, from the path and then the query | | `POST /pipeline` | `[["INCR", "n"], ["GET", "n"]]` | Several commands, one reply each | | `POST /multi-exec` | The same | Several commands, as a transaction | The reply is `{"result": ...}`, or `{"error": "..."}` with status 400. `KV_REST_API_READ_ONLY_TOKEN` only runs reads. A write with it gets `NOPERM`. Commands that change the connection's state, admin commands and `MULTI` are refused. Use `/multi-exec` for transactions. ### The pooler The pooler supports prepared statements, so ORMs like Prisma work through `DATABASE_URL`. Use `DATABASE_URL_DIRECT` for migrations, and for features that need their own session, like `LISTEN`/`NOTIFY` and advisory locks. ## Change it On the **Settings** tab, you can: - change the size - add storage, up to 1,000 GiB (storage can only grow) - switch between a single server and high availability - turn the pooler or the REST API on or off Connected services pick up changed variables on their next deploy. ## Restarts for updates An update of Pyo can restart a database once, to move it to a new image. Pyo says **Restarts your databases once** before it does, and records each restart in **Activity**. See [When databases restart](https://pyo.dev/docs/updating-pyo#when-databases-restart). ## Extensions A Postgres database's **Extensions** tab lists the extensions it can use. Under **Extensions**, Pyo turns each one on or off for you with its checkbox. These need a library loaded at start, extra settings, or more rights than the database's own role has. | Extension | What it does | | --- | --- | | `auto_explain` | Logs the plan of every query that takes over a second | | `pg_cron` | Runs SQL on a schedule, inside the database. The database's role can schedule jobs | | `pg_hint_plan` | Steers the query planner with hints in SQL comments | | `pg_partman_bgw` | Runs pg_partman's partition maintenance every hour, as the database's role. Add `pg_partman` itself with `CREATE EXTENSION` | | `pg_stat_statements` | Tracks statistics of every query | | `pgaudit` | Writes an audit trail of schema and role changes to the logs | | `timescaledb` | Time-series tables and functions, limited to TimescaleDB's Apache 2 Edition features | | `vector` | Vector similarity search (pgvector) | | `postgres_fdw`, `dblink` | Query other Postgres databases | | `bloom`, `earthdistance`, `pg_prewarm`, `pgrowlocks`, `sslinfo`, `xml2` and a few more | Smaller extensions that need more rights than the database's role | - **Restarts:** the ones that load a library (`auto_explain`, `pg_cron`, `pg_hint_plan`, `pg_partman_bgw`, `pg_stat_statements`, `pgaudit`, `timescaledb`) restart the database when you turn them on or off. The dashboard asks first. With high availability, the instances restart one at a time and the primary hands over to a replica, so the database stays available. A single server is unavailable for a moment. - **Turning one off** drops it (`DROP EXTENSION`) along with what belongs to it, such as `pg_cron`'s scheduled jobs. If anything else in the database depends on it, like a column of type `vector`, Postgres refuses. Nothing is dropped, and the tab tells you. Drop or change what depends on it first, then turn it off again. - Each extension's status shows whether it's on or waiting for a restart. If it couldn't be turned on or off, the status says why. **Additional extensions** are ones the database's own role can add. Connect with its credentials and run `CREATE EXTENSION`, for example `CREATE EXTENSION pg_trgm;`. They include `btree_gin`, `btree_gist`, `citext`, `cube`, `fuzzystrmatch`, `hstore`, `intarray`, `isn`, `lo`, `ltree`, `pg_partman`, `pg_trgm`, `pgcrypto`, `seg`, `tablefunc`, `tcn`, `unaccent` and `uuid-ossp`. [Templates](https://pyo.dev/docs/templates) can turn extensions on for the databases they make. Obsolete extensions (`intagg`, `refint`) are listed only while a database has them on. ### KV modules A KV database's **Extensions** tab lists the official Valkey modules. They need KV 8.1. | Module | What it does | | --- | --- | | `valkey-json` | JSON documents, read and changed by path: `JSON.SET`, `JSON.GET` | | `valkey-bloom` | Bloom filters: `BF.ADD`, `BF.EXISTS` | | `valkey-search` | Vector similarity search over hashes and JSON documents: `FT.CREATE`, `FT.SEARCH` | - **Restarts:** turning a module on or off restarts the database. Read replicas and replicas restart first, then the primary hands over to a replica. Writes pause for about a second during the handover. The few writes in flight fail with `READONLY`, so retry them. A single server is unavailable for a moment. - **Reads:** module reads such as `JSON.GET` and `BF.EXISTS` go to the read replicas, like other reads. `FT.SEARCH` always runs on the primary. - **Turning one off** waits until the database has none of the module's data: JSON documents, Bloom filters or Search indexes. Until you delete them, the module stays on and the tab shows how many are left. - A module that's off answers the way Valkey does, with `ERR unknown command`. ## Logs and events The **Logs** tab shows the output of every part of the database: the primary, replicas, read replicas, poolers, an [import](#import-data), and for KV the sentinels and the endpoint (**Proxy**). It shows new lines live. To look back, pick a time range, up to the last 24 hours. Filter by member, level or text. Postgres lines show their level and message. Click one to see its full record. MySQL lines show the level from its error log. **Events** lists what happened to the database, newest first: failovers, members becoming ready or not, backups, restores, imports and changes. The **Failovers** count on the **Overview** opens it. Everyone in the team can see a database's logs and events. ## MySQL MySQL databases run MySQL 8.4, with the user `app` and the database `app`. - **Size:** Medium and up, since MySQL needs at least 1 GiB of memory per instance. A custom size starts at 1,024 MiB. - **Availability:** a single server, or high availability with 2 or 4 replicas (3 or 5 instances). A replica takes over within seconds when the primary stops. If the primary's server stops answering, it takes about two minutes. Either way, no confirmed writes are lost. The instance count can only grow: from 1 to 3 or 5, or from 3 to 5. - **Connect:** services get these variables: | Variable | Value | | --- | --- | | `DATABASE_URL` | `mysql://app:@-primary..svc.cluster.local:3306/app` | | `MYSQL_HOST` | `-primary..svc.cluster.local` | | `MYSQL_PORT` | `3306` | | `MYSQL_USER` | `app` | | `MYSQL_PASSWORD` | Its password | | `MYSQL_DATABASE` | `app` | - **Backups:** a full backup daily, uploaded with every change since the last one. You can restore to any moment up to the latest backup, into a new database. How often it's backed up sets how much data you could lose. Backups are kept for the number of days you choose, in your team's folder with its other database backups. See [backups](#backups-and-point-in-time-recovery). - **Limits:** there's no connection pooler, no read replicas and no read-only address. Every connection goes to the primary. The [WordPress](https://pyo.dev/templates/wordpress) and [Ghost](https://pyo.dev/templates/ghost) templates use a MySQL database. When you deploy one, you pick one of your team's databases or Pyo creates a new one, then connects it. ## Read replicas Read replicas are extra copies of a database that only serve reads. They take load off the primary. They never become the primary, so they don't add failover. Use **High availability** for that. Turn them on in the **Read replicas** card on the **Settings** tab and pick how many: 1 to 5 for Postgres, 1 to 4 for KV. MySQL doesn't have read replicas. Each one is the same size as the database. The **Overview** shows them as their own group, with the server each one runs on and how far it's behind the primary. For Postgres, connected services get `DATABASE_URL_READ` on their next deploy, through the read replicas' own pooler. Point your read-only queries at it and keep writes on `DATABASE_URL`. Read replicas can lag a little behind the primary. If a read must see a write you just made, use `DATABASE_URL` for it too. Turning read replicas off removes the variable on the services' next deploy. For KV there's nothing to change. `REDIS_URL` [sends reads to them](#kv-redis_url) automatically. With read replicas on, a KV database's REST API also spreads reads automatically. Read-only commands go to a read replica that's healthy and less than a second behind. Writes, transactions and pipelines that mix reads and writes go to the primary. To read something you just wrote, send the header `Pyo-Read-From: primary`. The `Pyo-Served-By` header in each response says which one answered. ## Delete it Deletion protection is on for every new database. While it's on, the database can't be deleted. Team owners and admins can turn it off under **Danger zone**, on the **Settings** tab. A database can't be deleted while services are connected to it, so disconnect them first. Deleting it removes its data for good. ## Backups and point-in-time recovery You can back up Postgres and MySQL databases and restore them to a point in time. Postgres can go back to any moment up to now. MySQL can go back to any moment up to its latest backup. For KV, see [KV backups](#kv-backups). Turn backups on in the database's **Backups** tab. They go where your team's [backups](https://pyo.dev/docs/backups) go, so set that up first under **Backups**, in the sidebar's Infrastructure section. That's an S3-compatible bucket, or Pyo's built-in store, which only works for databases on the cluster Pyo itself runs on. Postgres archives every change as it happens, plus a full backup once a day at the hour you pick (UTC, 3:00 by default). MySQL takes a full backup once a day at the hour you pick, and uploads the changes since the last one with it. A restore reaches the latest backup, not the last second. For both, choose how long to keep backups, from 1 to 90 days (7 by default). Older backups are deleted, except what's still needed to restore to any moment in those days. They're stored in your team's folder at the destination, under `databases///`. If the destination has a prefix, this path comes after it. Pyo doesn't encrypt these backups itself, so use a bucket that encrypts what it stores if you need that. The tab shows: - the window you can restore to, from the oldest moment the backups cover to now (for MySQL, to its latest backup) - when the last full backup and the last archived change happened - what went wrong, if the last backup failed ### Restore On the database's **Backups** tab, choose **Restore…**. Name the new database, and pick **Latest** or a moment in the window, in your local time. Pyo creates a new database on the same cluster, with the same size and availability, and fills it from the backups. The original stays as it is, so a restore never overwrites anything. The new database is ready in a few minutes. Its **Overview** shows which database it was restored from, and to what moment. Developers and up can turn backups on or off, change their settings, and restore. ## KV backups KV databases get a snapshot of their data on a schedule. Turn it on in the database's **Backups** tab. Pick **Daily** or **Weekly**, the hour (UTC, 2:00 by default) and how many snapshots to keep (14 by default). They go where your team's [backups](https://pyo.dev/docs/backups) go, with the same rules as Postgres. Pyo already has the database's login, so there's nothing else to enter. The database is listed under **Backups** with the team's other databases, marked **KV**. Its tab shows the recent snapshots and lets you back up now. Turning backups off pauses them. Deleting the database stops them, and its snapshots stay in the repository. Pyo can't restore a KV snapshot for you yet. Each one is a standard restic snapshot holding a `dump.rdb`, so you can [get it with restic](https://pyo.dev/docs/backups). Developers and up can turn KV backups on or off and change their schedule. --- # Deploying a service Deploy from Git, a container image or a template. ## From Git Connect a repository and Pyo builds it on one of your builders. Paste the repository's URL as you have it. `github.com/acme/web`, `https://gitlab.com/acme/web.git` and SSH forms like `git@github.com:acme/web.git` all work. A GitLab URL with `/-/tree/` picks that branch too. Leave the branch empty to build the repository's default branch, like `main`, `master` or `trunk`. - **Zero config:** with no Dockerfile, Pyo detects your framework and builds it. - **Static sites:** plain HTML or a built frontend, like Vite or Astro. See [Static sites](https://pyo.dev/docs/deploy/static-sites). - **Dockerfile:** if you have one, Pyo uses it. You can set the Dockerfile path, the build context and build arguments. ## Deploy on every push [Connect GitHub](https://pyo.dev/docs/github), and each push to a service's branch deploys it. This works for private repositories too. You can turn it off per service. Each pull request can also get its own [preview](https://pyo.dev/docs/deploy/previews). ## From a container image Run any image by name, such as `ghcr.io/acme/api:1.2`. For private images, save a [registry login](https://pyo.dev/docs/registries) first. Each deploy looks the tag up in its registry and runs the digest it points to now. A tag you push again is pulled on the next deploy, and a server's older image under that tag never runs. Restarts and new replicas run the same digest. To deploy another tag or a digest from CI, see [Deploy a tag or digest](https://pyo.dev/docs/cli/ci#deploy-a-tag-or-digest). Pyo picks the port from the image's `EXPOSE` when it would otherwise have to guess, and sets the health check to match. It reads public images only. For a private image, or a registry that's slow to answer, check the port before you deploy. ## From Docker Compose Import a Compose file as a project, with a service for each Compose service. See [Importing Docker Compose](https://pyo.dev/docs/deploy/compose). ## From a template Pick a template and Pyo fills in the defaults. See [Deploying a template](https://pyo.dev/docs/templates). ## From another platform Bring your services over from Coolify, Dokploy, Railway or Vercel, with their variables, domains and databases. See [Importing from another platform](https://pyo.dev/docs/import-platforms). ## Build machines Git builds run on a [builder](https://pyo.dev/docs/builders). A builder runs on a server in your cluster or on a dedicated build server. ## Cancel or retry The service's **Deployments** tab lists its deployments. Open one to see its status and logs. You can cancel a running deployment or retry a failed one from its row. ## Health checks A health check tells Pyo when a new version is ready. It can be an HTTP path, a TCP port or a command. Traffic only moves to the new version once the check passes. With **None**, deploys don't wait for it to be ready. For a service from Git, Pyo picks the check until you change it. A [static site](https://pyo.dev/docs/deploy/static-sites#health-check) gets a check of `/`. ## A service's addresses A service's **Overview** shows where it can be reached: - **Public:** its servers' public addresses. Point a domain's DNS at one of these. - **Tailscale:** its servers' Tailscale addresses, for devices on your tailnet. - **Internal:** the name other services in the project use to reach it, like `api:8080`. Choose **+N** to see them all, including the longer internal name for services in other projects. --- # Importing Docker Compose Turn a Compose file into a Pyo project, and keep the project in line with the file. If your project already runs with Docker Compose, Pyo can import the file. Each Compose service becomes a Pyo service in a new project. You review the result before anything is created. After the import, the same file can change the project. See [Sync a file again](#sync-a-file-again). ## Import a file ### From the dashboard 1. Choose **Deploy new**, then **Docker Compose** under **Import from**. 2. Under **Where the file is**, choose **Paste or upload** and add your `compose.yaml`, and its `.env` if it has one. Or choose **Repository**, then pick a repository, a branch and the file's path. 3. Pick the **Cluster** to run on, then choose **Preview**. ### From the CLI ```bash pyo deploy -f compose.yml ``` The CLI reads the `.env` next to the file. It shows what it will create and what it leaves out, then asks before it deploys. Add `--team` or `--cluster` to choose where it goes. Add `--yes` to skip the question, for example in [CI](https://pyo.dev/docs/cli/ci). ### From the API or MCP Send the file to [Preview a Docker Compose import](https://pyo.dev/docs/api/reference/projects/preview-compose) to see the plan. Then create the project with [Import Docker Compose](https://pyo.dev/docs/api/reference/projects/import-compose). AI assistants use the `preview_compose` and `import_compose` [tools](https://pyo.dev/docs/mcp/tools). ## Review the import The preview shows the project and each service, with what changed and what was left out. Before you deploy, you can change: - the project's name - each service's name - which ports are public - the domain for each public web port Choose **Deploy** to create the project and deploy its services. Nothing is created from the file until then. ## What converts | In Compose | In Pyo | | --- | --- | | `image` | The service runs that image. | | `build` | Pyo builds it from the repository. This needs an import from a repository. | | `ports` | A published port becomes public. A web port gets a suggested domain. Other ports become public TCP or UDP ports through the gateway. A [reserved port](https://pyo.dev/docs/domains#public-tcp-and-udp-ports) stays inside the project, with a warning. Ports that only other services use stay inside the project. | | Database images | Well-known images like PostgreSQL, MySQL, Redis and MongoDB get their usual port, even if the file doesn't list it. | | `environment`, `env_file` | [Environment variables](https://pyo.dev/docs/deploy/environment). `${VARIABLE}` and `${VARIABLE:-default}` are filled in from the `.env` file. | | Secret-looking variables | Names like `PASSWORD`, `TOKEN` or `API_KEY` become secrets, encrypted like any other secret. | | Service names | Kept, so `db:5432` still reaches the database. Underscores become hyphens, and other services' variables are updated to match. | | Named and anonymous volumes | [Volumes](https://pyo.dev/docs/volumes), 10 GB each. | | A bind-mounted directory, like `./data` | An empty volume. Its files aren't copied. | | `healthcheck` | The service's health check. Without one, Pyo checks its first port. | | `deploy` | Replicas, CPU and memory, and [GPUs](https://pyo.dev/docs/gpus). | | `entrypoint`, `command`, `working_dir` | How the service starts. | | `user` | A numeric user, like `1000` or `1000:1000`. | | `depends_on` | The order services deploy in. | ## What doesn't Pyo imports the rest of the file and tells you what it left out on each service. One unsupported setting never stops the import. - **Files from the host:** files in a bind-mounted directory aren't copied. Paths outside the project folder, like `/etc/app`, aren't mounted. - **Single-file mounts**, like a config file: build the file into the image, or put its content in a variable. - **The Docker socket:** Pyo doesn't run Docker on its servers. - **Extra rights:** privileged mode, the host's network or processes, devices, added capabilities and security options aren't applied. GPUs are the exception. Ask for them under `deploy.resources`. - **`extends` and `include`:** copy the settings into the file itself. - **Compose `secrets` and `configs`:** use secrets instead. - **Services in a profile** aren't imported, since Compose doesn't start them by default. - **Build targets and build secrets:** Pyo ignores them and builds the Dockerfile's last stage. - **A build without a repository:** a pasted file can't be built. A service that also has an image uses that image. A service with only a build is left out. Import from the repository to build it. - **Shared volumes:** a volume belongs to one service in Pyo. It stays with the first service that uses it. > Variables that aren't set in the `.env` are left empty. Fill them in on the services before you deploy. ## Pyo settings in the file Some settings have no field in Compose. Set them under `x-pyo` on a service. Docker Compose ignores keys that start with `x-`, so the file still works with Docker. | Key | What it sets | | --- | --- | | `domains` | The service's [domains](https://pyo.dev/docs/domains), as a list. They're served on its first web port, which becomes public. `app.example.com/api` serves only that [path](https://pyo.dev/docs/domains#routes). | | `behindCdn` | `cloudflare` or `none`. See [Behind Cloudflare](https://pyo.dev/docs/firewall#behind-cloudflare). | | `health` | The health check. A path like `/healthz`, or `tcp`, or `none`. | | `replicas` | How many replicas run. A whole number, 0 or more. | | `placement` | [Where the service runs](https://pyo.dev/docs/scaling#choosing-where-services-run), with `servers`, `tags` or both. | | `secrets` | Names of [secrets](https://pyo.dev/docs/deploy/environment#secrets) the service needs. Their values are set in Pyo, never in the file. | ```yaml services: web: image: ghcr.io/acme/web:1.4.2 ports: - "8080:8080" environment: LOG_LEVEL: info x-pyo: domains: - app.example.com behindCdn: cloudflare health: /healthz replicas: 2 placement: tags: [eu] secrets: - STRIPE_API_KEY worker: image: ghcr.io/acme/worker:1.4.2 x-pyo: replicas: 1 placement: servers: [worker-1] ``` A secret named under `secrets` starts empty. Set its value on the service, then deploy. If the file also gives that variable a value, Pyo doesn't use it. A key Pyo doesn't know, or a value it can't read, is left out and listed with the service. The rest of the file still imports. ## Sync a file again Run the same command again after you change the file: ```bash pyo deploy -f compose.yaml ``` The first run makes the project. Every later run syncs it. Pyo shows what would change, asks, then changes only that. Each service in the plan has a mark: | Mark | Meaning | | --- | --- | | `+` | Added. It's in the file and not in the project yet. | | `~` | Changed, with each setting that changes. | | `=` | Unchanged. | | `-` | Not in the file any more. | ### Options | Option | What it does | | --- | --- | | `--dry-run` | Shows the plan and changes nothing. | | `--prune` | Also deletes the services made from this file that are no longer in it. | | `--project` | The project to sync, by name or ID. | | `--cluster` | Where new services run. Without it, they run where the project's services run. | | `--team` | The team, by slug or ID. Without it, your first team. | | `--yes` | Applies without asking, for example in [CI](https://pyo.dev/docs/cli/ci). | Without `--project`, Pyo syncs the team's project that was made from a Compose file with the same project name. That's the file's `name`, or its folder's name. ### What a sync changes Pyo compares only what the file sets. A setting you changed in Pyo stays when the file doesn't mention it. - Variables, ports, domains and volumes in the file are added or changed. Ones the file doesn't list stay. - A secret keeps the value it has in Pyo, whatever the file says. - A port that's public in Pyo stays public. - Replicas stay as they are on a service with [autoscaling](https://pyo.dev/docs/scaling#autoscaling). - Services whose settings change are deployed. A new domain, placement or CDN setting applies without a deploy. Some things can't change in place. Pyo lists them and leaves them as they are, for you to change by hand: - a volume that would move to another path - a service that would change its kind of source, like from an image to a build - a plain variable that the file names under `secrets` - a domain for a service with no public web port A sync is one change. If any part of it is refused, nothing changes. ### Image tags set by a deploy A sync applies the file's image and tag only when the file changed them since the last sync. A tag set by a [deploy from CI](https://pyo.dev/docs/cli/ci#deploy-a-tag-or-digest) or in Pyo stays while the file still names the image it named then. The plan shows it as a note, not a change, and nothing is deployed for it: ```text It stays ghcr.io/acme/web:v2, set by a deploy or in Pyo. The file still names ghcr.io/acme/web:v1, as at the last sync. ``` When you change the image or tag in the file, the file's applies and is deployed. One case from before Pyo 0.52.1: a service last synced before then doesn't remember the file's image yet. If you changed its tag in the dashboard since that sync, its next sync puts the file's tag back and deploys it, once. Later syncs keep a tag you set in Pyo. To keep the dashboard's tag, deploy it with a reference before the next sync, like `pyo deploy --service shop/web --ref v2`, or set the same tag in the file. ### What prune deletes Without `--prune`, a service that's no longer in the file stays. The plan only lists it. With `--prune`, Pyo deletes it, and only when it was made from this file. Its volumes are kept, detached from the service. Prune never touches: - services you made another way, or from another Compose file - [volumes](https://pyo.dev/docs/volumes) - [databases](https://pyo.dev/docs/databases) - [previews](https://pyo.dev/docs/deploy/previews) ### Dry runs A dry run compares the file with the project. It doesn't run every check that applying does. So Pyo can still refuse the apply after a clean dry run. Two examples are a new service that has only a `build`, and a very large change in replicas. ### Who can sync Developers, admins and owners can sync a project. Viewers can only see the plan with `--dry-run`. An [API key](https://pyo.dev/docs/api) acts with your role. It needs **Full** access to sync. A **Read** key can run a dry run. Each sync is recorded in **Activity**. Sync works the same on Pyo Cloud and on your own Pyo. ### From the API or MCP Sync isn't in the dashboard. A project made from a Compose file shows the file's name under its title, like **From compose.yaml**. Besides the CLI, the API has the `planComposeSync` endpoint for the plan and the `syncCompose` operation to apply it. Over [MCP](https://pyo.dev/docs/mcp), the tools are `plan_compose_sync` and `sync_compose`. ## After the import The imported services are ordinary Pyo services. Like any other service, you can [scale](https://pyo.dev/docs/scaling) them, change their settings, add [domains](https://pyo.dev/docs/domains) and spread them across [regions](https://pyo.dev/docs/regions). --- # Running cron jobs Run a task on a schedule, like a cleanup or a nightly report. A cron job runs on a schedule, finishes and stops. It doesn't serve traffic, so it has no port or domain. ## Add one to a service Most cron jobs belong to a service, like a cleanup task for your website. Choose **New → Cron job**, or **Add cron job** under **Cron Jobs**, and pick the service. The job runs with that service's latest image and environment variables, so every deploy keeps it up to date. Changes to the job take effect without a redeploy. Give it a name, a schedule and a command. A service can't have cron jobs if it has a volume that only one server can use. Each run would need that volume too. ## Create a standalone one Deploy a new service from your repository or image. Under **Cron job**, choose **Add cron job**. Then set: - **Schedule:** when it runs, in cron syntax. Times are in UTC, so `0 3 * * *` runs at 03:00 UTC every day. - **Command:** what to run, like `npm run cleanup`. It runs through `sh`, so the image needs a shell. Leave it empty to use the image's default command. | Schedule | Runs | | --- | --- | | `*/15 * * * *` | Every 15 minutes | | `0 * * * *` | Every hour | | `0 3 * * *` | Every day at 03:00 | | `0 9 * * 1` | Every Monday at 09:00 | Cron jobs use the same [environment variables](https://pyo.dev/docs/deploy/environment) and [imported secrets](https://pyo.dev/docs/external-secrets) as any other service. ## Watch its runs Open **Cron Jobs** and choose a job to see its last 50 runs. For each run, you see when it started, how long it took, whether it succeeded, its exit code and the end of its output. When a run fails, Pyo adds it to your team's activity with the exit code or the reason. For example, `OOMKilled` means it ran out of memory. Set up [notifications](https://pyo.dev/docs/activity) to hear about it. Output is the last 60 lines a run printed, up to 8 KB. Pyo reads it when the run finishes, so a run that's still going shows its output once it's done. ## How runs behave - A new run doesn't start while the last one is still going. Pyo skips that scheduled run. - A failed run isn't retried. It waits for the next scheduled run. - The last three successful and three failed runs are kept, so you can read their logs. ## Run it now Under **Cron Jobs**, choose **Run now** from the job's menu. This starts a run right away and doesn't change the schedule. ## Pause it Under **Cron Jobs**, choose **Pause** from the job's menu. Choose **Resume** to schedule it again. ## Change the schedule Change it in the cron job's **Settings** tab, under **Schedule**, then redeploy. A service can't switch between being a cron job and running all the time. Create a new service instead. --- # Deploy with Pyo button A button for your README that deploys your repository or image. Add the button to your README, and anyone who clicks it can deploy your repository or image to their own Pyo. Get the button in each style, with its Markdown and HTML, on [pyo.dev/deploy](/deploy). ```md [![Deploy with Pyo](https://pyo.dev/badge/deploy-dark.svg)](https://pyo.dev/deploy?repo=https://github.com/owner/repo) ``` ## The link The button links to `pyo.dev/deploy` with what to deploy: | Source | Link | | --- | --- | | Repository | `https://pyo.dev/deploy?repo=https://github.com/owner/repo` | | Image | `https://pyo.dev/deploy?image=ghcr.io/owner/app:latest` | `repo` is the repository's `https://` URL on github.com or gitlab.com. GitLab subgroups work too, like `https://gitlab.com/group/subgroup/project`. Other Git hosts aren't supported yet. `image` is any image reference, like `nginx:1.27` or an image with a `@sha256:` digest. Repositories and images should be public, so anyone can deploy them. ### Branch and folder Link to a branch or a folder the way GitHub and GitLab show it, and Pyo builds from there: ```text https://pyo.dev/deploy?repo=https://github.com/owner/repo/tree/main/apps/web https://pyo.dev/deploy?repo=https://gitlab.com/group/project/-/tree/main/apps/web ``` The part after `tree` is the branch and the rest is the folder, which becomes the build context. A branch with a `/` in its name can't be picked this way. Without `tree`, Pyo builds the default branch from the repository's root. ## What people see The page shows what will be deployed and asks for their Pyo's address, which it saves in their browser. **Deploy** opens their Pyo's deploy page with the source filled in. Nothing deploys until they press **Deploy** there. You can open that page yourself, without pyo.dev: ```text https://your-pyo/new?repo=https://github.com/owner/repo https://your-pyo/new?image=nginx:1.27 ``` Here `repo` can also be on your own GitLab, when your team has a [GitLab](https://pyo.dev/docs/gitlab) connection to it. Signed out, Pyo asks you to log in first, then opens the page. A repository goes through your team's [GitHub](https://pyo.dev/docs/github) or [GitLab](https://pyo.dev/docs/gitlab) connection when it can see the repository. Without one, the page offers to connect it. Public repositories deploy without it. Git deploys need a ready [builder](https://pyo.dev/docs/builders). --- # Setting environment variables Configure services with variables and encrypted secrets. Set variables on a service in the dashboard, or with the CLI: ```bash pyo env set LOG_LEVEL=info ``` ## Secrets Mark a variable as secret to encrypt it. A secret's value can't be read back afterwards. ```bash pyo env set --secret STRIPE_KEY=sk_live_... ``` Each team's variables are encrypted with its own key. See [Protecting secrets](https://pyo.dev/docs/encryption). Already using a secret manager, like Vault, AWS Secrets Manager or Doppler? [Import from it](https://pyo.dev/docs/external-secrets) instead. ## Connecting services A variable can use another service's value, written as `${{service.VARIABLE}}`. For example, to give your service the database's address: ```bash pyo env set 'DATABASE_URL=${{postgres.DATABASE_URL}}' ``` A reference can sit inside a longer value, like `${{api.URL}}/v1`. It only works between services in the same project. Pyo fills it in when the service deploys. The browser only ever sees the reference, never the value. Every service offers: | Variable | What it holds | | --- | --- | | `HOST` | Its internal address, which other services use to reach it | | `PORT` | Its first port | | `URL` | `http://` with its host and port | | `PUBLIC_DOMAIN` | Its first domain, if it has one | | `PUBLIC_URL` | `https://` with that domain | | Its own variables | By name, like `${{api.API_KEY}}` | The database templates also offer their connection details: | Template | Variables | | --- | --- | | MySQL, MariaDB | `USER`, `PASSWORD`, `DATABASE`, `DATABASE_URL` | | MongoDB | `USER`, `PASSWORD`, `DATABASE_URL` | Good to know: - If a reference names a service or variable that doesn't exist, the deploy stops and says which one. - When a value you reference changes, the services that use it keep the old value until they're redeployed. Pyo doesn't redeploy them for you. - A reference inside a referenced value isn't filled in. - Retrying a deployment uses the values it had the first time. ## Applying changes Changes apply on the next deploy. To deploy right away, add `--deploy`: ```bash pyo env set LOG_LEVEL=debug --deploy ``` ## Working locally List the variables, or write them to a `.env` file. Secrets stay in Pyo. ```bash pyo env list pyo env pull ``` --- # Using deploy hooks Trigger a deploy from CI, a CMS or a cron job. A deploy hook is a secret URL that deploys a service, or every service in a project, with its current settings. Git services build the head of their branch. A project's hook skips stopped services. Create one from the service or project, then call it: ```bash curl -X POST https://your-pyo/api/hooks/deploy/ ``` Anyone with the URL can trigger a deploy, so treat it like a password. You can remove a hook at any time. ## Deploy a tag or digest A service that runs an image can be sent a tag or a digest of that image. CI can then ship exactly the image it just built: ```bash curl -X POST https://your-pyo/api/hooks/deploy/ -d '{"reference":"v1.2.3"}' curl -X POST https://your-pyo/api/hooks/deploy/ -d '{"reference":"sha256:<64 hex>"}' ``` - The reference changes only the tag or digest. The image's registry and repository stay the service's. - A tag is letters, digits, `_`, `.` and `-`, up to 128 characters. A digest is `sha256:` and 64 lowercase hex characters. Anything with `/`, `@` or `:` that isn't a digest is refused. - The service keeps the reference. The next deploy without one runs it again, and the dashboard shows it. - Pyo looks a tag up in its registry before the rollout and runs the digest it points to now. An older image a server has under that tag never runs. - If the deploy fails, is rolled back or is cancelled, the service gets its reference from before back. A reference changed since then stays. - A project's hook refuses a reference. Git, folder and template services take none. The hook panel on the service shows the command with its URL. ## Hook status The hook's answer lists the deploys it started, each with its `deploymentId`. Ask the same URL with that id to see how it's doing: ```bash curl https://your-pyo/api/hooks/deploy// ``` ```json { "deploymentId": "dpl_…", "serviceId": "svc_…", "status": "succeeded", "done": true, "imageDigest": "sha256:…", "failure": null, "warnings": [] } ``` - `done` is `true` once the deploy succeeded, failed or was cancelled. - `imageDigest` is the image the servers run, once Pyo knows it. - `failure` says why, when `status` is `failed`. - `warnings` has lines like the one for a cluster whose agent is older than 0.52.1 (see [Deploy from CI](https://pyo.dev/docs/cli/ci#deploy-a-tag-or-digest)). A hook reads only the deploys it started. Any other id gets a 404. You can ask once every 5 seconds per hook. Deploys a hook started before Pyo 0.52.1 can't be read this way. To wait for a deploy in CI: ```bash dep=$(curl -fsS -X POST "$HOOK" -d '{"reference":"'"$TAG"'"}' | jq -r '.deployments[0].deploymentId') until curl -fsS "$HOOK/$dep" | jq -e '.done' > /dev/null; do sleep 10; done curl -fsS "$HOOK/$dep" | jq -e '.status == "succeeded"' ``` --- # Preview environments A temporary copy of a service for each pull request. A preview is a temporary copy of a service, built from a pull request. Open a pull request on GitHub or a merge request on GitLab, and Pyo deploys its latest commit to the same cluster and project. Each push deploys it again. Pyo removes it when the pull request is closed or merged. A preview is named after the service and the pull request, like `web-pr-42`. It has its own deployments and logs. Previews don't show in the project's list of services. Open them from the service's **Previews** tab. Previews work for services from Git, through the [GitHub App](https://pyo.dev/docs/github) or a [GitLab connection](https://pyo.dev/docs/gitlab). A standalone [cron job](https://pyo.dev/docs/deploy/cron-jobs) can't have previews. ## Turn them on Open the service's **Previews** tab and turn on previews. The settings: | Setting | What it does | | --- | --- | | **Pull requests** | **All** pull requests get a preview, or only those **With a label**. The label is `preview` by default. Removing the label removes the preview. | | **At once** | The most previews of this service at once, from 1 to 50. The default is 5. Past it, a new preview waits until another one is removed. | | **Remove when idle** | Removes a preview after 1, 3, 7 or 14 days without a push. The next push brings it back. Off by default. | | **Access** | **Public** on the web, or **Private** on your [tailnet](https://pyo.dev/docs/tailscale). Private needs Tailscale on the cluster. | | **Pull requests from forks** | Whether pull requests from forks get a preview. See [Pull requests from forks](#pull-requests-from-forks). | | **Copy secret variables** | Gives previews the service's secret variables. Off by default. | | **Variables** | Variables for previews only. They replace the service's variable with the same name, or add a new one. They can be secret. | The tab also lists the service's previews with their status: waiting, building, ready, failed or removing. **Redeploy** deploys a pull request's latest commit again. It also starts a waiting or failed preview when there's room. **Delete** removes a preview now. The next push brings it back. ## What a preview gets A preview gets the service's variables, then the preview variables. The service's secret variables only come along with **Copy secret variables** on. Pyo adds: | Variable | Value | | --- | --- | | `PYO_PREVIEW` | `1` | | `PYO_PULL_REQUEST` | The pull request's number | | `PYO_PREVIEW_URL` | The preview's URL | A preview runs one replica. These aren't copied: - [Volumes](https://pyo.dev/docs/volumes) - The service's cron jobs - [Autoscaling](https://pyo.dev/docs/scaling) - Public TCP and UDP ports - [Firewall](https://pyo.dev/docs/firewall) and [WAF](https://pyo.dev/docs/waf) rules Use preview variables to point a preview at its own database or test keys. ## Preview URLs Each preview has one URL that stays the same across pushes. Pyo picks it in this order: 1. **Private** previews get a name on your tailnet, like `web-pr-42..ts.net`. 2. On a cluster with a preview domain, like `preview.example.com`, they get `web-pr-42.preview.example.com`. 3. Otherwise they get a [free domain](https://pyo.dev/docs/domains#free-domains) on the cluster's address, like `web-pr-42.203.0.113.7.nip.io`. On a cluster in [Cloudflare Tunnel](https://pyo.dev/docs/cloudflare-tunnel) mode, public previews go under the tunnel's default domain instead, like `web-pr-42.example.com`, and the preview domain isn't used. Without a default domain, they get no URL until you pick one. Long names are shortened with a short hash, so each part of the URL stays within 63 characters. ### Preview domain An admin sets a cluster's preview domain on its **Networking** tab. A preview domain belongs to one cluster, since its wildcard record points at that cluster. - With [Cloudflare connected](https://pyo.dev/docs/cloudflare) and covering the domain, Pyo creates the wildcard record, like `*.preview.example.com`, and gets a wildcard certificate. It renews the certificate before it runs out. - Without it, add the wildcard record yourself. Pyo shows the record to add. Each preview then gets its own certificate. ## Pull requests from forks Anyone can open a pull request from a fork, so these don't get a preview by default. The **Forks** setting has three choices: - **Don't deploy:** no preview. This is the default. - **Deploy without secrets:** a preview without any secret variable, the service's or the preview's own, even with **Copy secret variables** on. - **Deploy with secrets:** a preview with secret variables. Only choose this if you trust everyone who can open a pull request. A fork's code runs on your servers. On a public repository, **With a label** lets your team choose which pull requests get a preview, since only people with write access can add labels. ## On the pull request Pyo reports each preview on its pull request. On GitHub, through the GitHub App, shown as `[bot]`: - One comment with each preview's status, URL and logs. Pyo updates it on each push, and says **Preview removed** when the pull request closes. - A deployment, with **View deployment** to open the preview. - A check named **Pyo · Preview**. It fails when the build fails. On GitLab: - One note on the merge request, updated on each push. - A commit status named **Pyo · Preview**. - An environment, like `preview/web-pr-42`, with **View app** to open the preview. Pyo hears about pull requests through its webhooks. Its GitLab webhooks get merge request events too. When GitHub or GitLab can't reach Pyo, it checks for new pull requests every minute instead. ## GitHub App permissions Previews need more from the [GitHub App](https://pyo.dev/docs/github): - **Pull requests:** write - **Deployments:** write - **Checks:** write - The **Pull request** event If your GitHub App lacks them, the dashboard says what's missing and links to each step: 1. The app's owner adds them in the app's settings on GitHub. **Settings → GitHub** links there. 2. The owner of each account or organization the app is installed on approves them once on GitHub. The **GitHub** card under **Integrations** links there. Until then, repositories of that installation get no previews. ## On Pyo Cloud Previews work the same on Pyo Cloud. They build on a builder in the service's own cluster, and their URLs are on your own servers. Pyo Cloud's GitHub App already has the permissions, so you only approve them on your installation. --- # Rolling back a deploy Go back to an earlier version, by hand or automatically. ## Automatic rollback If a deploy fails, Pyo puts the previous version back automatically. This is on by default. You can turn it off per service. ## Roll back by hand Pick an earlier deployment in the dashboard, or use the CLI: ```bash pyo rollback # the previous version pyo rollback # a specific deployment ``` A rollback keeps the service's current [domains](https://pyo.dev/docs/domains#changing-domains). A rollback runs the exact image that version ran, by its digest. For a service that runs an image, it also sets the service's tag or digest back to that version's. After rolling back from `v2` to `v1`, the service says `v1`, and the next deploy runs `v1` again. When the service's image changed to another repository since that version, the rollback still runs that version, and the service keeps its current tag. Rolling back needs that version's image. You can't roll back to images removed by retention. --- # Static sites Deploy plain HTML or a built frontend from Git. A static site is a folder of HTML, CSS, JavaScript and images. Pyo deploys it like any other service from Git. With no Dockerfile, Pyo builds it with [Railpack](https://railpack.com). The build log says **Static site** for plain files, or the framework's name for a built frontend. ## Served as static files When the build is a static site, Pyo serves its files from Pyo Static, a small file server it runs on the cluster, instead of a service of its own: - **Instant deploys and rollbacks:** each deploy is its own folder of files. A deploy or a rollback only moves the site's domains to another folder, so nothing restarts. - **No replicas to run:** one server, `pyo-static`, serves every static site of the cluster. It runs only while the cluster has one. - **Up when storage isn't:** the files are kept in your team's storage on the server Pyo runs on. On [Pyo Cloud](https://pyo.dev/docs/cloud), they're kept on your own cluster instead, in a store Pyo starts there with the cluster's first static site. `pyo-static` keeps a copy on its own server's disk, so a site keeps answering while that storage can't be reached. - **Everything else works the same:** [domains](https://pyo.dev/docs/domains) and HTTPS, free domains, the [firewall](https://pyo.dev/docs/firewall), the [WAF](https://pyo.dev/docs/waf), [analytics](https://pyo.dev/docs/observability) and [deploy on every push](https://pyo.dev/docs/deploy#deploy-on-every-push). The build log says **Uploading the site** with its files and size, and the service shows **Static files** instead of its replicas. Its **Logs** show each request, with its path, status and time. Only Railpack's static builds are served this way. A Dockerfile build always runs as a service, and so does a build that isn't a static site. ### Run it as a service instead To serve the site with its own Caddy service, as Pyo did before, turn off **Serve as static files** in the service's **Settings**, under **Static files**, then redeploy. Turn it on again the same way. The switch works both ways without downtime: the domains move to the new version only once it's ready. With the CLI, set `"serveAs": "service"` or `"serveAs": "static"` under `deploy` in [pyo.jsonc](https://pyo.dev/docs/cli/pyo-jsonc). ### Limits A static site can have up to 20,000 files and 1 GiB in all, and each file up to 90 MiB. That keeps each file under Cloudflare's 100 MB limit for one request. A bigger one runs as a service, and the build log says why. Pyo keeps the files of each site's 10 newest deploys for rollbacks. Rolling back to an older deploy runs it as a service from its image. ## Headers and redirects Put a `_headers` or `_redirects` file at the root of the output folder, as on Netlify and Cloudflare Pages. Pyo supports the part of their syntax described here. The build log names each line it leaves out, and neither file is served to visitors. ### `_redirects` One rule per line: a path, where it goes, and a status. Lines starting with `#` are comments. ```text /old /new /blog/* /posts/:splat 302 /users/:id /profile/:id /docs https://docs.example.com /app/* /app/index.html 200 /gone/* /404.html 404 ``` - **Status:** `301` when there's none. `302`, `303`, `307` and `308` redirect too. `200` serves the target's file at the same address, and `404` serves it with a `404`. - **Patterns:** `*` at the end matches the rest of the path, and `:splat` puts it in the target. `:name` matches one part of the path, and `:name` in the target puts it there. - **Order:** the first rule that matches wins. A redirect applies even where a file is. A `200` rule applies only where no file is. - **Query strings:** a redirect keeps the request's query string, unless the target has one. - **Not supported:** conditions like countries, languages or cookies, matching on query strings, and `200` to another site. A `!` after the status is accepted and changes nothing. ### `_headers` A path on its own line, then the headers its responses get, each on its own indented line: ```text /* X-Frame-Options: DENY Referrer-Policy: strict-origin-when-cross-origin /assets/* Cache-Control: public, max-age=31536000, immutable ! X-Frame-Options ``` - **Patterns:** the same as in `_redirects`, and `:splat` or `:name` in a value puts that part of the path there. - **Several matches:** every block that matches applies, in order. A header two blocks set gets both values, joined with a comma. `! Name` takes away a header an earlier block set. - **Not allowed:** headers the server sets itself, like `Content-Length` and `Content-Encoding`. Without a `_headers` file, each file gets its `Content-Type` from its extension, an `ETag`, and `Cache-Control: public, max-age=0, must-revalidate`, so browsers check for a new version on each visit. ## Before you deploy Keep the default port, `8080`. Pyo sets `PORT` to the service's first port, and Railpack's Caddy listens on `PORT` when the site runs as a service. ## Health check When the build finds a static site that runs as a service, Pyo checks that `/` answers before the new version takes traffic. A redirect counts too. The service's **Health check** shows **Automatic (static site)**. A site served as static files needs no check: it goes live once `pyo-static` has its files. To use another check, change it on the service's **Resources** tab. Pyo then keeps yours. Choose **HTTP path** for another path, **TCP** to only wait for the port, or **None** to not wait at all. ## Plain HTML Push a repository with an `index.html` at its root, and that's it. Pyo serves the whole repository, except `.git` and `.env` files. To serve another folder, Railpack looks in this order: 1. A `RAILPACK_STATIC_FILE_ROOT` build argument, like `site`. 2. A file named `Staticfile` at the root, with `root: site`. 3. A `public` folder. 4. An `index.html` at the root. A request for `/about` finds `about`, `about.html` or `about/index.html`. ## A built frontend Pyo runs your `build` script, then serves only its output. Railpack finds the output folder for: - **Vite**, including React, Vue and Svelte projects built with Vite - **Astro**, when it has no server output or adapter - **Next.js** with `output: 'export'` - **Create React App** - **Angular** It reads a custom `outDir` from your Vite or Astro config. For anything else, like SvelteKit with `adapter-static`, add a build argument with the output folder: ```bash RAILPACK_SPA_OUTPUT_DIR=build ``` That also tells Railpack to serve the folder as a static site, whatever the framework. Variables your build reads, like `VITE_API_URL`, go in build arguments too, since the build runs before the service starts. Add build arguments in **Deploy new**, under **Advanced: Dockerfile, build context and arguments**, or later in the service's **Settings**, under **Deployment source**. They're used on the next deploy. To change the build command, add `RAILPACK_BUILD_CMD`, like `npm run build:prod`. ## Static site generators Many generators' `start` script runs their development or preview server, like `eleventy --serve`, `astro dev`, `vite preview` or `hugo server`. That's a full Node.js process, often 100 MiB of memory or more, to serve files. When Pyo finds one, it runs your `build` script and serves the output with Caddy instead, in around 15 MiB: | Generator | Output folder | | --- | --- | | **Eleventy** | `_site`, or the `output` in your Eleventy config or `--output` in the build script | | **Astro**, with no server output or adapter | `dist`, or `outDir` in your Astro config | | **Hugo**, built through npm (like `hugo-bin`) | `public`, or `-d` in the build script | | **Vite** | `dist`, or `outDir` in your Vite config | Eleventy and Hugo are served this way with no `start` script too. The build log says which folder it serves. A generated site has a page for each path, so a path that matches nothing gets a `404` instead of the home page. A `Staticfile` of your own changes that. To run your `start` script instead, add the build argument: ```bash RAILPACK_NO_SPA=1 ``` Pyo also leaves it alone when you set `RAILPACK_SPA_OUTPUT_DIR`, `RAILPACK_START_CMD` or `RAILPACK_STATIC_FILE_ROOT`, or have a `Procfile` or a start command in `railpack.json`. Jekyll, and Hugo without a `package.json`, need a [Dockerfile](#your-own-dockerfile), since Railpack can't build them on its own. ## Routing in single page apps A single page app handles its own paths, like `/settings`, so every path that isn't a file should get `index.html`. - **A built frontend:** this is on by default, except for a [static site generator](#static-site-generators)'s output that Pyo serves. - **Plain HTML:** turn it on with a `Staticfile` at the root: ```yaml root: . index_fallback: true ``` Set `index_fallback: false` to turn it off for a built frontend. Without the fallback, a path that matches nothing gets a `404`, or your `404.html` for plain HTML sites. ## A site in a subfolder If the site lives in a folder of a bigger repository, set the **Build context** to that folder, like `apps/web`. Pyo builds and serves it from there. ## Your own Dockerfile If you add a Dockerfile, Pyo uses it instead of Railpack. This one builds a Vite site and serves it with nginx on port `8080`, with every unknown path going to `index.html`: ```dockerfile FROM node:22-alpine AS build WORKDIR /app COPY package*.json ./ RUN npm ci COPY . . RUN npm run build FROM nginx:1.27-alpine COPY nginx.conf /etc/nginx/conf.d/default.conf COPY --from=build /app/dist /usr/share/nginx/html ``` ```nginx server { listen 8080; root /usr/share/nginx/html; location / { try_files $uri $uri/ /index.html; } } ``` Set the health check to **HTTP path** `/`, since Pyo only picks one for Railpack's static sites. Pyo passes your build arguments to the Dockerfile as `ARG` values. ## The Nginx template [Templates](https://pyo.dev/docs/templates) has **Nginx**. It serves nginx's welcome page on port `80`, and is a starting point for your own image: build one `FROM nginx` with your files in `/usr/share/nginx/html`, then deploy it from Git or a [container image](https://pyo.dev/docs/deploy#from-a-container-image). ## Good to know - **Served from your servers:** the files come from your servers, not a global CDN. For visitors far from them, put a CDN like Cloudflare in front. - **Inside the cluster:** a site served as static files has no address of its own inside the cluster. Other services reach it at its domain. - **As a service:** a site that [runs as a service](#run-it-as-a-service-instead) is a small service that's always on, with its own replicas and resources. See [Scaling](https://pyo.dev/docs/scaling). - **Security headers:** for plain HTML sites that run as a service, Railpack's Caddy adds a few headers, including a `Content-Security-Policy`. If it blocks something your site needs, use your own Dockerfile. Served as static files, a site gets only the headers its [`_headers`](#_headers) sets. --- # Adding a domain Put a service on the web, with certificates handled for you. ## Free domains A free domain needs no DNS setup, so it's the quickest way to get a service online. It's a nip.io name with your cluster's address in it, like `shop-web.203.0.113.7.nip.io`. Each cluster picks which address its free domains use, under **Free domains** on its **Settings** tab: - **Public IP:** the cluster's public address. Anyone on the internet can reach it, and it gets a Let's Encrypt certificate. - **Tailscale:** a server's [Tailscale](https://pyo.dev/docs/tailscale) address, like `shop-web.100.64.0.2.nip.io`. Only devices on your tailnet can reach it. Pyo Gateway answers there on ports 80 and 443 even while the cluster's [public traffic](https://pyo.dev/docs/clusters#public-traffic) is off. By default, a cluster uses **Public IP** when it takes public traffic and a server has its public address itself, on its network card or as its external IP, or a load balancer gives it one. On AWS, Google Cloud, Azure, Alibaba Cloud and Tencent Cloud, a server has only a private address on its card, and the cloud gives it the public one. Pyo reads that address from the cloud and uses **Public IP** once Let's Encrypt reached the server there. See [Opening ports 80 and 443](https://pyo.dev/docs/install#opening-ports-80-and-443). A server behind NAT, like one at home or with some cloud providers, only knows its public address from the internet's side. Ports 80 and 443 may not reach it, so the cluster uses **Tailscale** and the setting says **Behind NAT**. Choose **Public IP** there if ports 80 and 443 are forwarded to the server. Without Tailscale, a server behind NAT has no free domain. A new service then opens on your own network over HTTP, at the server's address and a port Pyo picks, like `http://192.168.1.20:31234`. Set up [Tailscale](https://pyo.dev/docs/tailscale) for HTTPS, or forward ports 80 and 443 and add your own domain. ### Tailnet domains With [Tailscale](https://pyo.dev/docs/tailscale) set up, a service can also get a name on your tailnet, like `blog..ts.net`. Only devices on your tailnet can open it, over HTTPS with Tailscale's certificate. It needs no DNS record, since Pyo sets up the name on your tailnet. Choose **Tailscale** when you add a domain. It's there on clusters whose servers are on your tailnet. In the domain list, a tailnet domain shows the Tailscale logo. A name another device or Service on your tailnet already has shows **Taken on your tailnet**, and `pyo` and `registry` are kept for Pyo. When you change it, the cluster's free domains move to the new address within seconds. A cluster without the chosen address has no free domain. Add your own domain instead. ### In tunnel mode A cluster with [Cloudflare Tunnel](https://pyo.dev/docs/cloudflare-tunnel) on gives each service a tunnel domain instead of a free one. Choose **Tunnel domain** when you add a domain. It's a name under the tunnel's default domain, like `shop-web.example.com`. One wildcard record covers them, so they need no record of their own. A record you made for a name comes first. Without a default domain, the cluster has no tunnel domain, and the dialog says to pick one. Its nip.io domains stop answering from the internet while public ports are off. They answer again when public ports are back on, with nothing to move. ## Custom domains Add your domain to a service, then point its DNS at your cluster. Pyo checks the DNS and tells you when the domain is active. Is your DNS on Cloudflare? [Connect Cloudflare](https://pyo.dev/docs/cloudflare) and Pyo creates the record for you. On a cluster in [tunnel mode](https://pyo.dev/docs/cloudflare-tunnel), Pyo points the domain at the tunnel instead, and **Switch to Tunnel** and **Switch back** move a domain there and back. In the domain list, a domain that goes through the tunnel, or through a record Cloudflare proxies, shows the Cloudflare logo. ## Changing domains Adding or removing a domain, or changing its HTTPS settings, takes effect within seconds. You don't need to redeploy, and the service keeps running. A service that hasn't been deployed yet gets its domains with its first deploy. Domains belong to the service, not to a deployment, so a [rollback](https://pyo.dev/docs/deploy/rollbacks) keeps the domains the service has now. ## Traffic path When a cluster has both public ports and Cloudflare Tunnel on, pick the domain's **Path**: **Direct** (ports 80 and 443 of the servers) or **Cloudflare Tunnel**. A new domain is Direct unless public ports are off. Moving a domain drops its open connections once. A domain shows **Not served** while its path is off on its cluster. See [Traffic](https://pyo.dev/docs/clusters#public-traffic). ## Routes Several services of a team can share one domain, each on its own path. For example, `example.com` goes to `web`, and `example.com/api` goes to `api`. A request goes to the longest path it's under, so `/api/users` goes to `api`, and `/about` and `/apix` go to `web`. To add one, open the service's **Domains** page, choose **Add domain**, enter the domain and a **Path**, like `/api`. Turn on **Strip prefix** to send `/api/users` to the service as `/users`. - The first service to add a domain holds it: its DNS record, certificate, tunnel, redirects and HTTPS settings. Paths on other services follow these. The domain list shows **Shared** on a domain other services also use. - Each service keeps its own [firewall](https://pyo.dev/docs/firewall), rate limits and [WAF](https://pyo.dev/docs/firewall), and its own analytics. - A path is used once per team. Another team can't use the domain. - All services on one domain run on the same cluster. - When the service that holds a domain removes it, or is deleted, the oldest path takes it over with its DNS record and certificate. Pyo offers to delete the DNS record only when the last one goes. Then the domain is gone. - On Pyo Cloud, you prove you own a domain once. Its paths need no proof of their own. ### Edit routes The team's **Domains** page lists each domain once. Open a domain to see which path goes to which service under **Routes**. - **Add a path:** choose **Add path**, enter the **Path** and pick the service. - **Change a route:** open the route's menu and choose **Edit**. You can change its path, **Strip prefix** and port. For a path, you can also pick another service on the same cluster. The route that holds the domain stays on its service. - **Remove a route:** open the route's menu and choose **Remove**. Removing the route that holds the domain hands it to another path. Removing the last route removes the domain. If a move to another service stops halfway, an error says which service each path goes to now. Viewers can see routes but can't change them. ## Redirects [Pyo Gateway](https://pyo.dev/docs/gateway) can send visitors from one address to another. Open a domain's menu on the service's **Domains** page and choose **Redirects**. Each redirect has: - **Path:** the path it applies to, like `/old`. It covers everything under it, like `/old/page`. Leave it as `/` for the whole domain. - **To:** another hostname, like `example.com`, a path, like `/new`, or both, like `example.com/new`. - **Status:** 301 for a move that stays, or 302 for one that doesn't. - **Keep the rest of the path:** on by default, so `/old/page` goes to `/new/page`. Turn it off to send every request to the target itself. The query string is always kept. ### Redirect a whole domain To send `www.example.com` to `example.com`, add `www.example.com` with **Only redirect** on, and enter `example.com` under **Redirect to**. Add it to the service that serves `example.com`, or any service of the team. The domain gets its DNS record and certificate like any other, so `https://www.example.com` works too. It has no port. A domain that also serves a service can't redirect `/` as a whole. Redirect a path instead, or add the domain with **Only redirect**. ### Path redirects A path redirect goes on the domain itself, on the service that holds it. A path can't be a redirect and a route at once. For example, add `/blog` to `example.com` with **To** set to `blog.example.com` to move a blog to its own domain. More specific paths win, so `/blog` answers before the service at `/`. Plain HTTP requests are redirected straight to HTTPS when the domain has a certificate. Redirects skip the service's firewall and WAF, since they never reach it. A domain can have up to 15 redirects. ## Headers Pyo Gateway can set or remove headers on a domain's responses, and on requests to the service. Open a domain's menu and choose **Headers**. - **Set** adds a header, or replaces it when the service sends one. - **Remove** takes a header out, like `X-Powered-By`. Under **Responses**, quick buttons add common security headers: **HSTS** (`Strict-Transport-Security`), **Frame options** (`X-Frame-Options`), **No sniffing** (`X-Content-Type-Options`) and **Hide X-Powered-By**. Under **Requests to the service**, headers go to your service with each request. Some headers can't be changed, because Pyo Gateway sets or needs them: `Connection`, `Keep-Alive`, `Proxy-*`, `TE`, `Trailer`, `Transfer-Encoding`, `Upgrade`, `Host`, `Content-Length`, `Forwarded`, `Via`, `X-Forwarded-*`, `X-Real-Ip`, `X-Envoy-*`, `Cf-*` and `X-Pyo-*`. Each list takes up to 16 headers. ## In one place The team's **Domains** page has a row per domain. A green lock before the hostname means HTTPS works. A domain that needs attention shows an icon there instead, and a short note after the hostname, such as **Waiting for DNS** or **Certificate failed**. Hover the lock or the icon for details. A service's **Domains** tab shows the same lock, icons and notes. Each row on the team's page also shows: - **Routed to:** the service and project the domain goes to, how many services share it, or where it redirects. - **Requests, 24h:** the domain's requests over the last 24 hours, as a small chart and a total. It shows a dash when the domain had no requests, or when [observability](https://pyo.dev/docs/observability#turning-it-on-or-off) is off. On a phone, this column is hidden. Search, filter and sort the list. Open a domain to see its routes, redirects and headers, with its DNS record and certificate. ## From the CLI and MCP ```bash pyo domain add example.com/api -s api --strip-prefix pyo domain add www.example.com --redirect-to example.com pyo domain redirect example.com/old --to /new --status 302 pyo domain redirect example.com/old --remove pyo domain header example.com --set 'Strict-Transport-Security: max-age=31536000' --remove X-Powered-By pyo domain header example.com --request --set 'X-Region: eu' pyo domain header example.com ``` Over [MCP](https://pyo.dev/docs/mcp), `add_domain` takes `path`, `strip_prefix` and `redirect_to`, and `set_domain_redirects` and `set_domain_headers` replace a domain's rules. Redirects and headers take effect within seconds, without a redeploy. ## Request timeout [Pyo Gateway](https://pyo.dev/docs/gateway) waits up to 300 seconds for the service to answer a request on its domains. After that, the visitor gets a 504 error. To change it, set **Request timeout** on the service's **Networking** page, from 0 to 3600 seconds. 0 means no limit. Like a domain change, it takes effect within seconds, without a redeploy. You can also set it with `deploy.timeout` in [`pyo.jsonc`](https://pyo.dev/docs/cli/pyo-jsonc), or with the `set_request_timeout` tool over [MCP](https://pyo.dev/docs/mcp). The request timeout doesn't close WebSockets. On public domains, a WebSocket or another long stream stays open while it's quiet for up to an hour. ## Certificates Pyo picks a certificate for you: - **Public domains** get a Let's Encrypt certificate, issued and renewed automatically. - **Private domains**, on a tailnet or LAN, get a self-signed certificate. You can also use [your own certificate](https://pyo.dev/docs/certificates), including wildcards. ### When a certificate isn't issued While Let's Encrypt works on a certificate, the domain shows **Issuing certificate**. If it fails, or is still pending after 10 minutes, the domain shows **Certificate failed** with the reason. On the team's **Domains** page or the service's **Domains** tab, hover over it to read the reason. Pyo keeps trying on its own. | Message | What it means | | --- | --- | | Let's Encrypt is busy for free nip.io addresses this week | Every nip.io user shares one Let's Encrypt limit. On busy weeks it runs out. Add your own domain for HTTPS now. | | Let's Encrypt's limit for this domain is reached for now | Too many certificates were issued for your domain lately. Pyo tries again later. | | Let's Encrypt can't reach this server on port 80 | Let's Encrypt checks the domain over port 80. On a home server behind NAT, forward ports 80 and 443 on your router to it. Elsewhere, check that the server's firewall lets port 80 in. | | The domain doesn't point at this server yet | Its DNS record is missing or points somewhere else. | | The domain's CAA record doesn't allow Let's Encrypt | Add `letsencrypt.org` to the domain's CAA record. | | No certificate after 10 minutes | It's been pending too long. The rest of the message says why. | Requests to your domains go through [Pyo Gateway](https://pyo.dev/docs/gateway) on each server. ## Other kinds of traffic Services aren't limited to websites. A port can be: - **Private:** reachable only inside the cluster. Use this for databases and internal APIs. - **Website:** an HTTP service on a domain. - **Port on every server:** a TCP or UDP port on each server in the cluster. - **Public IP:** a public TCP or UDP port, for a game server or a database you reach from outside. Only private ports are reachable while the cluster's [public traffic](https://pyo.dev/docs/clusters#public-traffic) is off. With free domains on [Tailscale](#free-domains), websites stay reachable from your tailnet too. ### Public TCP and UDP ports A **Public IP** port goes **Through the gateway** by default. The [gateway](https://pyo.dev/docs/gateway#tcp-and-udp-ports) counts its connections in analytics. For TCP, you can add IP rules, a connection limit and PROXY protocol. The [firewall](https://pyo.dev/docs/firewall) applies to these ports too. Turn the switch off to open the port directly on the servers instead. Your service then sees each visitor's address itself. Only servers running one of its replicas answer on the port. The port has no analytics or gateway options. Switching a port between the two interrupts it for about 1 to 3 seconds. Each cluster can have one public port per number and protocol. Inside the gateway, ports below 1024 are moved up by 10000. For example, 123 and 10123 can't both go through the gateway. Some ports can't be public, because the servers or Pyo use them: | Protocol | Reserved ports | | --- | --- | | TCP | 22, 53, 80 and 443 (for websites), 2379, 2380, 6443, 10080, 10443, 10250, 19000 to 19003 | | UDP | 53, 8472, 51820, 51821 | In [tunnel mode](https://pyo.dev/docs/cloudflare-tunnel#tcp-and-udp-ports), public TCP and UDP ports stay on the servers by default. They don't go through the tunnel. Turn off **Public TCP and UDP ports** under the cluster's **Traffic** to close them too. --- # Setting up email Send invites, sign-in links and security emails through your own SMTP server. Pyo sends email through an SMTP server you choose. An installation admin sets it up under **Settings → Email**. Without it, Pyo sends no email, and you share invite and sign-in links yourself. On Pyo Cloud, email is set up for you. ## What Pyo sends - **Team invites:** when someone [invites a person](https://pyo.dev/docs/teams) to a team. - **Sign-in links:** from **Forgot password?** on the sign-in page, and when a team owner resets a member's sign-in. See [Getting back in](https://pyo.dev/docs/getting-back-in). - **Two-factor turned off:** when [two-factor authentication](https://pyo.dev/docs/two-factor) is turned off on an account. - **New API keys:** when an [API key](https://pyo.dev/docs/api) is made on an account, in the dashboard or by the CLI. - **Test email:** when you send one from the settings page. Each email has a plain text part and an HTML part. Its links open the dashboard URL you set. ## Set it up Open **Settings → Email** and pick your provider. A provider fills in the host, port, encryption and, where it has one, the username. For anything else, pick **Other SMTP server**. | Field | What to enter | | --- | --- | | Host | The SMTP server's host name, like `smtp.resend.com` | | Port | `587` for STARTTLS or `465` for TLS. A local relay often uses `25`. | | Encryption | **STARTTLS** on port 587, **TLS** on port 465, or **None** for a relay on your own network | | Username | The SMTP login. Leave it empty if the server needs none. | | Password | The SMTP password. Pyo stores it [encrypted](https://pyo.dev/docs/encryption). Leave it empty to keep the saved one. | | From name | The sender's name. It starts as `Pyo`. | | From address | An address on a domain your provider lets you send from | | Dashboard URL | The address your team opens Pyo at. Links in emails use it. | In the API and CLI, the encryption values are `starttls`, `tls` and `none`. Click **Save**. The settings apply to every team. ## Send a test email After saving, click **Send test email**. Pyo sends it to your own address. If it fails, the page shows the SMTP server's answer, like a wrong password or a timeout. ## Blocked ports Some hosts block outgoing mail ports to stop spam. Hetzner, for example, blocks ports 25 and 465 by default. A test email then times out. Use port 587 with STARTTLS, or another port your provider offers, like Resend's 2587. ## Example: Resend 1. In Resend, add your domain and verify it. 2. Create an API key with sending access. 3. In Pyo, pick **Resend** as the provider. It fills in host `smtp.resend.com`, port `587`, **STARTTLS** and username `resend`. 4. Paste the API key as the password. 5. Use an address on the verified domain as the from address, like `pyo@example.com`. 6. Save, then send a test email. ## Turn it off **Turn off email** at the bottom of the page removes the settings. Email stops for every team. --- # Protecting secrets How Pyo protects what you trust it with. ## Your secrets Each team has its own key, which encrypts its environment variables. Find it under **Security**, in the sidebar's Infrastructure section. Rotating a team's key re-encrypts every stored variable. Running services aren't affected. ## The master key A master key protects the team keys. Keep it locally, or in OpenBao or Vault. Pyo's saved credentials and its own backups use the local master key directly. Read about [rotating it](https://pyo.dev/docs/system-reference#encryption) before you change it. ## Other credentials Registry and SMTP passwords, deploy hook tokens and certificate keys are also encrypted at rest. ## On your clusters New clusters encrypt Kubernetes Secrets at rest. Your services run under the Pod Security baseline. The Pyo agent only changes your projects and Pyo's own parts. It can't read Secrets outside those or run privileged services. It can't use a server's files either, except for Pyo's own builds, metrics and GPU support. You can limit it further with an [agent policy](https://pyo.dev/docs/system-reference#agent-policy). The team's **Security** settings show whether each cluster's agent is limited. --- # Importing external secrets Import secrets into your services from Vault, AWS, GCP, Azure, Doppler and more. If your team already keeps its secrets in a secret manager, your services can read them from there. You don't need to copy them into Pyo. ## Connect a store Open **Integrations** in the sidebar's **Team** section. Choose **Connect** under **Secret stores** and pick your provider. Pyo checks the connection before saving. Team owners and admins can do this from the dashboard, but not with an API key. | Provider | What you need | | --- | --- | | HashiCorp Vault | The address, the KV v2 mount (`secret` by default) and a token | | OpenBao | The same as Vault | | Infisical | The address, a project ID, an environment, and a machine identity's Universal Auth client ID and secret | | AWS Secrets Manager | The region, and an access key allowed `secretsmanager:GetSecretValue` | | GCP Secret Manager | A service account's JSON key, with the Secret Manager Secret Accessor role | | Azure Key Vault | The vault URL, and a tenant ID, client ID and client secret for an app allowed to read secrets | | Doppler | A service token for the config you want | Give Pyo read-only access to only what it needs. For Vault and OpenBao, the token also needs to read `auth/token/lookup-self` so Pyo can check it. Pyo doesn't renew tokens. Use a long-lived token, and update it under **Edit** before it expires. Any address you enter must use `https://`. Plain `http://` only works on a private network, such as [Tailscale](https://pyo.dev/docs/tailscale). An installation can turn off private networks with [`PYO_ALLOW_PRIVATE_NETWORKS`](https://pyo.dev/docs/system-reference#installation-settings). Pyo Cloud does this. Pyo's own server and cluster network are never allowed. For AWS, GCP and Azure, connecting only checks that the login works. Use **Check** on a service to confirm it can read a secret. Temporary AWS credentials stop working when they expire, so use a long-lived access key. ## Import into a service Open the service's **Settings** tab, then **Environment**. Under **Imported secrets**, choose a store, enter a path and choose **Check**. Pyo shows the names it found, never the values. Choose **Add**, then redeploy. - For Vault and OpenBao, the path is the secret's path, like `app/production`. - For Infisical, the path is a folder in the store's environment, like `/backend`. - For AWS, GCP and Azure, the path is the secret's name. - For Doppler, there's no path. A service token reads its whole config. In AWS, GCP and Azure, a secret holding a JSON object becomes one variable per field. Any other secret becomes one variable named after it, so `prod/stripe-key` becomes `STRIPE_KEY`. A service can import more than one path. If a name appears twice, the service's own variables win. After those, earlier imports win over later ones. Names that aren't valid environment variables are skipped. ## When secrets update Pyo reads your store each time the service deploys. Changing a secret in your store doesn't affect running services. Redeploy to pick up the change. Once read, values are encrypted with your [team's key](https://pyo.dev/docs/encryption) and stored with that deployment. That means: - Running services keep working if your store goes down. - A [rollback](https://pyo.dev/docs/deploy/rollbacks) restores that version's values without needing the store. - If Pyo can't reach your store during a new deploy, the deploy stops instead of starting without its secrets. > Removing a secret from your store doesn't remove it from past deployments. If a secret leaks, rotate it in the service it belongs to, then redeploy. --- # Firewall Choose who can reach a service, by address, range, country or CDN. Pyo's firewall decides who can reach a service over public traffic, and how often. You set it per service on the service's **Firewall** tab, under **Access**. With no rules, everyone gets in. Developers can change the rules. The [web application firewall](https://pyo.dev/docs/waf) has its own section on the same tab. ## Rules Choose **Add rule**, then say which clients the rule matches: - **IP address**, like `203.0.113.7` - **IP range**, IPv4 or IPv6, like `198.51.100.0/24` - **Country** - **Network**, a [preset](#presets) like **Cloudflare** or **Tailnet** - **Any client** For the first four, pick **is in** or **is not in**, and list up to 50 values. Then pick the action: - **Block** turns the client away. Websites answer with a plain "access denied" page, status `403`. - **Allow** lets the client in. - **Rate limit** lets the client in, up to a number of **requests** a second or a minute. You can give the rule a **Name**. Each service can have up to 500 rules. ## Order Allow and block rules are checked from the top, in the order they're numbered. The first rule that matches decides, and the rest are skipped. If no rule matches a client, it gets in. Use **Move up** and **Move down** in a rule's menu to change the order. New rules go last. To let in only some clients, allow them, then block everyone else: 1. **Allow** if client IP is in `203.0.113.0/24` 2. **Block** any client Or in one rule: **Block** if client IP is not in `203.0.113.0/24`. A TCP port's own **IP filter** is checked before the service's rules. It can only narrow them. ## Presets A preset is a named list of address ranges that Pyo keeps up to date. Use it in a rule like any address or range. | Preset | What it holds | | --- | --- | | **Cloudflare** | Cloudflare's edge, from [cloudflare.com/ips](https://www.cloudflare.com/ips/) | | **Fastly** | Fastly's edge, from its [public IP list](https://api.fastly.com/public-ip-list) | | **bunny.net** | bunny.net's edge servers, from its [edge server list](https://api.bunny.net/system/edgeserverlist) for IPv4 and IPv6 | | **Amazon CloudFront** | The addresses CloudFront reaches your servers from (`CLOUDFRONT_ORIGIN_FACING` in [AWS's IP ranges](https://ip-ranges.amazonaws.com/ip-ranges.json)) | | **Tailnet** | Tailscale's addresses, `100.64.0.0/10` and `fd7a:115c:a1e0::/48` | | **Private networks** | `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16` and `fc00::/7` | Pyo fetches the CDN lists from each provider once a day. If a fetch fails, it keeps the last list it got. Pyo also ships with a copy of each list, so presets work on a server without internet access. Rules keep the preset's name, so they always use the current list. To let only a CDN reach a service: **Block** if client IP is not in **Cloudflare**. To see who the visitors are behind it, turn on [Behind Cloudflare](#behind-cloudflare) instead. A CDN's list can hold hundreds of ranges, so rate limits can't use one. **Tailnet** and **Private networks** work in rate limits, and count as 2 and 4 of the 16 values. A service's rules can list up to 8,192 ranges in all, with presets counted by their ranges. ## Behind Cloudflare Turn on **Behind Cloudflare** on the service's **Firewall** tab when your service's domains are proxied by Cloudflare (the orange cloud). Then: - Only Cloudflare can reach the service's websites. The rule list shows this first, as **Added by Behind Cloudflare**. - The firewall, rate limits and analytics see the real visitor, the address Cloudflare sends in `CF-Connecting-IP`. Country rules use the visitor's country. Pyo Gateway only reads the visitor's address from a connection that comes from Cloudflare's current ranges. It takes the address Cloudflare adds to `X-Forwarded-For`, which is the same one it sends in `CF-Connecting-IP`. A client that connects directly is turned away, whatever headers it sends. Domains through [Cloudflare Tunnel](https://pyo.dev/docs/cloudflare-tunnel) don't need this switch. Pyo Gateway takes their visitor only from the tunnel's connectors, and once a domain is switched, only the tunnel gets in. Set Cloudflare's SSL/TLS mode to **Full (strict)**. Over plain HTTP, Pyo Gateway only checks that the request came from Cloudflare. Your other rules and rate limits apply over HTTPS. Behind Cloudflare applies to websites. It doesn't change TCP and UDP ports. > Let's Encrypt can always reach `/.well-known/acme-challenge/`, whatever the firewall says, so certificates keep renewing. This holds for every service, behind Cloudflare or not. ## Rate limits Rate limits apply to websites. They count the requests that got past the allow and block rules. They're listed last, without a number, because their order doesn't matter. Every rate limit that matches a request counts it. Each client IP is counted separately, and each server keeps its own count. Over a limit, the client gets `429 Too Many Requests`. A rate limit can't match countries. With **is not in**, it takes one address or range. A service's rate limits can have up to 16 values in total. **Any client** uses 2 of them. ## What it covers | Traffic | Addresses and ranges | Countries | Rate limits | | --- | --- | --- | --- | | Websites | Yes | Yes | Yes | | TCP ports through [Pyo Gateway](https://pyo.dev/docs/gateway#tcp-and-udp-ports) | Yes | No | No | | UDP ports, and ports with the gateway turned off | Yes | No | No | The firewall doesn't cover **Port on every server** ports, or your servers' own SSH and system ports. For those, see [Hardening your server](https://pyo.dev/docs/hardening-your-server). > Countries only work for websites. TCP and UDP ports never see a client's country. On those ports, a country is never **in** a list and always **not in** one. So a rule like **Block** if country is not in Germany blocks everyone on those ports. Use address rules for them. ## Countries Pyo finds a visitor's country with an IP-location database (GeoLite2 Country) built into the gateway. The gateway doesn't download anything for it. Country rules work on every website domain. On a domain behind Cloudflare or through Cloudflare Tunnel, Pyo uses the country Cloudflare sends with each request. Cloudflare's IP geolocation must be on (it is by default). If it's off, country rules match no one there, and "is not in" rules block everyone. Visitors that Cloudflare can't place count as country XX. > Elsewhere, websites identify visitors by the address they connect from, or by the [PROXY protocol](https://pyo.dev/docs/gateway#proxy-protocol-on-websites) header. They don't trust the `X-Forwarded-For` header, because a client could put any address there. So behind another CDN or proxy, every visitor looks like that proxy, and country rules see its location. ## See what was turned away Under **Analytics**, the service's **Firewall** tab shows the requests and TCP connections that were turned away. You see them over time, with the top rules, countries, addresses and paths. The latest ones show the rule that matched: - the rule's name - **Behind Cloudflare**, if the request didn't come from Cloudflare - **A removed rule**, if the rule has since been deleted - **A firewall rule** or **Over a rate limit**, if no rule matches the client now UDP ports and ports with the gateway turned off aren't counted. Findings from the [web application firewall](https://pyo.dev/docs/waf#findings) show up in the same list. ## Don't lock yourself out If the dashboard runs on the service's cluster and the change would block your own address, Pyo warns you with **This would block you**. Type `confirm` to apply it anyway. ## From the API and MCP Change the firewall with the [addFirewallRule](https://pyo.dev/docs/api/reference/firewall/add-firewall-rule), [updateFirewallRule](https://pyo.dev/docs/api/reference/firewall/update-firewall-rule), [reorderFirewallRules](https://pyo.dev/docs/api/reference/firewall/reorder-firewall-rules) and [removeFirewallRule](https://pyo.dev/docs/api/reference/firewall/remove-firewall-rule) operations. A rule's `action` is `allow`, `block` or `rateLimit`. Its `operator` is `in` or `notIn`. Its `sources` are the addresses, ranges or country codes, or presets: `cloudflare`, `fastly`, `bunny`, `cloudfront`, `tailnet` and `private`. Leave `sources` empty to match any client. A rate limit adds `requests` and `per` (`second` or `minute`). Turn Behind Cloudflare on or off with [setServiceBehindCdn](https://pyo.dev/docs/api/reference/firewall/set-service-behind-cdn) and `cdn` set to `cloudflare` or `null`. Services show it as `behindCdn`. AI assistants use the `add_firewall_rule`, `update_firewall_rule`, `reorder_firewall_rules`, `remove_firewall_rule`, `set_service_behind_cdn` and `get_firewall_blocked` [tools](https://pyo.dev/docs/mcp/tools#firewall). From the CLI, use [`pyo firewall`](https://pyo.dev/docs/cli/commands#pyo-firewall). ## Web application firewall To check the content of website requests for attacks like SQL injection, turn on the [web application firewall](https://pyo.dev/docs/waf) on the service's **Firewall** tab. --- # Making your first deploy Go from a fresh install to a live service. After you set up your account, the dashboard walks you through these steps. Here's what each one does. ## 1. Your server and builder A cluster is the server, or group of servers, that runs your services. On a fresh install, the server Pyo runs on is already your first cluster. It has a [builder](https://pyo.dev/docs/builders) for Git deploys. You can add more servers later in [Servers](https://pyo.dev/docs/servers). ## 2. Choose what to run Pick one of these sources: - **Git repository:** Pyo builds it with your Dockerfile, or with zero configuration. That includes [static sites](https://pyo.dev/docs/deploy/static-sites). - **Container image:** any image from a public registry, or a private one you've saved a login for. - **Template:** a ready-to-run database, tool or service from [Templates](https://pyo.dev/docs/templates). - **Compose file:** a project with a service for each Compose service. See [Importing Docker Compose](https://pyo.dev/docs/deploy/compose). ## 3. Deploy Pyo builds the image if needed, starts the service and follows the rollout. You can watch the logs live. If the deploy fails, Pyo puts the previous version back automatically. The deploy step says where your service will open. On a server with a public IP, it's live on the web with HTTPS. With free domains on [Tailscale](https://pyo.dev/docs/tailscale), it's on your tailnet. ### On a home server A server at home, behind NAT and without Tailscale, gets no free domain. Your first service then opens on your own network over plain HTTP, at the server's address and a port Pyo picks, like `http://192.168.1.20:31234`. The deployment page shows the address. For HTTPS, set up [Tailscale](https://pyo.dev/docs/tailscale). Or forward ports 80 and 443 on your router to the server and add your own domain. ## 4. Put it on the web Add a domain to the service. A free domain works right away with no DNS setup. You can add your own domain at any time. See [Adding a domain](https://pyo.dev/docs/domains). ## Next - Deploy from your terminal with the [`pyo` CLI](https://pyo.dev/docs/cli). - [Deploy on every push](https://pyo.dev/docs/deploy#deploy-on-every-push) from GitHub. --- # Pyo Gateway How web requests and public TCP and UDP ports reach your services, and why the gateway can't read your secrets. Every web request to your sites, and every connection to a public TCP or UDP port, goes through Pyo Gateway on the server it reaches. For websites, the gateway picks the certificate for the domain and passes the request to one of the service's replicas. Pyo Gateway is built on [Envoy](https://gateway.envoyproxy.io). Pyo installs and updates it for you. ## How a request travels 1. A visitor's request reaches a server in your cluster. Every server runs the gateway on ports 80 and 443, including GPU servers. Build-only servers don't. A cluster with [public traffic](https://pyo.dev/docs/clusters#public-traffic) turned off answers on none of them. If another program in the cluster holds those ports on a server, the gateway can't answer there. See [Public traffic](https://pyo.dev/docs/clusters#public-traffic). With [free domains](https://pyo.dev/docs/domains#free-domains) on Tailscale, each server also answers on its Tailscale address, whether public traffic is on or off. 2. The gateway answers on HTTPS with the domain's own certificate. That's a Let's Encrypt certificate, a self-signed one for a private domain, or one you [uploaded](https://pyo.dev/docs/certificates). Plain HTTP redirects to HTTPS if the domain is set to redirect. Otherwise, plain HTTP gets an answer too. 3. With [Cloudflare Tunnel](https://pyo.dev/docs/cloudflare-tunnel), the request doesn't reach a server's ports at all. Cloudflare passes it to the tunnel's connector in your cluster, which hands it to the gateway inside the cluster. The gateway then takes the visitor's address only from the connector. 4. The gateway sends the request to the service, and the cluster picks a replica. It picks one on the same server, in the same region or anywhere, based on the cluster's [traffic routing](https://pyo.dev/docs/regions#how-traffic-is-routed). Deleting a service removes its routes and certificates. Every 10 minutes, Pyo also removes any routes left without a service. The gateway sees the visitor's real address when traffic arrives on one of the addresses the cluster lists for its servers. On the server Pyo runs on, this also works for its tailnet address, and so does every server's Tailscale address while free domains use it. Traffic that reaches a server on any other address seems to come from the cluster's load balancer. Then the firewall, rate limits and analytics can't see the visitor. The gateway doesn't take the visitor's address from the `X-Forwarded-For` header, because any client can write any address there. Behind a tunnel of your own, a CDN or another proxy, every visitor seems to come from it. If it can send [PROXY protocol](#proxy-protocol-on-websites), turn that on. Behind Cloudflare, turn on the service's [Behind Cloudflare](https://pyo.dev/docs/firewall#behind-cloudflare) switch. Then the gateway reads the visitor's address only from Cloudflare's own connections. The gateway also removes headers a client sends to name a visitor: `CF-Connecting-IP`, `CF-Connecting-IPv6`, `True-Client-IP`, `Fastly-Client-IP`, `X-Real-IP`, `X-Client-IP` and `Forwarded`. They only get through where your CDN is the only one who can connect. See [Client IP headers](https://pyo.dev/docs/securing-pyo#client-ip-headers). ### PROXY protocol on websites If your cluster sits behind your own load balancer or tunnel that sends PROXY protocol, turn on **PROXY protocol** in the cluster's [gateway settings](#settings). Websites then see each visitor's real address, and so do analytics. Connections without the header keep working. > With this on, anyone who can reach your servers directly can claim any address. Only use it when your servers accept traffic from that load balancer and nothing else. ## TCP and UDP ports Public TCP and UDP ports, for a game server or a database for example, go through the gateway too, unless you [turn it off for a port](https://pyo.dev/docs/domains#public-tcp-and-udp-ports). For both, the gateway counts [connections](https://pyo.dev/docs/observability#connections) in analytics. For TCP ports, it can also: - allow or block addresses and ranges - limit how many connections a port has open at once - send PROXY protocol, version 1 or 2, to your service, so it learns each visitor's address. Your service must expect it. - accept PROXY protocol from a load balancer in front of Pyo. This only works for protocols where the client speaks first, like HTTP and TLS. Connections may stall with protocols where the server speaks first, like SSH, SMTP or MySQL, or with very short client messages. UDP ports go through the gateway and are counted, but have none of these options. The [firewall](https://pyo.dev/docs/firewall) works on top of these, per service. It also covers UDP ports and ports outside the gateway. A port with the gateway turned off is opened directly on the servers. Your service sees each visitor's address itself, but the port has no analytics or options. ## Gateway settings Each cluster has a **Gateway** panel on its **Settings** tab, under **Traffic**. It shows the gateway on each server and a few settings for every service on the cluster. Team owners and admins change them. Developers and viewers see them. ### Status - **Controller**: Envoy Gateway's controller. It turns your services' routes into the proxies' settings. - **Proxy**: the proxy on each server, with its version and when it last started. A server that should run one and doesn't is listed as not ready. Build-only servers run none. - **Firewall**: the [WAF](https://pyo.dev/docs/waf) on each server, while a service has it on. ### Settings | Setting | What it does | Open connections when you save | |---|---|---| | HTTP/2 | Always on for HTTPS. | | | HTTP/3 | Websites also answer HTTP/3, on UDP port 443. Needs public ports on. Browsers use HTTP/2 where UDP is blocked. | Drop once on each server's public ports, one server at a time | | Compression | Zstd, Brotli and Gzip on HTTPS answers, whichever the browser accepts first. Images, video and answers that are already compressed are left as they are. | Stay open | | TLS minimum | 1.2 or 1.3. With 1.3, clients that only speak TLS 1.2 can't connect. | Every HTTPS connection drops once | | PROXY protocol | Websites read each visitor's address from the [PROXY protocol](#proxy-protocol-on-websites) header. Only for a load balancer that sends it on every connection. Needs public ports on. Saves on its own, without **Save**. | Every web connection drops once | | Request timeout | How long a request may take, for services without their own. 300 seconds unless you change it, 0 for no limit. | Stay open | | Idle timeout | How long a WebSocket or stream may stay quiet, for every service. 1 hour unless you change it. | Stay open | The dashboard asks before a save that drops connections. Visitors reconnect by themselves. WebSockets and uploads still running are cut. > HTTP/3 needs UDP port 443 open to every server. Open it in your provider's firewall: Pyo can't see that firewall. If a service publishes UDP port 443 itself, free it first. With compression on, the gateway compresses answers itself and asks your service for uncompressed ones. Files your service keeps compressed (`.br`, `.gz`) aren't used then. Plain HTTP isn't compressed. These settings need the cluster's agent from Pyo 0.52.0, with the cluster's connect command run once. Until then the panel says what to do. The request timeout and PROXY protocol work with any agent. From the CLI: [`pyo cluster gateway`](https://pyo.dev/docs/cli/commands#pyo-cluster-gateway). ## The problem with most proxies Most web proxies for clusters, including Traefik and ingress-nginx, work the same way by default. Traefik's standard install, which comes with k3s, is one example. Here's why that matters for Pyo: 1. Each site's HTTPS certificate is stored as a Secret. The cluster requires it to be in the same namespace as the route that uses it, which in Pyo is the service's project. 2. Pyo keeps each service's environment variables, like database passwords and API keys, as Secrets in that same project. 3. The proxy serves every site, so it has to find every certificate. The cluster's permissions can't say "only Secrets that are certificates". So the proxy gets read access to all Secrets in every project it serves, including variables. 4. That proxy is the one program that handles public traffic. If it ever has a bug, whatever it can see is within reach. That includes every project's variables. In 2025, a bug in ingress-nginx called IngressNightmare (CVE-2025-1974) showed how this can happen. 5. Narrowing the proxy to fewer projects doesn't help. It still serves every project, and each project keeps certificates and variables side by side. ## A gateway that holds no keys Pyo should be secure out of the box, without settings you have to know to turn on. So instead of the default most proxies use, Pyo Gateway makes two changes together: - **Certificates live in one place of their own,** separate from every project. Projects then only hold your services' secrets. - **The part that handles public traffic holds no cluster credentials,** so it has no way to read Secrets. Traefik can do the first with the Gateway API, but not the second. It's one program that both handles public traffic and reads certificates from the cluster. Pyo Gateway is built in two parts, so it does both: - **A controller,** which never handles public traffic, reads the routes and only the certificates they use. - **The proxies,** which handle public traffic, hold no cluster credentials at all. They get their routes and certificates from the controller. The proxies only ever see the certificates they're serving. They can't read Secrets or talk to the cluster. In Pyo, the controller and the certificates live in their own area, `pyo-gateway`, and the controller only reads there. It can't read a project's Secrets. The **Security** page shows this for each cluster as **Gateway can't read your secrets**. Pyo Gateway is also built for the Gateway API from the start, not added on later. Each domain of a service gets one route, and certificates are kept in one place. Pyo makes sure a domain belongs to only one service across your whole Pyo, and refuses it for any other. The trade-off is small. Per server, the gateway uses about as much memory as Traefik. The controller adds about 40 MB, once per cluster. ## Compared with Traefik With [Cloudflare Tunnel](https://pyo.dev/docs/cloudflare-tunnel), Pyo Gateway takes no ports 80 and 443 on the servers, so it runs next to Traefik on the same server. That's how you move sites from Traefik to Pyo one at a time. ## What stays the same - [Traffic routing](https://pyo.dev/docs/regions#how-traffic-is-routed): Local, Regional or Global. - The visitor's real address, also from a load balancer that sends PROXY protocol. - The [CDN certificate check](https://pyo.dev/docs/securing-pyo#require-the-cdns-certificate-with-mtls), turned on per cluster. - Redirecting HTTP to HTTPS, for domains set to redirect. - Let's Encrypt's checks, which reach your server through the gateway. - [Free domains](https://pyo.dev/docs/domains#free-domains), and certificates issued for you. - [Analytics](https://pyo.dev/docs/observability#analytics), read from the gateway's request log. --- # Getting back in Choose a new password when you can't sign in. Lost your password? Pyo gives you a one-time sign-in link to choose a new one. There are three ways to get one. Every link works once, for 30 minutes. A new link for the same account replaces the old one. Using a link sets your new password, signs you in and signs the account out of its other sessions. With [two-factor authentication](https://pyo.dev/docs/two-factor) on, Pyo asks for a code after you choose your new password. A link from the server is the exception. ## On the server Run this on the server Pyo runs on: ```bash sudo pyo-reset-login ``` It prints a link for Pyo's admin. To get one for another account, add its email: ```bash sudo pyo-reset-login you@example.com ``` The link is printed at Pyo's HTTPS address, its address on your network and `localhost`. Open any of them. This is how the only admin gets back in. It needs no email setup, only access to the server. A link from the server also turns off two-factor authentication for that account. That's how you get back in after losing both your authenticator app and your recovery codes. Set two-factor up again once you're in. For an installation admin, a link from the server also turns off the [admin sign-in](https://pyo.dev/docs/admin-sign-in) rule. Links from the other two ways don't. For an admin, they only work from an allowed address. ## Forgot password? The sign-in page shows **Forgot password?** when [email](https://pyo.dev/docs/email) is set up. Enter your email, and Pyo sends a link to it. The page says the same thing whether or not an account has that address. ## A team owner resets it A team owner can reset a member's sign-in under **Members**, from the member's menu with **Reset sign-in**. - With [email](https://pyo.dev/docs/email) set up, Pyo emails the link to the member. - Without email, the owner gets the link to copy and pass on. This only works for a member who belongs to that team only. For anyone else, set up email or use `pyo-reset-login`. Each reset is recorded in the team's **Activity** and [audit log](https://pyo.dev/docs/audit-log). --- # Connecting GitHub Private repositories and deploys on every push. Pyo connects to GitHub through a GitHub App that belongs to your own installation. ## Set up the GitHub App An installation admin creates the GitHub App once, under **Settings → GitHub** (`/github`). Pyo uses GitHub's own setup flow, so there are no keys to copy. ## Connect a team Under **Integrations**, in the sidebar's **Team** section, install the GitHub App on a GitHub account or organization. Choose which repositories it can see. GitHub then asks you to authorize it, so Pyo can check that your GitHub account has access to that installation. The **GitHub** card connects only this team's accounts. If the GitHub App isn't set up yet, ask an installation admin. An installation belongs to one team. To move it to another team, disconnect it from the first one. ## Deploy Pick a repository in **New deploy**. Private repositories work. Each push to the service's branch deploys it, and you can turn that off per service. Each pull request can get its own [preview](https://pyo.dev/docs/deploy/previews). Previews need a few more [permissions](https://pyo.dev/docs/deploy/previews#github-app-permissions) from the GitHub App. --- # Connecting GitLab Deploy from gitlab.com or your own GitLab, with deploys on every push. A team connects GitLab with an access token. It works with gitlab.com and with your own GitLab. A team can connect several, such as gitlab.com and its own GitLab. ## Create a token A **group access token** is best. It belongs to the group, not to one person, so it keeps working when people leave. 1. In GitLab, open the group, then **Settings → Access tokens**. 2. Choose **Add new token** and give it a name, like `Pyo`. 3. Set **Role** to **Maintainer**. Pyo needs it to add webhooks and to make deploy tokens for builds. 4. Under **Scopes**, select **api**. Pyo needs nothing else. 5. Set an expiry date, then choose **Create group access token** and copy it. A project access token works the same way for a single project. On gitlab.com, group and project access tokens need a paid plan. On the Free plan, use a personal access token with the **api** scope, ideally of a separate user that's a Maintainer of the projects. ## Connect a team Open **Integrations** in the sidebar's **Team** section. Under **Git providers**, choose **Connect** next to **GitLab**. Enter the GitLab URL (`https://gitlab.com` or your own) and the token. Pyo checks the token before saving and seals it with the team's key. Team owners and admins can do this from the dashboard, but not with an API key. Each connection has these buttons: - **Test** says what the token can do, and what's missing: the **api** scope, the Maintainer role, or an expiry date coming soon. - **Replace** saves a new token, for example before the old one expires. - **Remove** disconnects GitLab and removes the webhooks Pyo made. A connection can't be removed while a service deploys from it. ## Deploy In **New deploy**, pick a project under **Your GitLab projects**, then a branch. Pyo lists the projects the token has the Maintainer role on. Builds never get the connection's token. When a builder starts a build, Pyo makes a GitLab deploy token for that repository. It can only read the code, expires within the hour, and Pyo revokes it when the build ends. It's never written to the build's logs or image. Each deploy shows on its commit in GitLab as a **Pyo** status: pending, running, then passed, failed or canceled. The status links to the deployment. Each merge request can get its own [preview](https://pyo.dev/docs/deploy/previews). ## Deploys on push Pyo adds a webhook to each project its services deploy from, for push events. The webhook sends a secret that Pyo checks, so nobody else can trigger deploys. Pyo removes the webhook when no service deploys from the project any more. Each push to a service's branch deploys it. You can turn that off per service under **Settings → Git**. A push doesn't deploy a service that's rolled back or pinned to a commit. GitLab has to reach Pyo for webhooks. gitlab.com, or any GitLab on the internet, gets Pyo's public address. A GitLab on a private network or your tailnet gets Pyo's tailnet address first. When Pyo has no address GitLab can reach, such as gitlab.com and a Pyo only on your tailnet, Pyo checks the branch every minute instead. **Test** says when there's no webhook. ## Your own GitLab Pyo calls your GitLab from its own server, and checks the address each time it connects. Pyo never calls its own server or its cluster's network. It calls addresses on a private network, like your LAN or [Tailscale](https://pyo.dev/docs/tailscale), unless the installation sets [`PYO_ALLOW_PRIVATE_NETWORKS`](https://pyo.dev/docs/system-reference#installation-settings) to `false`. Use `https://`. Plain `http://` only works on a private network. Pyo doesn't follow redirects, so enter GitLab's final address. If Pyo is on a private address, GitLab only sends it webhooks when an admin allows it: **Admin → Settings → Network → Outbound requests → Allow requests to the local network from webhooks and integrations**. Without it, Pyo checks branches every minute. --- # Running AI models on GPUs Give services whole NVIDIA GPUs, for AI models and other GPU work. Pyo can run services on NVIDIA GPUs. Other GPU makers aren't supported. ## Prepare the server 1. Install the NVIDIA driver before you add the server, and reboot if the installer asks. Check that `nvidia-smi` works. Pyo never installs a driver. 2. [Add the server](https://pyo.dev/docs/servers) as usual. On Debian, Ubuntu, RHEL and Fedora, the command also installs the NVIDIA Container Toolkit. On other systems, install the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) yourself, then restart k3s. Pyo then sets up GPU support on that cluster automatically. ## See your GPUs The **Clusters** page and a cluster's **Servers** tab have a GPU column. A server that isn't ready shows **GPU not ready** and the reason, such as a missing driver. A server's page has a GPU panel with its details. ## GPU servers By default, a GPU server is reserved for services that use GPUs and shows a **GPU only** tag. Other services run elsewhere. To let other services use it too, turn on **Run regular services on this server** on the server's page. A GPU server isn't reserved for GPU services if it's the cluster's main server, or if the cluster has no other ready server. ## Give a service GPUs Set the number of GPUs in **GPUs**, under **Resources** on the service's **Settings** tab. You can also set it under **Resources** when you deploy. A service gets 1 to 8 whole GPUs, all on one server. The option shows once the service's cluster has a GPU server. Models can take minutes to load. Give the [health check](https://pyo.dev/docs/deploy#health-checks) a long initial delay so Pyo doesn't give up on the new version while it's still loading. ## Limits - A GPU can't be shared between services. - Services with GPUs can't autoscale. - A deploy stops the running replica before it starts the new one, so the service is briefly down. This doesn't happen if a spare GPU is free. --- # Hardening your server Lock down the machine Pyo runs on, from SSH to system updates. Anyone with root on your server controls Pyo and everything it runs, so these steps matter as much as the ones in [Securing Pyo](https://pyo.dev/docs/securing-pyo). Do them on every server in your cluster. ## Lock down SSH Sign in with keys instead of passwords, and limit who can reach the port. 1. Check that you can sign in with an SSH key. 2. Add this to `/etc/ssh/sshd_config.d/00-hardening.conf`: ```text PasswordAuthentication no KbdInteractiveAuthentication no PermitRootLogin no ``` `PermitRootLogin no` needs a normal user with `sudo`, so create one first if you sign in as root. 3. Check the file and reload SSH. On Fedora and RHEL, the service is called `sshd`: ```bash sudo sshd -t && sudo systemctl reload ssh ``` 4. Keep your current session open and test a new one, so a mistake can't lock you out. Then, in your provider's firewall, allow port 22 only from your own address or your private network. With [Tailscale](https://pyo.dev/docs/tailscale), you can close it to the internet completely. Once it's closed, tools like fail2ban have little left to do. ## Keep the system patched Turn on automatic security updates. On Debian and Ubuntu: ```bash sudo apt install unattended-upgrades sudo dpkg-reconfigure -plow unattended-upgrades ``` On Fedora and RHEL, use `dnf-automatic` and set `apply_updates = yes` in its configuration. Kernel updates need a reboot, so plan for one regularly. Services with a single replica go down until the server is back. For services that can't go down, run [two or more replicas](https://pyo.dev/docs/scaling) across servers. ## Limit who has root - Give `sudo` only to the people who manage the server, each with their own account. - Remove accounts and SSH keys when people leave. - Keep `/etc/rancher/k3s/k3s.yaml` readable by root only. It gives full control of the cluster. - Don't add anyone to the `docker` group or run unrelated software on the server. Both make it easier to get root. ## Protect data on disk Pyo encrypts your [secrets](https://pyo.dev/docs/encryption), but not what your services write to their [volumes](https://pyo.dev/docs/volumes), like database files. - Use your provider's encrypted disks, or full-disk encryption on your own hardware. This matters most on a laptop or a machine in a shared space. - Wipe disks before you hand back or retire a server. - Don't rely on provider snapshots alone. They hold the same data, so limit who can access them, and keep [backups](https://pyo.dev/docs/backups) too. ## Limit your cloud account - Protect your provider account with two-factor sign-in. Whoever controls it controls your servers and firewall, whatever else you've done. - Don't give the server cloud credentials or an instance role it doesn't need. Pyo doesn't block your provider's metadata service, so a compromised service could read from it. If your provider's settings allow it, block containers from reaching it. ## Close ports 80 and 443 With [Cloudflare Tunnel](https://pyo.dev/docs/cloudflare-tunnel), your websites need no open ports. Close 80 and 443 in your cloud provider's firewall. The tunnel's connector only needs to reach Cloudflare on TCP port 7844, outbound. ## Check it from outside From a different network, scan your server's public address: ```bash nmap -Pn your-server-ip ``` Only the ports you meant to open should show as open. Run this again after any firewall or provider change. --- # Servers at Hetzner Let Pyo make servers in your Hetzner Cloud project and join them to a cluster. Pyo can make servers for you in [Hetzner Cloud](https://www.hetzner.com/cloud). It creates the server, joins it to a cluster over your [tailnet](https://pyo.dev/docs/tailscale), and deletes it again when you remove it. You pay Hetzner for the servers as usual. ## Before you start - [Tailscale](https://pyo.dev/docs/tailscale) is set up in Pyo. Servers at Hetzner join over your tailnet. - You're an owner or admin of the team. The Hetzner token belongs to the team, like its clusters, so servers it makes are billed to that team's Hetzner project. ## Make a token 1. Open the [Hetzner Console](https://console.hetzner.cloud) and pick the project Pyo should use. A project of its own keeps Pyo's servers apart from the rest. 2. Open **Security › API tokens** and choose **Generate API token**. 3. Name it `pyo` and choose **Read & Write**. Pyo can't make servers with a read-only token. 4. Copy the token. Hetzner shows it once. ## Connect it In Pyo, open **Integrations** and paste the token on the **Hetzner** card. Pyo checks it by listing Hetzner's locations before saving it. **Test** lists them again, **Replace** takes a new token and **Remove** forgets it. ## Add a server Open a cluster, choose **Add server**, then **Hetzner**: 1. Name the server and pick its role: it **runs services**, or it **builds only**. 2. Pick a location and a server type. Pyo reads the types, their specs and their monthly prices from Hetzner as you pick. Prices are before VAT and include the server's IPv4 address. Pyo's servers run x86-64, so Arm types can't be picked. 3. Optionally paste your SSH public key, to sign in to the server over your tailnet. 4. Choose **Create**. Pyo shows the monthly price and asks once more. The page then follows the server: **Creating**, **Booting**, **Joining**, **Ready**. If your tailnet has [Tailnet Lock](https://tailscale.com/kb/1226/tailnet-lock) on, Pyo shows the `tailscale lock sign` command to run on a signing device while the server joins. Pyo waits up to 15 minutes. If the server isn't ready by then, Pyo says why and offers to delete it. To make a new cluster on Hetzner, choose **Add cluster**, then **Hetzner**. Pyo makes its first server, named `-1`, and runs the same setup there that **Add cluster**'s command runs. To make a [sandbox server](https://pyo.dev/docs/sandbox#cloud-provider), open **Sandboxes**, choose **New sandbox**, then **Add server**, then **Cloud provider**. It runs sandboxes on gVisor, since Hetzner Cloud servers have no KVM. ## Remove a server Remove it from the server's page or from the **Hetzner** card. Pyo shows the monthly cost that stops and asks first. Then it: 1. Moves the server's services to the other servers and takes it out of the cluster, like [removing any server](https://pyo.dev/docs/servers#maintenance). 2. Takes it off your tailnet. 3. Deletes it at Hetzner. A cluster's first server runs the cluster, so it can be deleted only after the cluster is removed. Removing the Hetzner token leaves the servers running at Hetzner. ## What Pyo does with the token - The token is encrypted with the team's key in Pyo's database. Only Pyo uses it, and it never goes to a server. - Pyo calls only `https://api.hetzner.cloud`, to list locations, server types and prices, and to create and delete servers and a firewall. - Each server's startup script (its cloud-init) holds only one-time keys: a Tailscale key that works once and expires in an hour, and a code that works once and expires in 15 minutes. Join tokens and Pyo's Tailscale OAuth client are never in it. - On its first boot the server downloads [`pyo-server`](https://pyo.dev/docs/pyo-server) for your Pyo's release and checks it, as the dashboard's commands do. `pyo-server` installs Tailscale from Tailscale's package repository, with its signing key checked by fingerprint, and joins your tailnet with the key. Then it trades the code for the server's token at Pyo over the tailnet and runs the same setup the dashboard's command runs: `join`, `connect` or `sandbox`. The token never reaches a file or a command line. Pyo answers only servers on your tailnet. If the code expires first, the server doesn't join and Pyo offers to delete it. - The startup script turns off password sign-in over SSH, and it blocks the server's containers from Hetzner's metadata service, which serves the script again. - Each server carries the labels `pyo=` and `pyo-cluster=`. Pyo deletes only servers with its own installation's label, so it never touches the rest of your project. - Pyo makes one firewall, `pyo-`, and puts every server it makes behind it. It allows ports 80 and 443 from anywhere, and UDP 41641 for Tailscale's direct connections. Everything else is closed. Servers talk to each other over your tailnet. - Pyo doesn't add or remove servers on its own, and it doesn't resize them. ## When it doesn't work - **Server limit.** New Hetzner accounts can make only a few servers. Ask Hetzner to raise it on the **Limits** page of the Console. - **Unavailable.** A server type can sell out in a location. Pick another type or location. - **The server doesn't join.** If it never shows up on your tailnet, its setup failed. Open the server's console at Hetzner and read `/var/log/pyo-join.log`, then `/var/log/pyo-server.log`. A slow boot can outlast its 15-minute code. Then delete the server in Pyo and try again. - **Read-only token.** Make a new token with **Read & Write**. --- # Making Pyo highly available What keeps running when a server fails, and how to make Pyo itself more resilient. High availability covers two things: your services, and Pyo itself. Your services matter most, and they don't depend on Pyo to keep running. ## If Pyo goes down Pyo is the control plane. If it stops, your services keep serving traffic, because they run on your clusters and not inside Pyo. You can't deploy or change anything until it's back. ## Your services To keep a service up through a server failure: 1. Add at least two more [servers](https://pyo.dev/docs/servers) to the cluster. 2. Run two or more [replicas](https://pyo.dev/docs/scaling), or turn on autoscaling with a minimum of two. 3. Keep services stateless where you can. Replicas spread across servers, and stateless services move to a healthy server if one fails. 4. Point your domain at more than one server, through a CDN or a load balancer. If DNS points at one server's address, traffic stops when that server does. [Volumes](https://pyo.dev/docs/volumes) stay on the server that created them, so a service with a volume can't move to another server. For data that has to survive losing a server, use one of Pyo's [databases](https://pyo.dev/docs/databases) with high availability, or your database's own replication. ## What Pyo runs today | Part | Runs as | If its server fails | | --- | --- | --- | | Dashboard and API | 1 replica | Restarts on another server | | Background workers | 1 replica | Restarts on another server | | Agent | 1 replica on each cluster | Restarts on another server | | PostgreSQL | 1 replica, with a local volume | Down until that server returns | | ClickHouse | 1 replica, with a local volume | Observability pauses | | Image registry | 1 replica | No new images until it returns | | Backup store | 1 replica, with a local volume | Backups to it stop | Updates don't cause downtime, because a new replica is ready before the old one stops. The limits above are about losing a whole server. ## Make Pyo more resilient These steps remove the biggest single points of failure. Try them on a spare cluster first. ### 1. Run three k3s servers By default, a cluster has one k3s server. Three keep the cluster's control plane running if one fails. Use an odd number, and at least three. On the first server, turn on the embedded etcd datastore. Add this to `/etc/rancher/k3s/config.yaml`, then restart k3s: ```yaml cluster-init: true ``` ```bash sudo systemctl restart k3s ``` Read the join token from the first server: ```bash sudo cat /var/lib/rancher/k3s/server/token ``` Then add two more servers, using the same settings as the first, including `secrets-encryption`: ```bash curl -sfL https://get.k3s.io | K3S_TOKEN= sh -s - server \ --server https://:6443 ``` The command Pyo gives you for adding a server adds a worker, not a k3s server, so run these by hand. See the [k3s documentation](https://docs.k3s.io/datastore/ha-embedded) for details. ### 2. Use a hosted PostgreSQL Pyo keeps everything that matters in PostgreSQL, so this is the most important step. Move it to a hosted database with its own failover: 1. Create the database, then take a final copy of Pyo's database: ```bash sudo k3s kubectl -n pyo-system exec statefulset/pyo-postgres -- \ pg_dump -U pyo pyo > pyo.sql ``` 2. Restore `pyo.sql` into the new database. 3. Point Pyo at it and restart: ```bash sudo k3s kubectl -n pyo-system patch secret pyo-postgres --type merge \ -p '{"stringData":{"url":"postgres://user:password@host:5432/pyo"}}' sudo k3s kubectl -n pyo-system rollout restart deployment/pyo deployment/pyo-worker ``` Don't deploy while you do this, because changes made after the copy aren't moved. Updating Pyo keeps this setting. ### 3. Keep backups off the cluster [Back up Pyo itself](https://pyo.dev/docs/backups#backing-up-pyo-itself) to a bucket outside your cluster, and keep your [master key](https://pyo.dev/docs/securing-pyo#4-save-your-master-key) somewhere safe. With both, you can rebuild Pyo on new servers even if you lose the whole cluster. ## What isn't highly available yet Even with these steps, some parts still depend on one server: - **Image registry:** if its server is down, new builds can't be stored. Servers can't pull images they don't already have. - **ClickHouse:** there's no replica. Losing its server loses observability history, but nothing else. For most teams, this is a good trade-off. Your services stay up, and Pyo can be rebuilt from a backup. --- # Browsing images Every container image your team's services have run. **All images**, in the sidebar's **Images** menu, lists every image your services have run. They're grouped by repository, with the versions deployed and the services using them. Images Pyo built also show their size. ## Retention Pyo keeps the images of your newest successful deployments and removes older ones from its registry. Set how many deployments to keep per service under **Cleanup**, on the **Registry** page in the sidebar's **Images** menu. The **Registry** page also shows the registry's address, its health, the space it uses and its repositories. Images you [push yourself](https://pyo.dev/docs/registries#push-your-own-images) are never removed. You can't [roll back](https://pyo.dev/docs/deploy/rollbacks) to an image that's been removed. --- # Importing from another platform Move your services, Compose stacks and databases from Coolify, Dokploy, Railway or Vercel into Pyo. Pyo can bring your services over from Coolify, Dokploy, Railway or Vercel. It reads them through the platform's API, shows you what each one becomes, and imports the ones you pick. Owners and admins can import. ## Before you start Make a token on the platform: - **Coolify:** in **Keys & Tokens**, make an API token with `read` and `read:sensitive`. Without `read:sensitive`, Coolify doesn't share variable values. If the API is off, turn it on in **Settings**. - **Dokploy:** in your profile's **API/CLI** section, generate an API key. - **Railway:** in **Account Settings**, then **Tokens**, make a token. A workspace or project token works too. A project token reads one environment of one project. - **Vercel:** in **Account Settings**, then **Tokens**, make a token. Pyo uses the token only while it reads, and never stores it. ## Import ### From the dashboard 1. Choose **New → Import from a platform**. 2. Pick the **Platform** and enter its **API token**. Coolify and Dokploy also need their **Address**. For Vercel, enter a **Team** (its slug or id) to read that team instead of the token's own scope. Pick the **Cluster** to run on, then choose **Preview**. 3. Check what each project, service and database becomes. Notes say what doesn't carry over. 4. Pick what to bring. Turn on **Deploy services once imported** to deploy them now. Otherwise they're saved stopped, ready to deploy. 5. Choose **Import**. Each item shows **Created**, **Copying data**, **Imported before**, **Held**, **Not imported** or **Failed**. One failure doesn't stop the others. ### From the CLI ```bash pyo import coolify --from https://coolify.example.com --source-token ``` ```bash pyo import railway --source-token pyo import vercel --source-token --source-team ``` The CLI shows what it will create and asks before it imports. Use `dokploy` for Dokploy. Railway and Vercel need no `--from`, and `--source-team` is optional. Add `--team` or `--cluster` to choose where it goes, `--deploy` to deploy the services, and `--yes` to skip the question. ### From the API Send the platform's token, and its address for Coolify or Dokploy, to [Preview an import from another platform](https://pyo.dev/docs/api/reference/projects/preview-platform-import) to see the plan. Then import the items you pick with [Import from another platform](https://pyo.dev/docs/api/reference/projects/start-platform-import). ## What comes over - **Projects:** each project becomes a Pyo project. An environment other than production becomes a project of its own, named after both. - **Applications:** each becomes a service, built from its repository (with its Dockerfile, or with zero config) or run from its image. A GitHub repository builds through your team's [GitHub App](https://pyo.dev/docs/github) when it can reach it. - **Variables:** with secret ones encrypted. Values that are locked in Coolify can't be read: they come over empty, so set them in Pyo. - **Domains:** they go live once the service is deployed. Point their DNS at Pyo when you're ready to switch. Domains the platform made up for you, like `sslip.io` ones, are left out. - **Ports:** published ports become public TCP or UDP ports through the [gateway](https://pyo.dev/docs/gateway), when Pyo allows that port. - **Volumes:** they start empty. Copy their data yourself. - **Compose stacks:** each becomes a project of its own, as with a [Docker Compose import](https://pyo.dev/docs/deploy/compose). A Compose file from a repository isn't imported: use the Compose import from the repository. - **Databases:** Postgres and MySQL databases the platform makes reachable from outside are copied into new Pyo [databases](https://pyo.dev/docs/databases), as in [Migrating a database](https://pyo.dev/docs/migrating). Others are made empty, with how to move their data. Redis, KeyDB and Dragonfly become empty KV databases. MariaDB, MongoDB, ClickHouse and libSQL aren't imported. ### From Railway - **Projects:** each environment other than production becomes a project of its own, as above. Pull request environments are left out. - **Services:** each is built from its repository or run from its image. One Railway built with buildpacks is built with zero config. - **Variables:** references like `${{shared.KEY}}` are filled in. `RAILWAY_PRIVATE_DOMAIN` becomes the service's name in Pyo and `RAILWAY_PUBLIC_DOMAIN` its first custom domain. Sealed variables come over secret and empty, so set them in Pyo. - **Databases:** Postgres and MySQL with public access turned on are copied. Redis becomes an empty KV database. MongoDB isn't imported. - A service Railway ran on a schedule, or put to sleep when idle, keeps running in Pyo. Make a cron job for a scheduled one. ### From Vercel - **Projects:** each becomes a service built with zero config from its Git repository, on port 3000. Its build and install commands and Node.js version come with it. A project deployed with Vercel's CLI, with no repository, needs one. - **Variables:** production ones come over. Sensitive variables come over by name, secret and empty, so set them in Pyo. Vercel's own variables like `VERCEL_URL` aren't set. The build gets only public variables like `NEXT_PUBLIC_` ones. Add others as build arguments if the build needs them. - **Databases:** a Postgres store is copied when Vercel shares its URL. Otherwise it's made empty. A Redis store becomes an empty KV database. Blob stores aren't carried over. - **Runs as a server:** Next.js runs as one server with `next start`, middleware and image optimization included. Vercel Functions and Edge Functions don't run in Pyo. Pyo serves what the build makes. - Cron jobs, password protection and preview deployments aren't carried over. Each one is a note on its item. ## Databases your services use When a service's variable points at a database you import, like a `DATABASE_URL` with that database's host, Pyo [connects](https://pyo.dev/docs/databases) the new database to the service in place of that variable. The preview says so for each one. With **Deploy services once imported**, the first deploy waits until the database is ready and its data is copied, so the service starts on the new database. The service gets the database's own variables. A `DATABASE_URL` stays `DATABASE_URL` and a Postgres service also gets `DATABASE_URL_DIRECT`. Variables with other names keep their names with the new values. For example `DATABASE_PUBLIC_URL` gets the new URL, and `PGHOST`, `PGUSER` and the others get its host, user and so on. Pyo doesn't deploy a service when it can't tell which database a variable points at, or when that database isn't part of the import. The service is created and shows **Held** with the reason, for example "DATABASE_URL points at a database Pyo couldn't match." Connect a database to it, then deploy it. Other services still deploy. A variable that points at a database outside the platform, like a hosted Postgres, is left as it is. Start, build and install commands, build secrets, file mounts, deploy keys, preview environments, labels and custom Docker options don't carry over. Each one is a note on its item. ## Run it again You can import again at any time. What was imported before is left alone, and new services join the project the first import made. --- # Installing Pyo Run Pyo on a laptop, VPS, dedicated server or homelab. ## Requirements - **System:** Linux on x86-64, with root or `sudo` access. - **Resources:** at least 2 CPU cores, 2 GB of memory and 40 GB of disk. See [Memory](#memory) for how much to choose. - **Ports:** 8000, 5005 and 5006 free, plus 6443 if k3s isn't installed yet. The installer stops if one of these is taken. Only 80 and 443 need to be reachable from the internet, for your services and Pyo's dashboard. If something already uses 80 and 443, see [When ports 80 and 443 are in use](#when-ports-80-and-443-are-in-use). Let's Encrypt certificates need a machine that's reachable from the internet on ports 80 and 443. On a home network or a laptop, without [Tailscale](https://pyo.dev/docs/tailscale), Pyo and your services open over plain HTTP on your own network. See [On a home server](#on-a-home-server). ### Memory | Memory | Good for | | --- | --- | | 2 GB | The minimum. Enough to try Pyo or run a few small services. Builds are slower and there's little room for databases. | | 4 GB | Recommended for real use with databases. | | 8 GB or more | Many services, builds on the same server and several databases. | A [build server](https://pyo.dev/docs/builders#where-a-builder-can-run) or more [servers](https://pyo.dev/docs/servers) in the cluster spread the load. On machines with less than 3.5 GiB, the installer tunes k3s for low memory. See [k3s](https://pyo.dev/docs/system-reference#k3s). On a 2 GB server, about 570 MiB is left for your services and databases: 512 MiB is set aside for k3s and the system, and Pyo's own parts, with k3s's DNS and metrics, ask for about 890 MiB. A small database takes 128 MiB of that, and a static site served by Caddy around 15 MiB. When a deploy doesn't fit, it fails with what it needs, what's free and the biggest requests on the server. On machines under 3.5 GB, observability starts off. You can [turn it on](https://pyo.dev/docs/observability#turning-it-on-or-off) when you have the memory to spare. Pyo sizes k3s and its own database by the machine's memory each time they start. After you give a machine more or less memory, restart it and they follow. See [Memory tiers](https://pyo.dev/docs/system-reference#memory-tiers). ## Install Run this on your machine: ```bash curl -fsSL https://pyo.dev/install.sh | bash ``` It asks for `sudo` if it needs root. It installs k3s if it isn't there yet, then the latest release of Pyo. The first install takes a few minutes. It installs the k3s version this release of Pyo was tested with, and checks k3s's checksums before running anything. See [k3s](https://pyo.dev/docs/system-reference#k3s) for the version and how to use another. When it finishes, the installer prints where Pyo is. See [Where Pyo is](#where-pyo-is). It also prints a one-time login: the email `admin@pyo.local` and a password. Open the dashboard, sign in, and choose your own email and password. The printed login stops working once you do. Until then, running the install command again prints it again. Pyo connects its own server as your first cluster, named after its hostname, and sets up a builder on it. Both are ready to use, so the dashboard takes you straight to deploying your first service. If you lose the printed password before signing in, read it back on the server: ```bash sudo k3s kubectl -n pyo-system get secret pyo-admin -o jsonpath='{.data.password}' | base64 -d ``` Lost your own password later? Run `sudo pyo-reset-login` on the server for a one-time link. See [Getting back in](https://pyo.dev/docs/getting-back-in). ## Where Pyo is When it finishes, the installer prints where Pyo is: ```text Open Pyo: ➜ Public: https://pyo.203.0.113.7.nip.io ➜ Tailnet: http://100.64.0.2:8000 ➜ Network: http://10.0.0.5:8000 ➜ Local: http://localhost:8000 ``` It lists only the addresses this server has: | Line | Where it opens | | --- | --- | | **Public** | Anywhere, over HTTPS with a Let's Encrypt certificate. It's on the server's public IP: one on its network card, or the one its cloud gives it, as on AWS, Google Cloud, Azure, Alibaba Cloud and Tencent Cloud. Pyo never serves plain HTTP there. | | **Tailnet** | Your tailnet, when the server is on one already. Once you set up [Tailscale](https://pyo.dev/docs/tailscale) in Pyo, it's `https://pyo..ts.net`. | | **Network** | Your own network, like a home or office LAN or the cloud's private network. | | **Local** | The machine itself. | Pyo answers port 8000 only from the machine itself, private networks and your tailnet. Anything else is turned away, whatever it sends. Over plain HTTP, sign in with your password or a one-time code. [Passkeys](https://pyo.dev/docs/passkeys) need HTTPS. With neither a Public nor a Tailnet line, the installer says to set up Tailscale in Pyo for an HTTPS address. Once you add a second server or another cluster, set up [Tailscale](https://pyo.dev/docs/tailscale). Pyo is then also at `https://pyo..ts.net`, and you can close the public dashboard. ### Opening ports 80 and 443 Let's Encrypt issues the certificate only once it reaches the server on port 80. The installer waits up to 90 seconds for it. If it isn't there by then, the Public line says `(ready in a few minutes)` and it comes up by itself. Most clouds block ports 80 and 443 until you allow them, in a security group or firewall rules. Then the Public line says so: ```text ➜ Public: https://pyo.203.0.113.7.nip.io (allow ports 80 and 443 in your cloud firewall) ``` Allow TCP ports 80 and 443 from anywhere. Pyo tries again by itself, first an hour later, then every few hours at most. To check right away, run the install command again. It tries again if the last try was at least 15 minutes ago. ### When ports 80 and 443 are in use On a server that already serves sites on ports 80 and 443, like with nginx, Caddy or k3s's Traefik, the installer doesn't take those ports. It installs Pyo with [public traffic](https://pyo.dev/docs/clusters#public-traffic) off, so your sites keep working, and says so in one line: ```text ● Ports 80 and 443 are in use by nginx. Public traffic stays off, so your sites keep working. ``` While public traffic is off, open Pyo at its Network or Local address, or set up [Tailscale](https://pyo.dev/docs/tailscale) for HTTPS. To move your sites to Pyo later, stop the program that holds the ports, then turn on **Accept public traffic** on the cluster's **Settings** tab. ### On a home server A server behind a router's NAT, like one at home, has no HTTPS address of its own. Pyo is at its address on your network over HTTP, and so are your services. A service with no domain opens at the server's address and a port Pyo picks, like `http://192.168.1.20:31234`. Set up [Tailscale](https://pyo.dev/docs/tailscale) to get HTTPS for Pyo and your services. ## Where images come from Pyo's own images are on ghcr.io, like `ghcr.io/upsetdev/pyo-agent`, with a copy of each under the same name on Docker Hub, like `docker.io/upsetdev/pyo-agent`. Both copies have the same digest. Most images of other projects Pyo runs, like PostgreSQL, Envoy and cloudflared, come from Docker Hub, pinned by digest. The database operators' images (CloudNativePG and MOCO) come from ghcr.io. cert-manager comes from its own Helm chart at a pinned version, with its images on quay.io. Neither of these falls back to Docker Hub. [IMAGES.md](https://github.com/upsetdev/pyo/blob/main/IMAGES.md) lists them all. If your servers reach the internet through an allow-list, allow these hosts on port 443: | Host | For | | --- | --- | | `ghcr.io`, `pkg-containers.githubusercontent.com` | Pyo's images, and the database operators' | | `charts.jetstack.io`, `quay.io` | cert-manager's chart and images | | `registry-1.docker.io`, `auth.docker.io`, `production.cloudflare.docker.com` | Docker Hub: other projects' images, and the copy of Pyo's | Before it changes anything, the installer pulls every image the release starts. Each registry gets 3 tries, a few seconds apart. It prints one line per image, like `Pulled pyo from Docker Hub (ghcr.io didn't answer)`. If an image can't be pulled, it stops and says why, and Pyo stays as it was. ### Docker Hub's pull limit Docker Hub limits pulls without a login per address. A server that shares its address with many others, like one behind an office or cloud NAT, can hit it. The installer and updates then say so in plain words. Wait and run the same command again, or add a Docker Hub login to the server's `/etc/rancher/k3s/registries.yaml`: ```yaml configs: "docker.io": auth: username: password: ``` Pyo keeps entries it didn't write. k3s reads the file only when it starts, so restart it after you change the file: `sudo systemctl restart k3s`, or `k3s-agent` on a server that joined a cluster. Running services keep running. ### When GitHub is down - **Releases:** `api.pyo.dev` keeps a copy of each release's `release.json` and its signature. The installer, the dashboard's update check and the cluster verifier ask GitHub first and use the copy when GitHub fails. The signature is checked the same way, so the copy can't change what's installed. With `PYO_UPDATE_SOURCE` set, only that mirror is asked. - **Images:** each server pulls Pyo's own images from Docker Hub's copy when ghcr.io fails. Other ghcr.io images never come from Docker Hub. - **Not covered yet:** a fresh install and a new server still download k3s, cosign and the verifier from GitHub. A server that joined a cluster before Pyo 0.52.1 pulls from ghcr.io only. See [Servers joined before 0.52.1](https://pyo.dev/docs/servers#servers-joined-before-0521). Pyo sets this up in `/etc/rancher/k3s/registries.yaml` on each server: the installer, the connect command and the join command write it. The first time they change the file, k3s restarts once on that server. Containers keep running. The same file again means no restart. ## Install a particular release The installer uses the latest release. To choose one, add `--version`, or set `PYO_VERSION`: ```bash curl -fsSL https://pyo.dev/install.sh | bash -s -- --version 0.1.0 ``` To update later, run the install command again. See [Updating Pyo](https://pyo.dev/docs/updating-pyo). To remove Pyo, see [Uninstalling Pyo](https://pyo.dev/docs/uninstall). ## Verify a script pyo.dev serves each install script exactly as a Pyo release published it. `pyo.dev/install.sh` is the latest release's, and `pyo.dev/v/0.4.3/install.sh` is release 0.4.3's. The same goes for `server.sh`, `connect.sh`, `join.sh`, `sandbox.sh` and `cli.sh`. To check a script before you run it, compare its SHA-256 with the one in the release notes on [GitHub](https://github.com/upsetdev/pyo/releases): ```bash curl -fsSLO https://pyo.dev/v/0.4.3/install.sh sha256sum install.sh ``` The release's `release.json` lists the same sums, signed by Pyo's release workflow. To check that signature too, with [cosign](https://docs.sigstore.dev/cosign/system_config/installation/): ```bash V=0.4.3 curl -fsSLO https://github.com/upsetdev/pyo/releases/download/v$V/release.json curl -fsSLO https://github.com/upsetdev/pyo/releases/download/v$V/release.json.sigstore.json cosign verify-blob release.json --bundle release.json.sigstore.json \ --certificate-identity https://github.com/upsetdev/pyo/.github/workflows/release.yml@refs/tags/v$V \ --certificate-oidc-issuer https://token.actions.githubusercontent.com grep '"install.sh"' release.json ``` Every release's signature is recorded in Sigstore's public transparency log, [Rekor](https://search.sigstore.dev), so anyone can see what was signed and when. ## Install count When a fresh install is ready, the installer tells `api.pyo.dev` once, so we know how many people get Pyo running. It sends Pyo's version, the OS and the arch. It never sends the server's name, domains, addresses or who you are, and the source IP isn't stored. Running the command again to update sends nothing. The installer doesn't print anything about it. To skip it, set `PYO_TELEMETRY=off`. This also starts Pyo with [usage counts](https://pyo.dev/docs/updating-pyo#usage-counts) off: ```bash curl -fsSL https://pyo.dev/install.sh | PYO_TELEMETRY=off bash ``` You can turn usage counts on later under **Settings → Updates**. ## Securing Pyo On a server with a public IP, Pyo's dashboard is on the internet at `https://pyo..nip.io` until you close it. Follow [Securing Pyo](https://pyo.dev/docs/securing-pyo) before you put anything real on it. ## Next - [Making your first deploy](https://pyo.dev/docs/first-deploy) - [Adding a server](https://pyo.dev/docs/servers) - [Updating Pyo](https://pyo.dev/docs/updating-pyo) --- # Configuring your installation Settings for your whole installation, set by its admin. The account you set up after installing owns the installation. Its settings are under **Settings**, a page each at the root of the dashboard, like `/backups` or `/email`. Only installation admins see them. They apply to every team: - **[GitHub](https://pyo.dev/docs/github):** the GitHub App. - **[Email](https://pyo.dev/docs/email):** the SMTP server for invites, sign-in links and security emails. - **[Backups](https://pyo.dev/docs/backups#backing-up-pyo-itself):** encrypted copies of Pyo's own data. - **[Observability](https://pyo.dev/docs/observability#turning-it-on-or-off):** whether Pyo keeps analytics, logs and metrics over time, [how long](https://pyo.dev/docs/observability#how-long-its-kept), and what they keep about visitors. It starts off on a new install with less than 3.5 GB of memory. - **Security:** whether every account must use [two-factor authentication](https://pyo.dev/docs/two-factor#require-it-for-everyone), where [admins can sign in from](https://pyo.dev/docs/admin-sign-in), and how long the [audit log](https://pyo.dev/docs/audit-log#how-long-its-kept) keeps entries. - **[Updates](https://pyo.dev/docs/updating-pyo):** new releases of Pyo, by hand or on a schedule. Everything else is set with environment variables, listed in the [system reference](https://pyo.dev/docs/system-reference). ## Sign-ups Only people you invite can sign up. To let anyone with access to the dashboard create an account, run this on the server: ```bash sudo k3s kubectl -n pyo-system set env deployment/pyo PYO_ALLOW_SIGNUP=true ``` ## Visitors Each team chooses what its servers keep of visitors, under its **Settings → Observability**. The admin sets a default for teams that didn't choose, and a limit no team can go above, under **Settings → Observability**. | IP addresses | What's kept | | --- | --- | | Don't store | Nothing that identifies a visitor (recommended, and the default) | | Anonymized | The address without its last part, which points to a network, not a person | | Full | The whole address, kept with each team's [request logs](https://pyo.dev/docs/observability#request-logs) for up to 31 days. May need consent under laws like GDPR | | Query strings | What's kept | | --- | --- | | Keep | Parameter names and values (the default) | | Names only | Parameter names, like `?q&page` | | Don't keep | Nothing after the path | Passwords, tokens and other sensitive values are always hidden. Until the admin sets a limit for IP addresses, the default is also the limit. Lowering a limit applies at once: addresses are hidden when read, and new requests follow within about a minute. Each team that keeps less gets an entry in its activity. Changing a default moves only the teams that didn't choose. --- # MCP for AI assistants Let Claude, Cursor and other assistants use Pyo as you. Pyo includes a [Model Context Protocol](https://modelcontextprotocol.io) server. MCP is a standard way for AI assistants to use other apps, so an assistant can check on your services, read logs, deploy and roll back for you. Assistants sign in with OAuth, so there's no key to paste. You approve them in your browser, and they act as you. ## Connect an assistant Your server's address is your Pyo's URL with `/api/mcp` on the end. Open **MCP** in the dashboard and choose your client under **Connect an assistant**. It shows the address, ready to copy. For Cursor and VS Code, choose **Add to Cursor** or **Add to VS Code** there. The button opens the editor with your Pyo's address filled in. The editor asks to install the server. Then approve the sign-in in your browser. For Claude Code: ```bash claude mcp add --transport http pyo https://your-pyo/api/mcp ``` For other clients, add it to their MCP settings: ```json { "mcpServers": { "pyo": { "type": "http", "url": "https://your-pyo/api/mcp" } } } ``` Some clients name these settings differently. Check your client's docs for where an HTTP MCP server goes. The first time the assistant uses Pyo, your browser opens a **Connect an assistant** page. Sign in if you need to, choose its **Access**, and choose **Allow**. Then ask things like "Why did my last deploy fail?" The page shows the app's name and the address it sends you back to. The name is whatever the app calls itself, so check the address. When the app's details come from its own website, the page also shows that site's host under **App details from**. ### Claude Code plugin The Pyo plugin for Claude Code adds the MCP server and a `pyo` skill. Install it in Claude Code: ```text /plugin marketplace add upsetdev/pyo /plugin install pyo@pyo ``` This adds the marketplace from the Pyo repository on GitHub, then the plugin from it. On Claude Code 2.1.275 or later, `/plugin install pyo --marketplace upsetdev/pyo` does both in one step. The plugin connects to Pyo Cloud. For your own Pyo, set `PYO_URL` before you start Claude Code: ```bash export PYO_URL=https://pyo.example.com ``` It's the same variable the `pyo` CLI reads. For Pyo Cloud, leave `PYO_URL` unset. Then run `/mcp` in Claude Code, choose `pyo` and sign in. The `pyo` skill is used when the project has a `pyo.jsonc` file, or when you ask Claude to deploy, check or fix a Pyo service. It tells Claude to deploy with `pyo deploy` or `deploy_service`, to read `get_deployment` and `get_service_logs` when a deployment fails, and to find other operations with `search_api` and run them with `call_api`. ### Set up a project folder In a project folder, [`pyo agents`](https://pyo.dev/docs/cli#set-up-coding-agents) writes the MCP server into the project config of Claude Code, Cursor, VS Code or Codex. It also adds a Pyo section to `AGENTS.md` with the commands to deploy and read logs. ## Choose what it can do When you approve an assistant, you pick its **Access**, like for an [API key](https://pyo.dev/docs/api#what-a-key-can-do): | Access | What the assistant can do | | --- | --- | | Read only | See your teams, services, servers, logs and metrics. It changes nothing. | | Deploy | The same, plus deploy, roll back, restart, stop and scale services. `deploy_service` can also deploy another tag or digest of a service's image, with `reference`. Nothing is created or deleted. | | Sandboxes | The same as **Read only**, plus create, use and delete [sandboxes](https://pyo.dev/docs/sandbox). Offered once your team can use a sandbox server. | | Full | Everything you can do in Pyo with your role, including creating, changing and deleting projects, services, clusters and servers. | An assistant only sees the tools its access allows. See the [full tool list](https://pyo.dev/docs/mcp/tools). Whatever its access, an assistant acts as you, with your [role](https://pyo.dev/docs/teams#roles) in each team and the same permission checks as the dashboard. It can't change your account or the installation's settings. Unlike an API key, it can't be limited to some of your teams. It works in every team you're in. > `reveal_secret`, `reveal_deploy_hook` and `reveal_backup_password` return a secret in plain text. They need **Full** access, and assistants are told to use them only when you ask. Each one is recorded in the team's **Activity**. Tools show the values of environment variables as `•••`. When an assistant saves a service with a value still shown as `•••`, Pyo keeps the value you saved. It never stores `•••` as the value. ## Find more tools Assistants pick the right tool more often from a short list. By default, Pyo lists the [common tools](https://pyo.dev/docs/mcp/tools#common-tools) the assistant's access allows, plus three that reach the rest: | Tool | Input | What it does | | --- | --- | --- | | `search_api` | `query`, and `limit` from 1 to 50 (10 when left out) | Finds operations by what they do. Each match has its name, title, description, the access it needs and its input schema. It finds only what the assistant's access allows. | | `call_api` | `name`, and an `input` object | Runs the operation `name`, with `input` as its input. It has the same access checks as that tool. **Activity** shows the call under the operation's name. | | `read_docs` | `page` | Reads a page of these docs as Markdown. `page` is a path like `deploy/compose`, or a full `https://pyo.dev/md/….md` link. Leave it empty for the index at `https://pyo.dev/llms.txt`. | For the full list, with every operation as its own tool, connect the assistant to this address instead: ```text https://your-pyo/api/mcp?tools=all ``` The query has to be exactly `tools=all`. In both cases, an assistant can call any tool by its name, listed or not. See every tool in the [tool list](https://pyo.dev/docs/mcp/tools). ## Stay in control The **MCP** page lists your **Connected assistants**, with each one's access and when it was last used. **Disconnect** one and it loses access right away. Under **Activity**, you see your last 100 tool calls, which assistant made them, and whether they worked. Secret values in what the assistant sent, like passwords and environment variables, are hidden there. ## How sign-in works Most clients handle this for you. If you're building one, Pyo follows the MCP authorization spec: - **Discovery:** a request without a token gets a `401` pointing to `/.well-known/oauth-protected-resource/api/mcp`, with `?tools=all` on the end for the full list's address. A token works at both addresses. The authorization server's details are at `/.well-known/oauth-authorization-server`. - **Registration:** clients register themselves, with no client secret. A client can instead use the `https://` address of its client ID metadata document as its `client_id`. The authorization server's details say `client_id_metadata_document_supported`. - **Client ID metadata documents:** Pyo fetches the document only from the internet, never from a private network, and doesn't follow redirects. It waits 10 seconds at most, reads 5 KB at most and keeps the document for 5 minutes. The document's `client_id` must be its own address, and it must list the redirect URI the client asks for. Once you approve, the client shows under **Connected assistants** with the document's host after its name. - **Authorization:** the authorization code flow with PKCE, approved by you in the dashboard. - **Tokens:** an access token lasts 1 hour. A refresh token lasts 30 days and is replaced each time it's used. The MCP server only accepts these tokens. API keys work with the [API](https://pyo.dev/docs/api), not with MCP. ## Limits - Pyo speaks MCP over HTTP, and answers each request with plain JSON. It doesn't stream or send messages of its own. - It offers tools only, not resources or prompts. The tool list comes 50 at a time, and clients fetch the rest on their own. - Deploys and rollbacks run in the background. The tool returns a deployment id, and the assistant checks on it with another call. --- # Tools Everything an AI assistant can do through Pyo's MCP server. Pyo's MCP server has 198 tools, plus the three [search tools](#search-tools). They act as the person who approved the assistant, with the same permission checks as the dashboard. An assistant can only use the tools its access allows: 45 with **Read only**, 55 with **Deploy**, 59 with **Sandboxes** and all 198 with **Full**. See [access](https://pyo.dev/docs/mcp#choose-what-it-can-do). By default, its tool list has the common tools and the search tools. It finds and runs the others with `search_api` and `call_api`. Connected at `/api/mcp?tools=all`, it lists every tool instead. See [Find more tools](https://pyo.dev/docs/mcp#find-more-tools). The sandbox tools show once your team can use a [sandbox server](https://pyo.dev/docs/sandbox). Most tools do the same as an API operation, and take the same fields. Its reference page lists them. ## Common tools Start with these. They cover what most conversations need. | Tool | What it does | Inputs | Access | API | | --- | --- | --- | --- | --- | | `list_teams` | Teams the user belongs to. | None | Read | [Reference](https://pyo.dev/docs/api/reference/state/get-state) | | `list_services` | Services of a team: status, replicas, domains, live deployment. | `team` | Read | [Reference](https://pyo.dev/docs/api/reference/state/get-state) | | `get_service` | One service in detail: source, settings, domains, resources, runtime, recent deployments. | `service_id` (required) | Read | [Reference](https://pyo.dev/docs/api/reference/state/get-state) | | `list_deployments` | A service's deployments, newest first. | `service_id` (required), `limit` | Read | [Reference](https://pyo.dev/docs/api/reference/state/get-state) | | `get_deployment` | A deployment's status, why it failed, and its build and rollout logs. | `deployment_id` (required) | Read | [Reference](https://pyo.dev/docs/api/reference/state/get-state) | | `get_service_logs` | Recent output of the service's running replicas. | `service_id` (required) | Read | [Reference](https://pyo.dev/docs/api/reference/services/get-service-logs) | | `list_servers` | Clusters and servers of a team, with CPU and memory, and the servers where another program has the gateway's ports (gatewayPortsTaken: its sites don't answer there). | `team` | Read | [Reference](https://pyo.dev/docs/api/reference/state/get-state) | | `deploy_service` | Deploy the service with its current settings (Git services build their branch head), or retry a failed deployment. For a service that runs an image, reference deploys another tag or digest of the same image repository and keeps it as the service's. Returns the deployment id. | `service_id` (required), `retry_of`, `reference` | Deploy | [Reference](https://pyo.dev/docs/api/reference/deployments/deploy) | | `rollback_service` | Go back to an earlier successful deployment (the previous one when omitted). | `service_id` (required), `to_deployment_id` | Deploy | [Reference](https://pyo.dev/docs/api/reference/deployments/deploy) | | `scale_service` | Set how many replicas run (1 or more), without redeploying. Replicas that don't fit on the servers wait until there's room, and the result has a warning saying so. A very large change (20 or more replicas, and over 10 times the current count or twice what fits) is refused until confirmed: ask the user first, then call again with confirm: true. | `service_id` (required), `replicas` (required), `confirm` | Deploy | [Reference](https://pyo.dev/docs/api/reference/services/scale-service) | | `restart_service` | Restart the service's replicas one at a time. | `service_id` (required) | Deploy | [Reference](https://pyo.dev/docs/api/reference/services/restart-service) | | `create_project` | A new, empty project (a group of services). Returns its id. | `team`, `name` (required), `description`, `namespace` | Full | [Reference](https://pyo.dev/docs/api/reference/projects/create-project) | | `create_service` | Create a service from a container image and deploy it. The project is found by name or id, or created when it doesn't exist. Returns the service id, deployment id and URL. 20 or more replicas is refused until confirmed: ask the user first, then call again with confirm: true. | `team`, `project`, `name` (required), `image` (required), `port`, `replicas`, `confirm`, `env`, `free_domain`, `domain`, `region`, `placement`, `server_tags` | Full | [Reference](https://pyo.dev/docs/api/reference/services/create-service) | | `set_service_placement` | Choose where a service runs: any server of its cluster (servers and tags both empty), or only the servers named and every server with one of the tags, including servers tagged later (see list_servers). A service with a volume has to keep its volume's server, and one with a GPU needs a GPU server. It changes in place, without a redeploy: its replicas move over with the same image. Refused with the reason when no server picked can run it. | `service_id` (required), `servers`, `tags` | Full | [Reference](https://pyo.dev/docs/api/reference/services/save-service) | | `add_domain` | Serve a service on a hostname, or on a free nip.io domain (a tunnel domain in tunnel mode). It goes live in place, without a redeploy (a service never deployed gets it with its first deploy). | `service_id` (required), `hostname`, `free_domain`, `cloudflare_dns`, `proxied`, `tunnel`, `path`, `strip_prefix`, `redirect_to`, `status` | Full | [Reference](https://pyo.dev/docs/api/reference/services/save-service) | | `set_domain_redirects` | Replace a domain's redirects. Each sends requests under a path to another path or hostname, with 301 (default) or 302. keep_path (default true) keeps the rest of the path after the matched one. The query is always kept. A domain that routes to a port can't redirect "/" as a whole. They go live in place. | `service_id` (required), `hostname` (required), `redirects` (required) | Full | [Reference](https://pyo.dev/docs/api/reference/services/save-service) | | `set_domain_headers` | Replace a domain's header rules: headers to set or remove on its responses (like Strict-Transport-Security or X-Powered-By), and on requests to the service. Hop-by-hop headers, X-Forwarded-*, X-Pyo-* and Pyo Gateway's other own headers can't be changed. At most 16 per list. They go live in place. | `service_id` (required), `hostname` (required), `response_set`, `response_remove`, `request_set`, `request_remove` | Full | [Reference](https://pyo.dev/docs/api/reference/services/save-service) | | `set_static_serving` | For a service whose build is a static site: serve its build as static files from the cluster's shared static server ("static", the default), or run it as a service of its own ("service"). Takes effect with the next deploy. | `service_id` (required), `serve_as` (required) | Full | [Reference](https://pyo.dev/docs/api/reference/services/save-service) | | `set_request_timeout` | How long the gateway waits for the service to answer a request on its domains before it returns 504, in seconds: 1 to 3600, or 0 for no limit. Without one it's 300. WebSockets aren't cut by it. It changes in place, without a redeploy. | `service_id` (required), `seconds` (required) | Full | [Reference](https://pyo.dev/docs/api/reference/services/save-service) | | `stop_service` | Stop the service (scale to zero). Settings and data are kept. | `service_id` (required) | Deploy | [Reference](https://pyo.dev/docs/api/reference/services/stop-service) | | `create_sandbox` | Create an isolated machine (a sandbox) on the team's sandbox servers, to run code, commands and files in. It ends after its lifetime (5 minutes when omitted). Returns its id. | `team`, `name`, `template`, `server`, `cpus`, `memory_mib`, `ttl`, `env`, `network` | Sandboxes | [Reference](https://pyo.dev/docs/api/reference/sandboxes/create-sandbox) | | `run_code` | Run a piece of code in a sandbox and wait for it: its output and exit code. | `sandbox_id` (required), `code` (required), `language`, `timeout_ms` | Sandboxes | [Reference](https://pyo.dev/docs/api/reference/sandboxes/create-sandbox-token) | | `exec` | Run a shell command in a sandbox and wait for it: its output and exit code. | `sandbox_id` (required), `command` (required), `cwd`, `timeout_ms` | Sandboxes | [Reference](https://pyo.dev/docs/api/reference/sandboxes/create-sandbox-token) | | `read_file` | A file's content from a sandbox, as text (the first 256 KiB). | `sandbox_id` (required), `path` (required) | Sandboxes | [Reference](https://pyo.dev/docs/api/reference/sandboxes/create-sandbox-token) | | `write_file` | Write text to a file in a sandbox. Its folders are made, and a file there is replaced. | `sandbox_id` (required), `path` (required), `content` (required) | Sandboxes | [Reference](https://pyo.dev/docs/api/reference/sandboxes/create-sandbox-token) | | `open_port` | A URL for a port a sandbox listens on. | `sandbox_id` (required), `port` (required), `public` | Sandboxes | [Reference](https://pyo.dev/docs/api/reference/sandboxes/open-sandbox-port) | | `close_port` | Stop serving a sandbox port at its URL. | `sandbox_id` (required), `port` (required) | Sandboxes | [Reference](https://pyo.dev/docs/api/reference/sandboxes/close-sandbox-port) | | `rename_sandbox` | Give a sandbox another name. Its id stays the same. | `sandbox_id` (required), `name` (required) | Sandboxes | [Reference](https://pyo.dev/docs/api/reference/sandboxes/rename-sandbox) | | `pause_sandbox` | Pause a sandbox: its memory and files are kept, and it resumes where it was. | `sandbox_id` (required) | Sandboxes | [Reference](https://pyo.dev/docs/api/reference/sandboxes/pause-sandbox) | | `delete_sandbox` | End a sandbox and throw away its files. | `sandbox_id` (required) | Sandboxes | [Reference](https://pyo.dev/docs/api/reference/sandboxes/delete-sandbox) | ## Search tools These find and run every other tool, and read these docs. Any access can use them. `call_api` runs a tool with the same access checks as calling it by its name. They aren't listed at `/api/mcp?tools=all`. | Tool | What it does | Inputs | | --- | --- | --- | | `search_api` | Find Pyo API operations by what you want to do ("add a database backup", "domain certificate", "environment variables"). Use it when none of the listed tools does it. Each match comes with its name, what it does, the access it needs and its input schema. Then run one with call_api. | `query` (required), `limit` | | `call_api` | Run one Pyo API operation found with search_api, by its name, with input that follows its input schema. It runs with the same checks as calling it directly. | `name` (required), `input` | | `read_docs` | Read a page of Pyo's documentation from pyo.dev, as Markdown. Without a page it gives the index, which lists every page. Use it to learn how something in Pyo works before changing it. | `page` | ## Account | Tool | What it does | Access | API | | --- | --- | --- | --- | | `get_me` | The account these credentials act as: an API key's owner, or the person who connected an assistant. | Read | [Reference](https://pyo.dev/docs/api/reference/account/get-me) | | `get_meta` | Its version, and the features a hosted Pyo turned on (none when self-hosted). No API key needed. | Read | [Reference](https://pyo.dev/docs/api/reference/account/get-meta) | ## State | Tool | What it does | Access | API | | --- | --- | --- | --- | | `get_state` | One snapshot of every team you're in (or the API key's teams): their projects, services and deployments, clusters and servers, domains, certificates, volumes, backups, registry logins, builders and recent activity. The dashboard renders from this, and scripts can read it too. | Read | [Reference](https://pyo.dev/docs/api/reference/state/get-state) | ## Observability | Tool | What it does | Access | API | | --- | --- | --- | --- | | `get_access_logs` | The web server's log of requests to a team's websites, newest first, filtered like the traffic figures. Requests stay in each website's cluster (1 GB or 7 days by default, the team's `requestLogs` preference), which answers within seconds, up to 500 at a time. | Read | [Reference](https://pyo.dev/docs/api/reference/observability/get-access-logs) | | `get_domain_traffic` | Requests per domain of a team over a range, each with its series: a point per minute for an hour, per half hour for a day, per four hours for a week, per day for 30 days. Only domains that had requests are listed, busiest first. No domains while observability is off. | Read | [Reference](https://pyo.dev/docs/api/reference/observability/get-domain-traffic) | | `get_metrics` | CPU, memory, disk and network over time for a team's servers and services, sampled once a minute. Servers also get load and disk reads and writes. Each series lines up with `times`, with `null` where nothing was measured. | Read | [Reference](https://pyo.dev/docs/api/reference/observability/get-metrics) | | `get_observability` | Visitors, requests, errors, response times, countries, pages and referrers for a team's websites: all of them, one project's, one service's, or one domain. Read from per-minute totals each cluster sends (kept 12 months by default), so it works with a cluster offline. Top lists count page views (referrers, pages, devices, browsers) or requests (paths, countries, query parameters). | Read | [Reference](https://pyo.dev/docs/api/reference/observability/get-observability) | | `get_observability_settings` | Whether observability is on for this installation (it's off on a new install on a server with under 3.5 GB of memory). For the installation's admin also what it keeps of visitors' IP addresses, how long it keeps data (`retention`: `analyticsMonths`, `metricsDays`, `buildLogDays`) and `small`: the server Pyo runs on has under 3.5 GB of memory now. The installation's admin turns it on or off with `setObservability`. | Read | [Reference](https://pyo.dev/docs/api/reference/observability/get-observability-settings) | | `get_service_connections` | Connections to a service's public TCP and UDP ports through the gateway: per port, over time, by country and outcome ("ok", "blocked" by an IP rule, "limited" by the connection limit, "unreachable" when the service didn't answer), and the latest 50. A connection is counted when it closes (a UDP exchange after a minute without packets). Ports that bypass the gateway aren't counted. | Read | [Reference](https://pyo.dev/docs/api/reference/observability/get-service-connections) | | `set_observability` | Turn observability (analytics, request logs, firewall and WAF history, usage history) on or off for the whole installation. Only the installation's admin can do this. Off stops storing and showing history and frees its memory. What was stored is kept for when it's back on. Live logs, current usage, deploys and the firewall keep working. | Full | [Reference](https://pyo.dev/docs/api/reference/observability/set-observability) | ## Services | Tool | What it does | Access | API | | --- | --- | --- | --- | | `create_service_from_spec` | Create a service and deploy it. | Full | [Reference](https://pyo.dev/docs/api/reference/services/create-service) | | `delete_service` | Delete a service and stop it everywhere. Its volumes are kept, detached, unless `deleteVolumes`. | Full | [Reference](https://pyo.dev/docs/api/reference/services/delete-service) | | `get_service_preview` | Whether a service's site can be shown in the dashboard's preview frame: it answers, and doesn't forbid framing (X-Frame-Options, CSP frame-ancestors). Only the service's own first domain is asked, and never a private address. | Read | [Reference](https://pyo.dev/docs/api/reference/services/get-service-preview) | | `get_service_traffic` | Its domains and the addresses they point at, the servers that take public traffic and their regions, where its replicas run, and anything that keeps visitors from reaching it. | Read | [Reference](https://pyo.dev/docs/api/reference/services/get-service-traffic) | | `reveal_secret` | Show a secret environment variable's value. Admins only, and logged. Returns a secret. | Full | [Reference](https://pyo.dev/docs/api/reference/services/reveal-secret) | | `save_service` | Save a service's configuration. With `deploymentId`, roll it out too. Changes to its `domains` go live without a deploy once it has been deployed. A variable sent back hidden (`•••`, as reads show it) keeps its saved value. `removeDomain` removes a domain without sending the whole service. | Full | [Reference](https://pyo.dev/docs/api/reference/services/save-service) | | `set_autoscale` | Turn autoscaling on or change it. Null turns it off. | Deploy | [Reference](https://pyo.dev/docs/api/reference/services/set-autoscale) | ## Deployments | Tool | What it does | Access | API | | --- | --- | --- | --- | | `cancel_deployment` | Cancel a deployment that hasn't finished. | Deploy | [Reference](https://pyo.dev/docs/api/reference/deployments/cancel) | | `create_deploy_hook` | Create a deploy hook: a secret URL that deploys a service, or every service of a project. | Full | [Reference](https://pyo.dev/docs/api/reference/deployments/create-deploy-hook) | | `delete_preview` | Remove a pull request's preview of a service now. The next push to the pull request brings it back. | Full | [Reference](https://pyo.dev/docs/api/reference/deployments/delete-preview) | | `redeploy_preview` | Deploy a pull request's preview again from its head (a failed one tries again, a removed one comes back). | Deploy | [Reference](https://pyo.dev/docs/api/reference/deployments/redeploy-preview) | | `remove_deploy_hook` | Remove a deploy hook. Its URL stops working. | Full | [Reference](https://pyo.dev/docs/api/reference/deployments/remove-deploy-hook) | | `reveal_deploy_hook` | Show a deploy hook's URL path (its secret token). Developers and up. Returns a secret. | Full | [Reference](https://pyo.dev/docs/api/reference/deployments/reveal-deploy-hook) | ## Cron jobs | Tool | What it does | Access | API | | --- | --- | --- | --- | | `list_cron_runs` | A cron job's recent runs, newest first: when each started and finished, how it ended, and the end of what it printed. | Read | [Reference](https://pyo.dev/docs/api/reference/cron-jobs/list-cron-runs) | | `remove_cron_job` | Remove a cron job from a service. | Full | [Reference](https://pyo.dev/docs/api/reference/cron-jobs/remove-cron-job) | | `run_cron_job` | Run a cron job now. | Deploy | [Reference](https://pyo.dev/docs/api/reference/cron-jobs/run-cron-job) | | `save_cron_job` | Add a cron job to a service, or change one (by id). | Full | [Reference](https://pyo.dev/docs/api/reference/cron-jobs/save-cron-job) | ## Databases | Tool | What it does | Access | API | | --- | --- | --- | --- | | `add_database_backup` | Checks the admin login from the cluster, makes a backup user with it, then saves the database and its schedule. Team owners and admins. | Deploy | [Reference](https://pyo.dev/docs/api/reference/databases/add-database-backup) | | `check_database_import` | Everything `startDatabaseImport` checks, without importing. The cluster connects to the source, which must be reachable from there, and checks the login, TLS, its version, its extensions and that every table is readable. It also checks that the database to import into is empty. Owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/databases/check-database-import) | | `connect_database` | Connect a service to a database on its cluster. Postgres adds DATABASE_URL (through the pooler when it's on) and DATABASE_URL_DIRECT, plus DATABASE_URL_READ with read replicas. MySQL adds DATABASE_URL (mysql://, to the primary), MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD and MYSQL_DATABASE. KV adds REDIS_URL (which follows failover and sends reads to read replicas), plus KV_REST_API_URL, KV_REST_API_TOKEN and KV_REST_API_READ_ONLY_TOKEN (reads only) with its REST API. With `env`, it adds only those, under the service's own names. With `prefix`, it adds all of them with that prefix, so two databases' variables don't clash. They're secret variables and apply on the service's next deploy. | Full | [Reference](https://pyo.dev/docs/api/reference/databases/connect-database) | | `create_database` | Create a Postgres, MySQL or KV (Redis-compatible key-value, Valkey) database on one of the team's clusters. The first database on a cluster also sets up databases there, which takes a minute or two. `size` sets CPU and memory per instance: "small" (0.25 CPU, 512 MiB, 5 GiB), "medium" (0.5, 1 GiB, 10 GiB), "large" (1, 2 GiB, 20 GiB) or "xlarge" (2, 4 GiB, 50 GiB). MySQL needs 1 GiB, so "medium" or larger. `instances` is 1 for a single server with no automatic failover. For high availability, use a primary and 2 to 8 replicas for Postgres (instances 3 to 9), 2 to 4 for KV (3 to 5), or 2 or 4 for MySQL (3 or 5). A replica takes over when the primary's server is lost. MySQL has no pooler, read replicas or REST API. Developers and up. | Full | [Reference](https://pyo.dev/docs/api/reference/databases/create-database) | | `delete_database` | Delete a database and its data. Refused while deletion protection is on or a service is connected. Owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/databases/delete-database) | | `delete_database_backup` | Stop backing up a database. Its existing backups stay in storage. | Full | [Reference](https://pyo.dev/docs/api/reference/databases/delete-database-backup) | | `disconnect_database` | Disconnect a service from a database: removes the variables it added (on the next deploy). | Full | [Reference](https://pyo.dev/docs/api/reference/databases/disconnect-database) | | `get_database` | One Postgres, MySQL or KV database, as `listDatabases` lists them. | Read | [Reference](https://pyo.dev/docs/api/reference/databases/get-database) | | `get_database_analytics` | Its health over time, sampled about every 30 seconds. Per member (`members`: each instance, read replica, pooler and KV endpoint), its `role`, `server`, and series for `cpu` in cores, `memoryMi`, `diskUsedGi` (only where the volume reports its own space), `connections` and `lagSeconds`. For the whole database, `transactions` (Postgres), `queries` (MySQL), `poolerQueries` and `commands` (KV) per second, `connections` (`primary`, `replicas`, `limit`, and the pooler's `poolerActive`, `poolerWaiting`, `poolerServersActive`, `poolerServersIdle` and `poolerMaxWaitSeconds`), `cacheHitRatio`, `keyHitRatio`, `evictions` per second, `routing` (KV reads per second served by `replica`s or the `primary`, and `fallbacks` to the primary) and `storage` (`sizeBytes`, `memoryUsedBytes`, `maxmemoryBytes`, `keys`). Each series lines up with `times`, with `null` where nothing was measured. A series is `null` when the database doesn't report it. | Read | [Reference](https://pyo.dev/docs/api/reference/databases/get-database-analytics) | | `list_database_extensions` | The extensions Pyo's databases offer: Postgres extensions and KV modules. Each one's `name`, `engine` ("postgres" or "valkey"), `section` ("pyo" ones are turned on with `setDatabaseExtensions`, and the database's owner adds "additional" ones with CREATE EXTENSION), a one-line `description`, its `docs`, its `edition` when it's a limited build, `hidden` when it's obsolete (shown only while a database has it on), and whether turning it on or off `restart`s the database (every KV module does). | Read | [Reference](https://pyo.dev/docs/api/reference/databases/list-database-extensions) | | `list_databases` | A team's Postgres and MySQL databases and Valkey (Redis-compatible) KV databases: engine, version, size, instances, the cluster's status (phase, primary, ready instances, failovers), the services connected to each and their variables, passwords masked. | Read | [Reference](https://pyo.dev/docs/api/reference/databases/list-databases) | | `restore_database` | Restore a Postgres or MySQL database into a new one, on the same cluster with the same size and availability: at `targetTime` (RFC 3339, within what its backups cover: from `status.backup.firstRecoverabilityPoint` to now for Postgres, to `status.backup.lastSuccessfulBackup` for MySQL) or the latest when omitted. Developers and up. | Full | [Reference](https://pyo.dev/docs/api/reference/databases/restore-database) | | `retry_database_import` | Runs a failed import again, from the same source. After a failure, Pyo keeps the URL's password (sealed), and an uploaded dump for `PYO_DATABASE_IMPORT_RETENTION_HOURS` (24 by default). A new database made for the import is made again. A database that already existed must still be empty. Owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/databases/retry-database-import) | | `reveal_database_password` | Show a database's password, and a KV database's REST token and read-only token. Owners and admins. Recorded in the activity log. | Full | [Reference](https://pyo.dev/docs/api/reference/databases/reveal-database-password) | | `run_database_backup` | Back up a database now. | Full | [Reference](https://pyo.dev/docs/api/reference/databases/run-database-backup) | | `set_database_backups` | Turn a database's backups on or off, to the team's Backups destination. Postgres: every change archived continuously and a base backup daily, so it can be restored to any moment in the last `retentionDays`. MySQL: a full backup daily with the changes since the last one, so it can be restored to any moment in the last `retentionDays` up to its latest backup. Both are stored in the team's folder of the destination. KV: a snapshot `schedule`d daily or weekly, the last `keep` kept, listed in Backups with the team's other databases. Developers and up. | Full | [Reference](https://pyo.dev/docs/api/reference/databases/set-database-backups) | | `set_database_extensions` | Turn a Postgres database's extensions or a KV database's modules on and off. `extensions` is the full list to have on, from `listDatabaseExtensions` with `section` "pyo" for its engine. The database's owner adds Postgres's "additional" ones with CREATE EXTENSION. Some load a library, which restarts the database (`restart`). With high availability, it restarts one instance at a time and the primary hands over last. Every KV module restarts the database and needs KV 8.1. Turning a Postgres extension off drops it (DROP EXTENSION, without CASCADE). Postgres refuses while other objects depend on it, and the database's `extensions` shows this. Developers and up. | Full | [Reference](https://pyo.dev/docs/api/reference/databases/set-database-extensions) | | `start_database_import` | Copies a Postgres or MySQL database into one of the team's: a new one (`newDatabase`), or an empty one (`databaseId`). From `url` (the source must be reachable from the cluster) or `uploadId` (a dump uploaded first). It's checked first, as `checkDatabaseImport`. Then the database's `import` shows how it goes ("pending", "running", "succeeded" or "failed", with a `phase`), and its logs have the import's output. Writes made to the source during the import aren't copied. Owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/databases/start-database-import) | | `update_database` | Change a database's size, instances, storage, version, pooler, REST API, read replicas or deletion protection. Instances are 1 for a single server, or for high availability 2 to 8 replicas for Postgres, 2 to 4 for KV, or 2 or 4 for MySQL. MySQL instances only grow. Storage only grows and the version only goes up. Only owners and admins can turn deletion protection off. Connected services get changed variables on their next deploy. | Full | [Reference](https://pyo.dev/docs/api/reference/databases/update-database) | | `update_database_backup` | Change a backed-up database's schedule, or pause its backups. | Full | [Reference](https://pyo.dev/docs/api/reference/databases/update-database-backup) | ## Backups | Tool | What it does | Access | API | | --- | --- | --- | --- | | `remove_team_backup_settings` | Stop a team's backups. | Full | [Reference](https://pyo.dev/docs/api/reference/backups/remove-team-backup-settings) | | `reveal_backup_password` | Show the team's backup repository password, to restore without Pyo. Logged. Returns a secret. | Full | [Reference](https://pyo.dev/docs/api/reference/backups/reveal-backup-password) | | `run_team_backup` | Back up now: one service or volume (by id), or everything selected. | Full | [Reference](https://pyo.dev/docs/api/reference/backups/run-team-backup) | | `save_team_backup_settings` | Back up a team's volumes and databases: where, how often and how many to keep. A blank secret keeps the saved one. | Full | [Reference](https://pyo.dev/docs/api/reference/backups/save-team-backup-settings) | | `set_team_backup_selection` | Choose what a team backs up: "all" but `exceptions`, or only the "selected" ones. | Full | [Reference](https://pyo.dev/docs/api/reference/backups/set-team-backup-selection) | ## Domains | Tool | What it does | Access | API | | --- | --- | --- | --- | | `create_dns_record` | Create a domain's DNS record in the team's Cloudflare account, when one of its connected zones covers the hostname: an A record to the cluster's public IP, with the comment "Made by Pyo (<installation id>)". Pyo never overwrites a record. When another A, AAAA or CNAME record has the name, `status` is "conflict" and `existing` lists them. Send it again with `replace` to delete those and create Pyo's (team owners and admins). `status` "exists" means it already points there. With `proxied`, Cloudflare proxies it once the domain's certificate is issued. | Full | [Reference](https://pyo.dev/docs/api/reference/domains/create-dns-record) | | `delete_dns_record` | Delete the DNS record Pyo made for a domain in Cloudflare. Only a record Pyo made, still with its comment, is deleted. Refused while other paths of the hostname still use it. Remove the domain after this. | Full | [Reference](https://pyo.dev/docs/api/reference/domains/delete-dns-record) | | `remove_certificate` | Remove an uploaded certificate no domain uses. | Full | [Reference](https://pyo.dev/docs/api/reference/domains/remove-certificate) | | `remove_domain` | Remove a domain from a service. Traffic to it stops, in place, without a redeploy. A port no other domain uses stops being public. The DNS record Pyo made for it in Cloudflare is deleted too, unless `keepDnsRecord`. Only a record Pyo made, still with its comment, is deleted. For a domain through the Cloudflare Tunnel, `restoreRecords` puts back the records the tunnel replaced (team owners and admins). | Full | [Reference](https://pyo.dev/docs/api/reference/domains/remove-domain) | | `replace_certificate` | Replace a certificate with a renewed one. Services using it switch over in place, without a redeploy. | Full | [Reference](https://pyo.dev/docs/api/reference/domains/replace-certificate) | | `set_domain_tunnel` | Serve a domain through the cluster's Cloudflare Tunnel (`on`), or move it back. Pyo adds the tunnel's route first, then points the name at the tunnel with a proxied CNAME, so both paths answer while it moves. When records Pyo didn't make have the name, the domain's `dnsRecord.status` turns "conflict" and `existing` lists them (at once, in the answer too, when Cloudflare can be asked). Send it again with `replace` to replace them (team owners and admins): Pyo keeps a copy. Moving back with `restore` puts that copy back (team owners and admins), or without one, points the name at the cluster's public IP. A name one level under the tunnel's default domain always goes through the tunnel, so moving it back is refused unless a record it replaced comes back. A new name one level under the default domain gets no record of its own when nothing else at Cloudflare answers for it: the default domain's wildcard record has it, and the answer is `status: "active"`. A name that's already only through the tunnel stays that way while its own record is made. After the record moves, both paths stay open until Cloudflare's edge sends the name through the tunnel. With `on` and `finish` (Finish now, team owners and admins), a domain whose record is on the tunnel goes only through the tunnel at once: the direct path closes, and visitors Cloudflare still sends the old way get 404. | Full | [Reference](https://pyo.dev/docs/api/reference/domains/set-domain-tunnel) | | `upload_certificate` | Upload a certificate for the team's domains: the chain and its private key, PEM. | Full | [Reference](https://pyo.dev/docs/api/reference/domains/upload-certificate) | | `verify_domain` | Check a domain's DNS now. | Full | [Reference](https://pyo.dev/docs/api/reference/domains/verify-domain) | ## Volumes | Tool | What it does | Access | API | | --- | --- | --- | --- | | `add_volume` | Add a persistent volume to a service, mounted at `mountPath` from its next deploy. | Full | [Reference](https://pyo.dev/docs/api/reference/volumes/add-volume) | | `attach_volume` | Attach a detached volume to a service on its cluster, mounted at `mountPath` from the service's next deploy. A service of another project (or any project, for a volume whose project was deleted) gets the volume moved into its project first, data, id and backups kept: the volume shows `moving` until its cluster has moved it, then it's attached (or `moveError` says why not). A volume can't move to another cluster. A volume on a one-server storage class keeps its data on that server, so the service must be able to run there. | Full | [Reference](https://pyo.dev/docs/api/reference/volumes/attach-volume) | | `delete_volume` | Delete a detached volume and its data, for good. Admins only. The volume stays listed, being deleted, until its cluster confirms. Also deletes a volume Pyo has no record of, listed in its cluster's `strayVolumes`: pass that `volumeId` as `id`, with `clusterId`. | Full | [Reference](https://pyo.dev/docs/api/reference/volumes/delete-volume) | | `delete_volume_snapshot` | Deletes one of a volume's backups from the team's restic repository, with a short job on its cluster that waits for the volume's other backups and restores. The space it held is freed shortly after. Deleting one that's already gone succeeds. Owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/volumes/delete-volume-snapshot) | | `detach_volume` | Detach a volume from its service: unmounted from the next deploy. The volume and its data stay, to attach again or delete. | Full | [Reference](https://pyo.dev/docs/api/reference/volumes/detach-volume) | | `list_volume_snapshots` | Its backups in the team's restic repository, newest first, read from its cluster on request (a short job there). Takes up to two minutes. | Read | [Reference](https://pyo.dev/docs/api/reference/volumes/list-volume-snapshots) | | `resize_volume` | Grow a volume to `sizeGi` GB (never shrink it). Owners and admins. Only on a storage class that can grow volumes (`allowVolumeExpansion`). A `local-path` volume has no size limit of its own, so there's nothing to grow. The volume shows `resizeTo` until its cluster reports the new size. Some storage classes finish when its service next starts. | Full | [Reference](https://pyo.dev/docs/api/reference/volumes/resize-volume) | | `restore_volume` | Restore a volume from one of its snapshots (see `listVolumeSnapshots`), replacing its data. Owners and admins. Its service stops while the restore runs and starts again afterwards, even when it fails. The snapshot is restored next to the data and swapped in only once complete, so a failed restore leaves the data as it was. The volume needs room for the snapshot while this runs. The volume shows `restore` while it runs, then `restoredAt`, or `restoreError` with why it failed. | Full | [Reference](https://pyo.dev/docs/api/reference/volumes/restore-volume) | ## Teams | Tool | What it does | Access | API | | --- | --- | --- | --- | | `create_team` | Create a team. You become its owner. | Full | [Reference](https://pyo.dev/docs/api/reference/teams/create-team) | | `delete_team` | Delete a team and everything in it. Owners only. | Full | [Reference](https://pyo.dev/docs/api/reference/teams/delete-team) | | `invite_member` | Invite someone to a team by email, as owner, admin, developer or viewer. | Full | [Reference](https://pyo.dev/docs/api/reference/teams/invite-member) | | `list_audit_log` | Who did what in a team, newest first: when, the account, the action, how (dashboard, API key or assistant) and the address and browser it came from, as the team keeps them. Sign-ins, failed sign-ins and two-factor changes are here too. For the team's owners and admins. | Read | [Reference](https://pyo.dev/docs/api/reference/teams/list-audit-log) | | `remove_member` | Remove a member from a team, or revoke an invite. | Full | [Reference](https://pyo.dev/docs/api/reference/teams/remove-member) | | `resend_invite` | Make a new invite link (the earlier one stops working) and mail it, or with `send: false` only return it to share. | Full | [Reference](https://pyo.dev/docs/api/reference/teams/resend-invite) | | `reset_member_sign_in` | Owners only: a one-time link for a member who lost their password, to choose a new one. It's emailed to them. Without email set up, it's returned to pass on, for an account in this team alone. | Full | [Reference](https://pyo.dev/docs/api/reference/teams/reset-member-sign-in) | | `rotate_data_key` | Give the team a new data key and seal its stored secrets again with it. | Full | [Reference](https://pyo.dev/docs/api/reference/teams/rotate-data-key) | | `set_team_observability` | A team's observability: what its servers collect and keep. Owners and admins. Left out, a setting stays as it is. | Full | [Reference](https://pyo.dev/docs/api/reference/teams/set-team-observability) | | `update_member_role` | Change a member's role: "owner", "admin", "developer" or "viewer". | Full | [Reference](https://pyo.dev/docs/api/reference/teams/update-member-role) | | `update_team` | Rename a team, change its description, default cluster or preferences. | Full | [Reference](https://pyo.dev/docs/api/reference/teams/update-team) | ## Projects | Tool | What it does | Access | API | | --- | --- | --- | --- | | `delete_project` | Delete a project and its services. Its volumes are kept, detached, unless `deleteVolumes`. | Full | [Reference](https://pyo.dev/docs/api/reference/projects/delete-project) | | `import_compose` | Create a project and its services from a Docker Compose plan (from `POST /compose/preview`, edited if you like), and deploy them in order. | Full | [Reference](https://pyo.dev/docs/api/reference/projects/import-compose) | | `plan_compose_sync` | What applying a Compose file to the project made from it would change, service by service: added, changed (and what), unchanged, or not in the file. Only what the file sets is compared, so settings changed in Pyo that the file doesn't mention stay. A secret's value is never changed. An image's tag follows the file only when the file changed it. What can't change in place is listed under `manual` and left as it is. Nothing changes. Pass `file` to the `syncCompose` operation to apply it, or to `importCompose` when there's no `project` yet. | Read | [Reference](https://pyo.dev/docs/api/reference/projects/plan-compose-sync) | | `preview_compose` | What importing a Compose file would create: a project, and a service per Compose service with its source, ports, variables, volumes and health check, in deploy order. It adds a warning for each thing that isn't carried over. Nothing is created. Edit the plan if you like, then pass it to the `importCompose` operation. | Read | [Reference](https://pyo.dev/docs/api/reference/projects/preview-compose) | | `set_project_isolation` | Isolate a project's network: only its own services and the web server reach them. | Full | [Reference](https://pyo.dev/docs/api/reference/projects/set-project-isolation) | | `sync_compose` | Bring a project in line with a Docker Compose file: `file` from `POST /compose/sync-plan`, which shows what this does. Only what the file says differently changes, so settings changed in Pyo that the file doesn't mention stay, and a secret's value is never changed. An image's tag or digest follows the file only when the file changed it since the last sync, so one a deploy set stays. Services whose settings change are deployed. What can't change in place (a volume that would move, another kind of source) is left as it is. A service no longer in the file stays, unless `prune`. | Full | [Reference](https://pyo.dev/docs/api/reference/projects/sync-compose) | | `update_project` | Rename a project or change its description. | Full | [Reference](https://pyo.dev/docs/api/reference/projects/update-project) | ## Clusters | Tool | What it does | Access | API | | --- | --- | --- | --- | | `create_cloud_cluster` | Add a cluster whose first server Pyo makes at a cloud provider (team admins). pyo-server connects it there the way Add cluster's command does, over your tailnet. Without `confirm` it answers 409 with the monthly price. Confirm that with the user, then send it again with `confirm: true`. | Full | [Reference](https://pyo.dev/docs/api/reference/clusters/create-cloud-cluster) | | `create_cluster` | Add a cluster. The response has the command that connects its first server: `curl -fsSL /server.sh \| bash -s -- connect `, which runs pyo-server with one token. On the machine Pyo itself runs on, it runs connect.sh from Pyo there. | Full | [Reference](https://pyo.dev/docs/api/reference/clusters/create-cluster) | | `discard_cluster_draft` | Discard a cluster that was added but never connected. | Full | [Reference](https://pyo.dev/docs/api/reference/clusters/discard-cluster-draft) | | `get_cluster_tunnel` | The cluster's tunnel as Pyo last saw it: its state, Cloudflare's view (`health`, `connections`, `colos`), the connectors in the cluster (`connectors`: each one's server, whether it's ready, and why not), its default domain, its certificate, and `refused` when the cluster's install is older than Pyo's. Never a token. Cloudflare's view is read again when it's older than 30 seconds. | Read | [Reference](https://pyo.dev/docs/api/reference/clusters/get-cluster-tunnel) | | `remove_cluster` | Remove a cluster from Pyo. Its servers keep running. | Full | [Reference](https://pyo.dev/docs/api/reference/clusters/remove-cluster) | | `remove_cluster_tunnel` | Remove a cluster's Cloudflare Tunnel: its routes, the DNS records Pyo made (with `restoreRecords`, the ones they replaced come back), the connector in the cluster, its certificate and the tunnel itself. Pick Public ports or Tailscale only for the cluster first. Team owners and admins. Prefer setClusterPaths. | Full | [Reference](https://pyo.dev/docs/api/reference/clusters/remove-cluster-tunnel) | | `rotate_agent_token` | A new connect command for a cluster. The old one stops working. | Full | [Reference](https://pyo.dev/docs/api/reference/clusters/rotate-agent-token) | | `rotate_tunnel_token` | Give the cluster's Cloudflare Tunnel a new token and a new certificate. The old token can't connect from then on. Its connectors still connected are cut once the new ones are, or after 5 minutes. Team owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/clusters/rotate-tunnel-token) | | `set_cluster_free_domain_address` | Where the cluster's free domains (`..nip.io`) point: "public" (its public IP, for everyone) or "tailscale" (its Tailscale IP, only from the tailnet). With "tailscale", services are reachable from your tailnet on ports 80 and 443 whether or not the cluster takes public traffic. Free domains on it move to the new address in place, except ones on the public IP, which stay there while the cluster has one. By default it's public when the cluster takes public traffic and a server has its public IP itself (on a network card or as its ExternalIP), a load balancer gives it one, or its cloud maps one to it and Let's Encrypt reached it there. Behind NAT, it's Tailscale. | Full | [Reference](https://pyo.dev/docs/api/reference/clusters/set-cluster-free-domain-address) | | `set_cluster_gateway` | A cluster's gateway settings. Unset fields stay as they are. `http3`: HTTP/3 on UDP port 443 next to HTTPS. It needs public ports on and UDP port 443 free on the servers, and the servers' firewalls must let UDP 443 in. Turning it on or off drops open connections on each server's public ports once, one server at a time. `tlsMin`: "1.2" or "1.3". Changing it drops every open HTTPS connection once. `compression`: Zstd, Brotli and Gzip on services' HTTPS domains. `requestTimeout` (seconds, 1 to 3600, or 0 for no limit) and `idleTimeout` (how long a WebSocket or stream may stay quiet, 60 to 86400 seconds, at least the request timeout): the defaults for services without their own. Compression and the defaults change routes only, without dropping connections. `drops` in the answer says whether open connections drop once. Team owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/clusters/set-cluster-gateway) | | `set_cluster_paths` | Turn a cluster's traffic paths on or off: public ports 80 and 443 (`public`), Cloudflare Tunnel (`tunnel`, with `defaultDomain` and `accountId` as for setClusterTraffic) and websites on the tailnet (`tailnet`: ts.net names and free domains on the servers' Tailscale addresses; the servers stay on the tailnet). Unset fields stay as they are. At least one path stays on. Each domain takes one path, and a domain whose path is off isn't served. When a path turned off still has domains, nothing changes: `status` is "confirm" and `domains` lists them, each with `outcome` "moves" or "stops". Send it again with `confirm` to go ahead. Turning public ports off with the tunnel on moves the domains in the tunnel's Cloudflare account to the tunnel first (`moveToTunnel`, on by default), and the ports close once every one of them is on it (`status` "moving"): its record has moved and Cloudflare has had time to serve it. Published TCP and UDP ports pause for a few seconds when public ports go on or off, as they move between Services. Turning the tunnel off with public ports on switches its domains back first, then removes the tunnel at Cloudflare. `dashboardDrops`: switching Tailnet drops open connections to Pyo's dashboard on the tailnet once (the cluster Pyo runs on, with ts.net names, until its connect command has run for this release). Team owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/clusters/set-cluster-paths) | | `set_cluster_preview_domain` | Set the domain previews on a cluster use (`-pr-.`, a wildcard record pointing at the cluster), or null for nip.io. Admins only. | Full | [Reference](https://pyo.dev/docs/api/reference/clusters/set-cluster-preview-domain) | | `set_cluster_public_traffic` | Whether a cluster takes public traffic: the gateway answers on every server but build-only ones (ports 80 and 443, and public TCP and UDP ports through it). Off: services are only reachable inside the cluster. Prefer setClusterPaths. | Full | [Reference](https://pyo.dev/docs/api/reference/clusters/set-cluster-public-traffic) | | `set_cluster_traffic` | How a cluster takes web traffic: "public" (ports 80 and 443 on every server but build-only ones), "tailscale" (only from the tailnet, or only inside the cluster without Tailscale) or "tunnel" (through Cloudflare Tunnel, with no ports 80 and 443 open). For "tunnel", the team's Cloudflare token needs Cloudflare Tunnel:Edit and SSL and Certificates:Edit, and the cluster's install must be Pyo's (run its connect command first when it's older). Domains in zones of the tunnel's account move to the tunnel. Those with a DNS record Pyo didn't make wait for `setDomainTunnel` with `replace`. Pyo does the Cloudflare work in the background: the cluster's `tunnel` shows how it's going. Team owners and admins. Prefer setClusterPaths. | Full | [Reference](https://pyo.dev/docs/api/reference/clusters/set-cluster-traffic) | | `set_cluster_web_proxy_protocol` | Read the visitor's address from a PROXY protocol header on the cluster's websites (ports 80 and 443), for a cluster behind another load balancer. Connections without one still work. Prefer setClusterPaths. | Full | [Reference](https://pyo.dev/docs/api/reference/clusters/set-cluster-web-proxy-protocol) | | `update_cluster` | Rename a cluster or change its description, location or tags. | Full | [Reference](https://pyo.dev/docs/api/reference/clusters/update-cluster) | | `update_cluster_agent` | On a hosted Pyo: update a cluster's agent to Pyo's version now. | Full | [Reference](https://pyo.dev/docs/api/reference/clusters/update-cluster-agent) | ## Servers | Tool | What it does | Access | API | | --- | --- | --- | --- | | `cancel_server_removal` | Stop a server removal that's waiting or failed. The server takes work again. | Full | [Reference](https://pyo.dev/docs/api/reference/servers/cancel-server-removal) | | `create_cloud_server` | Make a server at a cloud provider and join it to a cluster over your tailnet (team admins). Read the locations, server types and prices with getCloudOptions first. Its startup script holds only one-time keys: on its first boot it joins your tailnet, then fetches its join details from Pyo over the tailnet. Pyo labels it as this installation's and puts it behind a firewall that allows only the web (80 and 443) and Tailscale. Follow it in `cloudServers` of getState: creating, booting, joining, then ready. Without `confirm` it answers 409 with the monthly price. Confirm that with the user, then send it again with `confirm: true`. | Full | [Reference](https://pyo.dev/docs/api/reference/servers/create-cloud-server) | | `delete_cloud_server` | Delete a server Pyo made at a cloud provider (team admins): its services move off it, it leaves the cluster and your tailnet, then it's deleted at the provider. Only servers with this installation's label are ever deleted there. A cluster's first server goes once the cluster is removed. Without `confirm` it answers 409 with the monthly cost that stops. Confirm that with the user, then send it again with `confirm: true`. | Full | [Reference](https://pyo.dev/docs/api/reference/servers/delete-cloud-server) | | `get_can_add_server` | The same check Pyo makes as a new server, cluster or builder server is added. Always yes when self-hosted. On Pyo Cloud, no without a subscription that covers one more server, with the reason. | Read | [Reference](https://pyo.dev/docs/api/reference/servers/get-can-add-server) | | `get_cloud_options` | What a new server at a cloud provider can be, read live from it with the team's token: its locations, and its server types with their specs, architecture, where each can be made now and its monthly price in each location (before VAT, with its IPv4 address). Pyo's servers run x86-64, so Arm types have `supported` false. | Read | [Reference](https://pyo.dev/docs/api/reference/servers/get-cloud-options) | | `get_tailnet_lock` | With Tailnet Lock on, a new server stays off the tailnet until a signing device signs its key. These are the ones on the team's clusters' tailnets that wait, with the command to run on a signing device, as each cluster last saw them. Empty without Tailscale set up. | Read | [Reference](https://pyo.dev/docs/api/reference/servers/get-tailnet-lock) | | `join_server` | The command that joins a new server to a cluster: `curl -fsSL /server.sh \| bash -s -- join `, which runs pyo-server with one token (valid for an hour). | Full | [Reference](https://pyo.dev/docs/api/reference/servers/join-server) | | `remove_server` | Take a server out of its cluster, moving its services off first. `force` removes it at once, for a machine that's gone. | Full | [Reference](https://pyo.dev/docs/api/reference/servers/remove-server) | | `set_server_maintenance` | Put a server in maintenance (its services move elsewhere), or bring it back. | Full | [Reference](https://pyo.dev/docs/api/reference/servers/set-server-maintenance) | | `set_server_region` | Set a server's region: a name ("US East", "Singapore, SG"), or "" to detect it again. | Full | [Reference](https://pyo.dev/docs/api/reference/servers/set-server-location) | | `set_server_regular_services` | On a GPU server: also run regular services, or keep it for GPU work. Null goes back to the default. | Full | [Reference](https://pyo.dev/docs/api/reference/servers/set-server-regular-services) | | `set_server_schedulable` | Whether new work may be placed on a server. | Full | [Reference](https://pyo.dev/docs/api/reference/servers/set-server-schedulable) | | `set_server_tags` | Set a server's tags. | Full | [Reference](https://pyo.dev/docs/api/reference/servers/set-server-tags) | ## Firewall | Tool | What it does | Access | API | | --- | --- | --- | --- | | `add_firewall_rule` | Add an access rule to the end of a service's firewall. Allow and block rules are checked in order, and the first match decides. With no match, the client gets in. Rate limit rules then apply to websites, and each matching one counts the request, per client address and per server. | Full | [Reference](https://pyo.dev/docs/api/reference/firewall/add-firewall-rule) | | `add_waf_rule` | Add a custom web application firewall rule to a service. Custom rules run in order before the OWASP rules, while the service's WAF is on. It goes last in the list. | Full | [Reference](https://pyo.dev/docs/api/reference/firewall/add-waf-rule) | | `get_firewall_blocked` | What a service's firewall turned away: website requests (a 403, or a 429 over a rate limit) and connections to TCP ports through the gateway. It shows them over time (`series`), per rule, per source, country and website path, and the latest 50. A rule is its id, or "blocked" or "rate-limit" when no rule matches the source now. UDP ports and ports that bypass the gateway aren't counted. | Read | [Reference](https://pyo.dev/docs/api/reference/firewall/get-firewall-blocked) | | `get_waf_hits` | What a service's web application firewall found: requests it blocked, and ones it only logged in log-only mode. It shows them over time (`series`), per rule, domain, source, country and path, and the latest 50 with the rules that matched. `custom` shows how often each custom rule matched, by its number. Query strings are kept with sensitive values redacted. | Read | [Reference](https://pyo.dev/docs/api/reference/firewall/get-waf-hits) | | `remove_firewall_rule` | Remove a firewall access rule. | Full | [Reference](https://pyo.dev/docs/api/reference/firewall/remove-firewall-rule) | | `remove_waf_rule` | Remove a custom web application firewall rule. | Full | [Reference](https://pyo.dev/docs/api/reference/firewall/remove-waf-rule) | | `reorder_firewall_rules` | Put a service's firewall access rules in this order: allow and block rules are checked from the first. List every one of its rules. | Full | [Reference](https://pyo.dev/docs/api/reference/firewall/reorder-firewall-rules) | | `reorder_waf_rules` | Put a service's custom web application firewall rules in this order. List every one of its rules. | Full | [Reference](https://pyo.dev/docs/api/reference/firewall/reorder-waf-rules) | | `set_service_behind_cdn` | Put a service's websites behind a CDN, or take them out of it. Behind Cloudflare, only Cloudflare's address ranges reach its websites, and the visitor is the address Cloudflare forwards (taken only from connections that come from those ranges): firewall rules, rate limits and analytics see that visitor. Over plain HTTP only Cloudflare's connections are checked, so set Cloudflare's SSL mode to Full (strict). Let's Encrypt's challenges always get through. | Full | [Reference](https://pyo.dev/docs/api/reference/firewall/set-service-behind-cdn) | | `set_service_waf` | A service's web application firewall (WAF) settings, for all its domains. "log" or "block" turns it on: the WAF starts on the service's cluster with the first service there that turns it on, and stops after the last one turns it off. | Full | [Reference](https://pyo.dev/docs/api/reference/firewall/set-service-waf) | | `update_firewall_rule` | Change a firewall access rule. Omitted fields stay as they are (as in `addFirewallRule`). | Full | [Reference](https://pyo.dev/docs/api/reference/firewall/update-firewall-rule) | | `update_waf_rule` | Change a custom web application firewall rule. Omitted fields stay as they are. | Full | [Reference](https://pyo.dev/docs/api/reference/firewall/update-waf-rule) | ## Builders | Tool | What it does | Access | API | | --- | --- | --- | --- | | `create_builder` | Add a builder that builds images from Git on one of the team's servers (`kind` "cluster"). | Full | [Reference](https://pyo.dev/docs/api/reference/builders/create-builder) | | `remove_builder` | Remove a builder. | Full | [Reference](https://pyo.dev/docs/api/reference/builders/remove-builder) | | `rotate_builder_token` | A new token for a builder. The old one stops working. | Full | [Reference](https://pyo.dev/docs/api/reference/builders/rotate-builder-token) | ## Images | Tool | What it does | Access | API | | --- | --- | --- | --- | | `create_registry_token` | Create a token to push (or only pull) the team's own images in Pyo registry, as `///:`. These are slugs, and `` is the registry's name on the installation's tailnet (registry.<tailnet>.ts.net). A push needs that project and service to exist. It works over HTTPS from a device on the installation's tailnet. Team owners and admins. The token comes back only once, with the username, address and team path to log in and push with. | Full | [Reference](https://pyo.dev/docs/api/reference/images/create-registry-token) | | `get_registry` | Pyo's registry, where the images it builds from Git and the team's own pushes are kept, as one team sees it: its address, where it runs (when the team has that cluster), whether Pyo reaches it, the space the team's images take, the team's repositories (tags, size, last build) and its cleanup: how many deployments' images are kept per service, and when images were last removed (within the last week). Read only. | Read | [Reference](https://pyo.dev/docs/api/reference/images/get-registry) | | `list_images` | Every image a team's services deployed, by repository, with each version's deployments, the services that used it and whether one runs it now. | Read | [Reference](https://pyo.dev/docs/api/reference/images/list-images) | | `remove_registry_login` | Remove a registry login. | Full | [Reference](https://pyo.dev/docs/api/reference/images/remove-registry-login) | | `revoke_registry_token` | Revoke a Pyo registry token. Team owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/images/revoke-registry-token) | | `save_registry_login` | Save a login for a private registry, one per host. Pyo checks it with the registry first. | Full | [Reference](https://pyo.dev/docs/api/reference/images/save-registry-login) | ## GitHub | Tool | What it does | Access | API | | --- | --- | --- | --- | | `get_github_build_file` | API key access: **read**. | Read | [Reference](https://pyo.dev/docs/api/reference/github/get-github-build-file) | | `github_install_url` | The GitHub page where a team installs the GitHub App. | Full | [Reference](https://pyo.dev/docs/api/reference/github/github-install-url) | | `list_github_repos` | The repositories the team's GitHub installations can see, to deploy from. | Read | [Reference](https://pyo.dev/docs/api/reference/github/list-github-repos) | | `remove_github_installation` | Unlink a GitHub installation from a team. | Full | [Reference](https://pyo.dev/docs/api/reference/github/remove-github-installation) | ## Integrations | Tool | What it does | Access | API | | --- | --- | --- | --- | | `check_secret_import` | The key names at a path of a secret store, to check it before importing. Never values. | Full | [Reference](https://pyo.dev/docs/api/reference/integrations/check-secret-import) | | `connect_cloudflare` | Connect the team's Cloudflare account, or replace its token. The token needs Zone:Read and DNS:Edit on the zones Pyo may use, and for Cloudflare Tunnel also Cloudflare Tunnel:Edit and SSL and Certificates:Edit. Pyo lists its zones and their accounts, checks it can edit DNS in each (it makes and deletes a TXT record `_pyo-check.`), checks the tunnel permissions (it makes and deletes a tunnel `pyo-check--` once per account, and reads each zone's Origin CA certificates), then keeps it encrypted. It's never shown again. Each zone's `tunnel` says whether it can use Cloudflare Tunnel. Team owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/integrations/connect-cloudflare) | | `get_cloudflare` | The team's Cloudflare connection: the zones its token covers as of the last test, and whether Pyo can edit DNS in each. Pyo creates a domain's DNS record when one of these zones covers it. Never the token: owners and admins also see its last four characters (`hint`). | Read | [Reference](https://pyo.dev/docs/api/reference/integrations/get-cloudflare) | | `remove_cloudflare` | Forget the team's Cloudflare token. DNS records Pyo made stay in Cloudflare. Team owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/integrations/remove-cloudflare) | | `remove_hetzner` | Forget the team's Hetzner token. Servers Pyo made there keep running. | Full | [Reference](https://pyo.dev/docs/api/reference/integrations/remove-hetzner) | | `save_hetzner` | Connect a team to Hetzner Cloud (team admins): a project API token with Read & Write, from the project's Security page. Pyo checks it by listing the locations, and keeps it encrypted. Servers join over your tailnet, so Tailscale comes first. | Full | [Reference](https://pyo.dev/docs/api/reference/integrations/save-hetzner) | | `test_cloudflare` | Check the saved Cloudflare token again: the zones it covers now, whether each can use Cloudflare Tunnel, and what it's missing (`problems`). Team owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/integrations/test-cloudflare) | | `test_hetzner` | List the locations the team's Hetzner token sees. | Full | [Reference](https://pyo.dev/docs/api/reference/integrations/test-hetzner) | ## Alerts | Tool | What it does | Access | API | | --- | --- | --- | --- | | `add_alert_channel` | Send the team's alerts somewhere: `kind` "telegram" (a bot `token` and a `chatId`), "discord" or "slack" (the channel's `webhookUrl`), or "webhook" (your `webhookUrl`, and a `secret` to sign each request with). Pyo keeps it encrypted. Team owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/alerts/add-alert-channel) | | `remove_alert_channel` | Remove an alert channel. Team owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/alerts/remove-alert-channel) | | `test_alert_channel` | Send a test alert to a channel now. When it doesn't arrive, the error says why. Team owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/alerts/test-alert-channel) | | `update_alert_channel` | Change an alert channel. What you leave out stays as it is. An empty `secret` stops signing. Team owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/alerts/update-alert-channel) | ## Git providers | Tool | What it does | Access | API | | --- | --- | --- | --- | | `get_git_build_file` | The Dockerfile a build of a repository of the team's Git connections would use by default, in the build context. Null: the build is zero-config (Railpack). | Read | [Reference](https://pyo.dev/docs/api/reference/git-providers/get-git-build-file) | | `list_git_branches` | A repository's branches, through one of the team's Git connections. | Read | [Reference](https://pyo.dev/docs/api/reference/git-providers/list-git-branches) | | `list_git_repos` | The repositories the team's Git connections (GitLab) can deploy: those their token has the Maintainer role on, latest activity first. | Read | [Reference](https://pyo.dev/docs/api/reference/git-providers/list-git-repos) | | `remove_git_connection` | Disconnect a Git connection, and remove the webhooks Pyo made. Not while a service deploys from it. Team owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/git-providers/remove-git-connection) | | `test_git_connection` | Check what a Git connection's token can do now. `problems` says what's missing, and `working` whether it works at all. Team owners and admins. | Full | [Reference](https://pyo.dev/docs/api/reference/git-providers/test-git-connection) | ## Sandboxes | Tool | What it does | Access | API | | --- | --- | --- | --- | | `create_cloud_sandbox_server` | Makes a server in the team's Hetzner project and sets it up as a sandbox server, the way Pyo makes a cluster's servers there. Read the locations, server types and prices with getCloudOptions first. On its first boot pyo-server joins your tailnet and sets it up with a one-time code. Hetzner Cloud servers have no KVM, so it runs sandboxes on gVisor. Follow it in the server's `cloud` (creating, booting, joining, ready) and `state`. Without `confirm` it answers 409 with the monthly price. Confirm that with the user, then send it again with `confirm: true`. Team owners and admins. Needs Tailscale and the team's Hetzner connection. | Full | [Reference](https://pyo.dev/docs/api/reference/sandboxes/create-cloud-sandbox-server) | | `create_sandbox_template` | A template made from an OCI image, like "node:22", or an image in Pyo's registry. Every sandbox server that may use it pulls the image and makes a root disk from it. A Firecracker server boots it once and snapshots it, and a gVisor server starts sandboxes from the disk. The template is ready once one server has it. | Sandboxes | [Reference](https://pyo.dev/docs/api/reference/sandboxes/create-sandbox-template) | | `delete_sandbox_template` | Deletes it here and on the sandbox servers. Refused while sandboxes run from it. | Sandboxes | [Reference](https://pyo.dev/docs/api/reference/sandboxes/delete-sandbox-template) | | `extend_sandbox` | Sets when the sandbox ends: `ttl` from now, or never with `"none"`. | Sandboxes | [Reference](https://pyo.dev/docs/api/reference/sandboxes/extend-sandbox) | | `get_sandbox` | One sandbox, as `listSandboxes` lists them, with a fresh `connection` for its server when you may use it. | Read | [Reference](https://pyo.dev/docs/api/reference/sandboxes/get-sandbox) | | `list_sandbox_servers` | The servers a team's sandboxes run on: its own and the installation's. | Read | [Reference](https://pyo.dev/docs/api/reference/sandboxes/list-sandbox-servers) | | `list_sandbox_templates` | What a team's sandboxes can start from: its own templates and the installation's. | Read | [Reference](https://pyo.dev/docs/api/reference/sandboxes/list-sandbox-templates) | | `list_sandboxes` | A team's sandboxes: their template, size, state, server and lifetime. Env values are never shown, only their names. | Read | [Reference](https://pyo.dev/docs/api/reference/sandboxes/list-sandboxes) | | `remove_sandbox_server` | Deletes its sandboxes where it still answers, and forgets it. To take the daemon off the server, run `pyo-server uninstall` there. A server set up with sandbox.sh before 0.53.0 takes `sandbox.sh --uninstall`. A server Pyo made at a cloud provider leaves your tailnet and is deleted there, which takes `confirm`. With `draft`, only a server that never joined is removed, and one that joined is left alone. | Full | [Reference](https://pyo.dev/docs/api/reference/sandboxes/remove-sandbox-server) | | `resume_sandbox` | Starts a paused sandbox again where it was. | Sandboxes | [Reference](https://pyo.dev/docs/api/reference/sandboxes/resume-sandbox) | --- # Migrating a database Move a Postgres or MySQL database from another provider into Pyo. Pyo can copy a Postgres or MySQL database from another provider into one of its own [databases](https://pyo.dev/docs/databases), straight from its connection URL or from a dump file. This page shows how to move a database and what to plan for. Moving from Coolify, Dokploy, Railway or Vercel? [Importing from another platform](https://pyo.dev/docs/import-platforms) brings your services and their databases over together. ## Before you start - **The source must be reachable from your cluster.** The copy runs on your cluster, not in your browser. If the provider only accepts connections from listed addresses, allow the public addresses your servers connect out from, or use a dump file instead. - **Writes during the copy aren't copied.** Pyo takes a consistent snapshot of the source when the copy starts. Anything written after that stays behind. Plan a short window with no writes. Before you import, stop whatever writes to the source, or put it in maintenance mode. - **Versions:** a Postgres source can be up to version 18, and the database it goes into must be the same version or newer. A MySQL source can be MySQL 5.7 to 8.4. MariaDB isn't supported. - **Extensions (Postgres):** Pyo turns on the ones it manages, and the import creates the others it knows. If the source uses one that Pyo's Postgres doesn't have, the import stops and names it. Drop it from the source first if you don't need it. - **One database at a time:** a URL copies the database it names. Users, roles and privileges aren't copied. Your services connect with the new database's own login. - **Size:** a copy streams through your cluster. Give the new database enough storage for the data and its indexes. ## Move it 1. **Get a URL that can read everything.** Its user must be able to read every table, view, sequence and routine. For TLS, add `?sslmode=require` to a Postgres URL, or `?ssl-mode=REQUIRED` to a MySQL one. `verify-full` and `VERIFY_IDENTITY` also check the certificate. 2. **Stop writes** to the source. 3. **Import:** choose **New → Import database**. Pick the engine, paste the URL under **Connection URL**, and name the new database. Set its size and storage under **Options**. **Check connection** tells you what's wrong if it can't go ahead. Then choose **Import**. 4. **Wait for it:** the database shows **Importing…** with its current step. Its output is under **Logs → Import**. 5. **Check the data:** connect with the credentials on its **Connect** tab, and compare row counts with the source. 6. **Switch your services:** connect them to the new database on its **Connect** tab, deploy them, and start writing again. From the command line, into an empty database you've created: ```bash PYO_IMPORT_URL='postgres://user:password@host:5432/shop?sslmode=require' pyo db import shop ``` ## With a dump file When the source can't be reached from your cluster, dump it yourself and upload the file: ```bash # Postgres: custom format, without owners and privileges pg_dump --no-owner --no-acl -Fc "postgres://user:password@host:5432/shop" -f shop.dump # MySQL mysqldump --single-transaction --routines --triggers --events --set-gtid-purged=OFF \ -h host -u user -p shop | gzip > shop.sql.gz ``` Then pick **Dump file** instead of **Connection URL**, or run `pyo db import shop --file shop.dump`. Uploads go through Pyo and are deleted once the import succeeds, or after 24 hours. ## If it fails The error says why: the source couldn't be reached, refused the login or wanted TLS, or a statement failed while loading. A new database keeps nothing. Choose **Retry** to run the same import again, or delete the database and start over. A database that existed before stays empty. Nothing is ever written to the source. ## What's copied - **Postgres** copies tables, data, views, functions, triggers, sequences, schemas and extensions. Everything belongs to the new database's role. **MySQL** copies tables, data, views, routines, triggers and events, with `DEFINER` clauses removed, so the new database's user becomes the definer. - Sequences and auto-increment counters continue where the source left off. --- # Isolating projects Keep projects from reaching each other. New projects are isolated. Only their own services, [Pyo Gateway](https://pyo.dev/docs/gateway), public ports and your team's [database imports](https://pyo.dev/docs/databases#import-data) can reach them. To open a project to the rest of the cluster, or isolate it again, go to **Security** in the sidebar's **Infrastructure** section. When a project is open, any service in the cluster can reach it. To expose a service on purpose, see [other kinds of traffic](https://pyo.dev/docs/domains#other-kinds-of-traffic). To choose who can reach it from outside, use the [firewall](https://pyo.dev/docs/firewall). --- # Monitoring your services See traffic, logs and resource use without adding another tool. ## Analytics **Analytics**, in the sidebar's **Observability** menu, measures your sites from the web server's own logs, so there's no script to add. You get visitors, pages, referrers, countries, devices and browsers. **Server errors** is the share of requests answered with a 5xx status. Logs show 4xx and 5xx apart. Visitors are counted with a hash that changes daily. Visitor IP addresses aren't kept by default. Each team chooses what's kept under its **Settings → Observability**, up to the installation's limit. The **Paths** tab lists the paths visitors requested, up to 100, with each one's request count. Pages counts page views only: an HTML answer with a 2xx status, or a 304 for a path without an extension. Redirects aren't page views. ## Connections A service with public TCP or UDP ports has a **Connections** card on its **Overview**, for the ports that go through [Pyo Gateway](https://pyo.dev/docs/gateway#tcp-and-udp-ports). It shows connections, clients and data over time. Each connection shows its country, bytes, duration and outcome: ok, blocked, limited or unreachable. Blocked means the [firewall](https://pyo.dev/docs/firewall) or a port's IP rule stopped it. A TCP connection is counted when it closes. A UDP exchange is counted once it's been quiet for a minute, and its duration includes that minute. Ports that skip the gateway aren't counted. ## Request logs **Request logs**, in the sidebar's **Observability** menu, shows the web server's log of every request your sites served: the time, method, URL, status, response time and size, with the visitor's browser and country. Search and filter them to find a request. Sensitive values in query strings are hidden. They're kept on each cluster, for 7 days or up to 1 GB by default. Change both, or turn request logs off, under the team's **Settings → Observability**. Request logs ask the cluster when you open them, so they need it online. The totals above the log, like requests and errors, are counted once a minute is over. They show the time they count up to. The last minute or two of requests are in the log before they're in the totals. These are request logs, not your service's own output. Service logs are on each service. New lines show as they're printed, over one stream from the cluster. Open them from the service, or use the CLI: ```bash pyo logs --follow ``` ## Metrics See CPU and memory for each server and service, and for [Pyo Gateway](https://pyo.dev/docs/gateway), which handles all web traffic into each cluster. The gateway has no limit of its own, so its use is shown against the cluster's total capacity. ## How long it's kept An admin chooses how long Pyo keeps history, under **Settings → Observability**: | | Default | Choices | | --- | --- | --- | | Analytics | 12 months | 3, 6, 12 or 24 months | | Metrics | 30 days | 7 to 90 days | | Build logs | 90 days | 30 to 365 days | Analytics includes connections and firewall and WAF history. Metrics cover servers, services and databases. A team can keep its analytics for less time under its own **Settings → Observability**: 3, 6 or 12 months, never longer than the installation. Older analytics go each night. On [Pyo Cloud](https://pyo.dev/docs/cloud/data), this is the only retention you set. ## Turning it on or off Analytics, Request logs, connections, firewall and WAF history and metrics over time all need Pyo's observability, which stores what each cluster's servers send. It's on unless a new install's server has less than 3.5 GB of memory. There it starts off to save memory. An admin turns it on or off under **Settings → Observability**, or with the CLI: ```bash pyo observability off ``` A team can turn it off for itself under its **Settings → Observability**, or with `pyo observability off --team `. Pyo stops collecting for the team. What was stored is kept and stays readable. Request logs answer that observability is off for the team. While it's off: - Pyo stops collecting and frees the memory it used, about 150 MB on the server Pyo runs on and a little on each server. - Analytics, Request logs and the charts over time say it's off. - What was stored is kept. Turn it back on to see it again, with a gap for the time it was off. - Everything else keeps working: your services' own logs, current CPU and memory, deploys, the firewall and the WAF. Pyo never turns it on or off by itself after the install. If the server's memory changes, **Settings → Observability** suggests turning it on or off. ## Terminal Open a shell in any running service from the dashboard, or from your terminal: ```bash pyo exec ``` ## Activity **Activity**, in the same menu, records who deployed or changed what, and when. --- # Passkeys Sign in with your fingerprint, face or security key instead of a password. A passkey signs you in with your device's screen lock or a security key. There's nothing to type, and it can't be phished, because it only works on the site it was made for. ## Add a passkey Go to **Profile** and choose **Add passkey** under **Passkeys**. Enter your password. Your browser then asks where to save the passkey, like your password manager, your phone or a security key. Add one on each device you use. You can rename or delete them under **Passkeys** too. Your password keeps working, so deleting a passkey never locks you out. If you lose your password, see [Getting back in](https://pyo.dev/docs/getting-back-in). ## Sign in On the sign-in page, choose **Sign in with passkey**. Where the browser supports it, your passkeys are also offered when you click the email field. With [two-factor authentication](https://pyo.dev/docs/two-factor) on, a passkey still signs you in on its own, with no code. ## Where passkeys work A passkey belongs to the address you added it at. One added at `https://pyo..ts.net` doesn't work at `https://pyo..nip.io`, and the other way around. Your passkeys list shows the address of any that belong somewhere else. Pyo offers passkeys at: - `localhost`, on any port - its public address, `https://pyo..nip.io`, while the [public dashboard](https://pyo.dev/docs/tailscale#closing-the-public-dashboard) is open - its [Tailscale](https://pyo.dev/docs/tailscale) address, `https://pyo..ts.net` - the dashboard address in [Email settings](https://pyo.dev/docs/email) - any address in `PYO_PASSKEY_ORIGINS`, for a domain of your own: ```bash sudo k3s kubectl -n pyo-system set env deployment/pyo PYO_PASSKEY_ORIGINS=https://pyo.example.com ``` Other addresses, and plain HTTP anywhere but `localhost`, only offer password sign-in. --- # Creating a project Group related services, like a website with its API and database. A project groups services that belong together. Each one has its own Kubernetes namespace, so services in a project can reach each other by name. ## Create a project You create a project while you deploy a service. Under **Project**, choose **New project**. It's created when the service deploys. See [Deploying a service](https://pyo.dev/docs/deploy). Each project has a slug, the lowercase name used in service addresses. The slug also appears in the project's dashboard URLs, so it can't be a name the dashboard uses for its own pages. The slug is also the project's namespace on each cluster. Names of system namespaces, like `default`, `kube-system` and `cert-manager`, are reserved. If a cluster already has a namespace with the slug's name that Pyo didn't create, Pyo leaves it alone and the deploy fails. Use a project with another name there. ## Inside a project A project's **Overview** shows its services and where they run. Its other tabs are **Deployments** and **Settings**, which has **General**, **Networking** and **Volumes**. New projects are isolated from other projects. See [Isolating projects](https://pyo.dev/docs/network-isolation). ## Deleting a project Delete a project from its **Settings** tab, in the danger zone. Its services are deleted with it. Its volumes are kept, detached, unless you tick **Also delete volumes**. See [volumes](https://pyo.dev/docs/volumes#delete-a-volume). --- # 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](https://pyo.dev/docs/sandbox), a server that [joins a cluster](https://pyo.dev/docs/servers), or a [cluster's first server](https://pyo.dev/docs/clusters#add-a-cluster). It's new in Pyo 0.53.0. It runs on Linux, on x86-64 and arm64, as root. `pyo` is the [CLI](https://pyo.dev/docs/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: ```bash 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 ` | | **Add server** on a cluster | `join ` | | **Add cluster** | `connect `. On Pyo Cloud, and with `PYO_AGENT_SELF_UPDATE=false`, it ends in `--auto-update` or `--no-auto-update`. See [Agent updates](https://pyo.dev/docs/cloud/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](https://pyo.dev/docs/tailscale) card | `tailnet ` | 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//server.sh`. **Refresh this cluster** gets it from Pyo itself, at `/install/server.sh`. With [`PYO_SCRIPTS_URL`](https://pyo.dev/docs/system-reference#connections) 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](https://pyo.dev/docs/install). ### 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: ```bash sudo k3s kubectl -n pyo-system set env deployment/pyo PYO_SETUP_SCRIPTS=1 ``` It changes the commands for sandbox servers, joining servers, connecting clusters, refreshing a cluster, the tailnet and the servers Pyo makes at [Hetzner](https://pyo.dev/docs/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: ```text $ 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: ```text $ 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 `/install/server.sh` or a mirror's, downloads the release's `release.json` and 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](https://pyo.dev/docs/securing-pyo#what-to-keep-in-mind). ## 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](#uninstall) | | `pyo-server token show TOKEN` | Prints what a token carries, its secrets hidden | | `pyo-server version` | Prints this `pyo-server`'s release | ### Status ```text $ 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, done ``` It 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](https://pyo.dev/docs/sandbox#take-it-off-a-machine) | | A cluster's first server | Removes everything Pyo put into the cluster. k3s stays. See [Disconnect a cluster](https://pyo.dev/docs/uninstall#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](https://pyo.dev/docs/uninstall#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: ```bash sudo rm -f /usr/local/bin/pyo-server /usr/local/bin/pyo-server.previous /var/log/pyo-server.log ``` ## What 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: ```text ✓ 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: ```text ✗ 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 "".` 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 | --- # Serving traffic by region Spread replicas across regions and keep each region's traffic close to home. Each server has a region. Pyo spreads a service's replicas across regions, and answers each request from the closest healthy replica. ## A server's region Pyo detects each server's region from its address, like Singapore, and shows it with its country's flag. To group servers your own way, rename the region. For example, call two servers in different US cities `US East`. Choose **Change region** from a server's menu on the cluster's **Servers** tab, or on the server's page. A name can be up to 40 characters, and Pyo suggests regions your team already uses. **Detect automatically** puts the detected region back. The same region is used everywhere: to spread replicas, to route traffic, in the traffic view, and to [pin a service](https://pyo.dev/docs/scaling#choosing-where-services-run) to a region. ## How replicas spread Replicas spread evenly across regions, then across the servers in each region. For example, 4 replicas on servers in Singapore and the US run as 2 in each. The spread is a preference, not a rule. If a region is full or down, replicas still start in another one. Existing services pick up regions at their next deploy. ## How traffic is routed While the cluster [accepts public traffic](https://pyo.dev/docs/clusters#public-traffic), each server answers the requests that reach it, through [Pyo Gateway](https://pyo.dev/docs/gateway). Build-only servers don't. Where the server sends them is set on the cluster's **Settings** tab, under **Traffic routing**: - **Local:** keep traffic on the same server. Requests go to a replica on the server they reached, otherwise to any healthy replica. It needs an agent that supports it, and shows as disabled otherwise. - **Regional** (the default): keep traffic within the same region. Requests go to a replica in the region, otherwise to any healthy replica. - **Global:** distribute traffic across all servers. Requests go to any healthy replica. In every mode, replicas are placed across regions the same way. Only where requests go changes. A change applies to the cluster's services straight away, without a redeploy. Team owners and admins can change it, and each change is recorded in **Activity**. ## Point visitors at the right region Which server a visitor reaches is up to your DNS, or a load balancer in front of your servers. Point each region's domains at the servers in that region. Pyo doesn't do this for you today. ## See where traffic goes A service's **Overview** has a **Traffic** card, below the **Analytics** card. It shows the path the service's requests take, in three columns from left to right. - **Domains:** each domain, with a badge saying whether its DNS points at your servers. Hover over a domain to see its DNS records and which server each address belongs to. An address that isn't one of your servers is shown too. - **Entry servers:** the servers that answer requests, in a box for each region. A region's box shows how many of its replicas are healthy, its requests, server errors (5xx) and p95 response time, and a small chart of requests over the last 24 hours. The numbers need [observability](https://pyo.dev/docs/observability). Each server shows its share of the requests. Servers that don't answer requests are marked: build-only servers, or every server while the cluster's public traffic is off. - **Replicas:** grouped by the server they run on, each marked healthy or not. Lines show where requests go. A thicker line carries a bigger share. A red line leads to something that isn't healthy, and a dashed amber line leads to an address that isn't one of your servers. A legend in the corner explains them. The card's header shows whether the cluster's traffic routing is **Local**, **Regional** or **Global**, and links to the cluster's settings. Drag to move around, use the zoom buttons or **Fit**, and click a server to open it. When something looks wrong, a line above the canvas says how many problems it found. Open it to see the list. For example: - A domain points at an address that isn't one of the cluster's servers, or at a server that doesn't answer requests. - A domain points at one region, but replicas run in several, so visitors everywhere still reach that one region. - A region takes traffic but has no healthy replica, so its requests go to another region. - Replicas aren't spread evenly, usually because a region was full or offline. Redeploy once it has room. Cron jobs don't have a **Traffic** card. --- # Adding a registry Run images from private registries. Public images work with no setup. For private ones, save a login under **Integrations** in the sidebar's **Team** section. In **Container registries**, enter the registry, your username, and a password or access token. The password stays on the server, encrypted, and is never shown again. Pyo checks the login with the registry when you save it. If the installation turns off private networks with [`PYO_ALLOW_PRIVATE_NETWORKS`](https://pyo.dev/docs/system-reference#installation-settings), as Pyo Cloud does, a login for a registry on a private network is saved without a check. Pyo's own registry, where it keeps the images it builds, is listed first in **Container registries**. Find it under **Registry** in the sidebar's **Images** menu. Set how many images it keeps with [retention](https://pyo.dev/docs/images#retention). If you remove a login, services with private images from that registry can't redeploy until you add it back. ## Push your own images You can push images you build yourself to Pyo's registry, from a device on your tailnet. It's served over HTTPS at `registry..ts.net`, so there's no insecure-registry setting to change. This needs [Tailscale](https://pyo.dev/docs/tailscale) set up in Pyo. The registry is never on a public address. On [Pyo Cloud](https://pyo.dev/docs/cloud/differences#images), each cluster has its own registry. **Registry** lists each cluster's push address. A cluster needs Tailscale set up before you can push to it. Team owners and admins can set this up: 1. Open **Registry**, in the sidebar's **Images** menu, and choose **Connect**. 2. Pick the project and service the image is for. 3. Name the token, choose whether it can **Push and pull** or only **Pull**, and when it expires: 30 days, 90 days or never. Then choose **Create token**. It's shown once. 4. Log in, tag and push with the commands Pyo shows you: ```bash echo | docker login registry..ts.net -u --password-stdin docker tag registry..ts.net///: docker push registry..ts.net///: ``` Then deploy the service with that image. A token only works for your own team's images, and only pushes to a project and service that exist. Every way into Pyo's registry needs a login. Your servers pull with their cluster's own login, which Pyo puts in the command that connects them. Builders push with their own login. Neither can reach another team's images. A service can only run images from Pyo's registry that belong to its own team. Manage tokens under **Tokens**, on the same page. Revoke a token there to stop all logins with it. Cleanup never removes images you push. --- # Sandbox Isolated machines on demand, for AI agents, code interpreters, previews and CI. A sandbox is an isolated machine you create through an API. Create one, run commands, read and write files, open a port as a URL, then throw it away. Use them for: - AI agents that write and run code. - Code interpreters. - Previews of a branch or a change. - CI jobs and other code you don't trust. Sandboxes run on your own servers. They show in the same dashboard as your services and databases. ## How sandboxes run Sandboxes run on their own **sandbox servers**, outside your clusters and build servers. A sandbox server runs no k3s or Docker, just a small Pyo daemon, so a busy sandbox can't slow down your services. On a server with KVM, each sandbox is its own microVM on [Firecracker](https://firecracker-microvm.github.io), with its own kernel. On a server without KVM, like a cloud VPS, each sandbox runs under [gVisor](https://gvisor.dev), which gives it a kernel of its own in user space. Sandboxes never run as plain containers. Your code asks Pyo to create a sandbox, then runs commands and moves files with a short-lived token Pyo signs. Where those calls go depends on the sandbox server: - **With Tailscale**, the server answers on your [tailnet](https://pyo.dev/docs/tailscale), and your code talks to it directly. So the code that runs commands in a sandbox, and the browser you open its terminal in, need to be on your tailnet too. Pyo isn't in the way of each command. - **Without Tailscale**, the calls go through Pyo. They work from anywhere that reaches Pyo. See [Without Tailscale](#without-tailscale). Tailscale is optional. Sandboxes keep running while Pyo itself restarts. Only the ports you open are on the web. The sandbox server gets its work from Pyo over HTTPS. Pyo never connects to it. See [How Pyo and the server talk](#how-pyo-and-the-server-talk). ### KVM or gVisor Each time a sandbox server starts, Pyo checks what it can run: - **Firecracker on KVM.** The server has KVM and a test microVM boots in under 300 ms. This is the fastest. - **Firecracker on nested KVM.** The server is itself a VM with KVM passed through. The test boot is slower, so sandboxes start slower too. - **gVisor.** The server has no usable KVM, like most cloud VPSs, but can run [gVisor](https://gvisor.dev). A server with neither is turned away when it joins, with the reason. If a server loses KVM, it becomes a gVisor server at its next start. The **Clusters** page shows each sandbox server's runtime with a one-line summary. So do `pyo sandbox servers ls` and `runtime` in the API. A sandbox's **Isolation** is **Auto** by default, which picks Firecracker first. **VM only** (`isolation: "vm"`) never runs it on gVisor. ### Which server a sandbox runs on Pyo picks a server that's up, can run the sandbox's isolation and network, and has the memory for it. It prefers Firecracker, then a server with a snapshot of the template at that size, then the one with the most room. To choose one yourself, pick it under **Server** in **New sandbox**, or pass `server`, a server's name or id, to the [SDK](#typescript-sdk), the [API](https://pyo.dev/docs/api/reference/sandboxes/create-sandbox), `create_sandbox` in [MCP](#mcp) or `--server` in the [CLI](#cli). The sandbox then runs only there. If that server can't take it, Pyo says why, like "sandbox-1 has no room for 2 GB. Pick another server or a smaller size." ### What gVisor can't do Sandboxes on gVisor run the same templates and have the same commands, files, terminals, ports, network rules, limits, lifetimes and pause. These differ from Firecracker: - **Cold starts.** A sandbox starts from its template's disk in about 40 ms. Firecracker restores a running snapshot, so a template can't have a process already warm in it on gVisor. - **Slower system calls.** Each command and each process start costs more. A command takes about 5 ms instead of under 1 ms, and starting Python takes 4 to 5 times as long. For a code interpreter, keep one interpreter running and send it code. - **Not every Linux feature.** gVisor runs most programs, but some system calls and parts of `/proc` and `/sys` are missing. Docker doesn't fully work inside a sandbox, and nothing can run a VM inside one. - **Pause needs the same gVisor release.** A paused sandbox resumes only under the gVisor release it was paused under. An update that changes it ends the pauses on that server. - **No VM only.** A sandbox created with `isolation: "vm"` never runs on a gVisor server. - **More disk for the server.** gVisor's files take about 180 MB on the server. ## Add a sandbox server Open **Sandboxes** in the dashboard, choose **New sandbox**, then **Add server**. A team with no sandboxes and no sandbox server yet also has **Add a sandbox server** on that page. Team owners and admins can add one. There are two ways: - **Cloud provider.** Pyo buys a server for you and sets it up. It needs [Tailscale](https://pyo.dev/docs/tailscale) set up in Pyo. - **Command line.** You run one command on a server you have. It works with Tailscale or [without it](#without-tailscale). Pyo Cloud has only the command line. See [On Pyo Cloud](#on-pyo-cloud). ### Cloud provider Pyo makes the server in your team's [Hetzner](https://pyo.dev/docs/hetzner) project, the same way it makes a cluster's servers there: 1. Pick the provider. If your team hasn't connected Hetzner yet, paste a project API token with **Read & Write** right there. See [Make a token](https://pyo.dev/docs/hetzner#make-a-token). 2. Name the server, and give it an [edge domain](#edge-domain) if you want sandbox ports on the web. 3. Pick a location and a server type. Pyo reads the types, their vCPUs, memory, disk and monthly prices from Hetzner as you pick. Prices are before VAT and include the IPv4 address. 4. Choose **Create**. Pyo shows the monthly price and asks once more. The page then follows the server: **Creating**, **Booting**, **Joining**, **Ready**. On its first boot the server joins your tailnet with a single-use key, gets a one-time join code from Pyo over the tailnet and runs [`pyo-server`](https://pyo.dev/docs/pyo-server) with it. Then it joins Pyo over HTTPS, like a server you add from the command line. Nothing else secret is in its setup. If your tailnet has Tailnet Lock on, Pyo shows the command to sign the server. You can leave the page while it sets up. The **Sandboxes** page shows its progress too. Hetzner Cloud servers have no KVM, so they run sandboxes on [gVisor](#what-gvisor-cant-do). Pyo puts them behind a Hetzner firewall that lets in only the web (80 and 443) and Tailscale, and they run nothing else. Removing the server in Pyo ends its sandboxes, takes it off your tailnet and deletes it at Hetzner. Pyo shows the monthly cost that stops and asks first. ### Command line A server of your own needs: - Linux on x86-64 or arm64, with kernel 5.10 or newer and cgroup v2 - KVM for Firecracker, or else root for gVisor - a machine of its own. A machine with k3s on it is turned away. Choose **Command line**. The form shows the command at once, under **Name** and **Edge domain**: 1. Change the name if you like, and give the server an [edge domain](#edge-domain) if you want sandbox ports on the web. The command follows both fields as you type. 2. Copy the command and run it on the new machine as root. 3. The form says **Waiting for sbx-1 to join…**, then that the server is ready. **New sandbox** then creates a sandbox on it. The command works once, for 15 minutes. When it expires, the form says **This command expired**. Choose **Get a new command** for a fresh one. Each change of a field makes a new command too, and the one before stops working. To leave before the server joins: - **Cancel** takes the server back. Nothing is left of it in Pyo. - **Finish later** keeps the server and opens it on the **Clusters** page. Run the command you copied before it expires, or choose **Reset access** there for a new one. Leaving the page any other way takes the server back too. One that's still there is removed a day after its last command expired, unless it joined. The CLI gives the same command: ```bash pyo sandbox servers add sbx-1 ``` The command looks like this: ```bash curl -fsSL https://pyo.dev/v/0.53.0/server.sh | bash -s -- sandbox pyos1_eyJweW9VcmwiOi... ``` It downloads [`pyo-server`](https://pyo.dev/docs/pyo-server) for your Pyo's release, checks it and runs it. The token carries Pyo's address, the server's ID and name, its one-time code, Pyo's command key, the edge domain when you gave one and, with Tailscale, a single-use Tailscale key. `pyo-server token show` prints it with the secrets hidden. See [The token](https://pyo.dev/docs/pyo-server#the-token). With Tailscale, it joins your tailnet, gets an HTTPS certificate for its name there, installs the daemon, Firecracker and the guest kernel, checks what the server can run and joins Pyo. A server without KVM gets gVisor too, and is checked again. The server reaches Pyo at Pyo's address on your tailnet. A team with a tailnet of its own reaches Pyo at its public address instead. If Pyo has none, adding the server says so. Turn on **Public dashboard** on the [Tailscale](https://pyo.dev/docs/tailscale#closing-the-public-dashboard) card first. Your tailnet needs HTTPS certificates turned on in its DNS settings. Pyo's own names on your tailnet use them too. A machine that's on a tailnet already, but not as one of Pyo's servers, is left as it is. The command stops and says to run `tailscale logout`, then the same command again. The server's daemon answers only on your tailnet, at `https://..ts.net:7443`. Only ports 80 and 443 are public, for the edge proxy that serves sandbox ports. With ufw active, the command opens 7443 on `tailscale0` and closes 7070, which Pyo used before 0.52.0. Sandbox servers show on the **Clusters** page as their own group, with their runtime, CPUs, memory, disk and sandboxes. ### Without Tailscale A sandbox server needs no Tailscale and no cluster. Nobody picks how a server joins. Pyo picks each time it makes a join command: - **With Tailscale**, when your team has Tailscale set up, or Pyo's own server is on a tailnet. - **Without Tailscale**, when neither is. The form then says "Without Tailscale, the terminal and files go through Pyo. The desktop needs Tailscale." The command's token then carries no Tailscale key, and `pyo-server token show` shows `relay: true`. It installs and changes nothing of Tailscale. The server joins Pyo with its one-time code alone, at Pyo's public HTTPS address. If Pyo has none, adding the server says "Pyo has no HTTPS address this server can reach. Open the public dashboard or set up Tailscale, then add the server again." Nothing on the server listens for browsers and SDKs. The server opens its own connections to Pyo and takes their calls there. With ufw active, the command opens only 80 and 443, for the edge. It ends with "The terminal and files open in Pyo." The **Clusters** page shows **Proxied** where a server's tailnet name would be: its calls are proxied by Pyo. So does a sandbox's page. ### What works without Tailscale | | Without Tailscale | | --- | --- | | Creating, pausing, resuming and deleting sandboxes | Works | | Commands, files, the terminal and port calls, from the dashboard, the [SDK](#typescript-sdk) and the [CLI](#cli) | Work, through Pyo | | [MCP](#mcp) tools | Work, through Pyo as before | | Opened ports on the [edge domain](#edge-domain) | Work, straight to the server on ports 80 and 443 | | `base`, `desktop` and templates from public images | Work | | The desktop and **Browser** | Need Tailscale | | A sandbox's private web pages at `/v1/sandboxes/{id}/web/{port}/` | Need Tailscale | | Templates from [Pyo's registry](https://pyo.dev/docs/registries#push-your-own-images) | Need Tailscale. The registry is on Pyo's tailnet | | A server from a [cloud provider](#cloud-provider) | Needs Tailscale | On a sandbox whose server has no Tailscale, the desktop buttons are off and say **Needs Tailscale**. A web page on another origin than Pyo's can't make calls through Pyo. To call a sandbox from a browser page of your own, the server needs Tailscale. ### What passes through Pyo For a server without Tailscale, the bytes of each terminal, command and file call pass through Pyo. With Tailscale they go from your device to the server over your tailnet, and Pyo never carries them. To keep Pyo out of that path, set up [Tailscale](https://pyo.dev/docs/tailscale), then [move the server onto your tailnet](#move-a-server-onto-your-tailnet). Pyo takes only the sandbox's token on these calls, and checks it before it asks the server anything. The server checks the token again. Pyo answers with headers of its own, so a browser never renders or runs what a sandbox sends back. Without Tailscale, the one-time code alone guards the join. With Tailscale, Pyo also checks that your tailnet lists the server. Someone who gets a code before you run the command could join a machine of their own with it. Your server's join then fails. Choose **Reset access** on the server and run the new command. ### Limits through Pyo | Limit | Value | | --- | --- | | A request or response body | 64 MiB | | A call | 10 minutes | | A terminal or other WebSocket | 4 hours | | Calls open at once, for a server | 64 | | Calls a minute, for a sandbox | 600 | | Calls a minute, for a server | 1,800 | Pyo waits 20 seconds for the server to take a call. Then it answers "The sandbox server didn't answer. Is it online?" The dashboard says "Can't reach the sandbox server. Is it online?" A request over 64 MiB is refused. A response over it is cut off. Over 64 open calls, Pyo answers "This sandbox server has too many calls open through Pyo. Try again in a moment." On Pyo Cloud, a plain command call that sends nothing back for 100 seconds is cut off, before the 10 minutes are up. That's `exec` in the SDK and `pyo sandbox exec` in the CLI. Calls on a WebSocket aren't affected: `spawn` and `pty` in the SDK, `pyo sandbox shell` in the CLI and the dashboard's terminal. Use `spawn` for a command that stays quiet that long. ### Move a server onto your tailnet 1. Set up [Tailscale](https://pyo.dev/docs/tailscale) for your team on **Integrations**. 2. On the **Clusters** page, choose **Reset access** on the server's menu. Pyo stops taking the server's key at once and shows a new command, whose token now carries a Tailscale key. 3. Run the command on the server as root. It installs Tailscale, joins your tailnet, gets the server's HTTPS certificate and joins Pyo again. Its sandboxes keep running. The terminal, files and desktop then open on your tailnet. It works the other way too. When there's no Tailscale any more, **Reset access** gives a command without a Tailscale key. It removes the server's certificate and its renewal timer. Tailscale itself stays on the machine. If Tailscale is set up but can't be used, like when the cluster that keeps it is offline, Pyo doesn't add the server without Tailscale. It says what's wrong instead. ### On Pyo Cloud A Pyo Cloud team adds a sandbox server with one command. The server needs no cluster. Once it joined, it counts as a server on your [bill](https://pyo.dev/docs/cloud/billing). 1. Open **Sandboxes**, choose **New sandbox**, then **Add server**. Team owners and admins can add one. 2. The form shows the command as the page opens. Change the name if you like, and give the server an [edge domain](#edge-domain) if you want sandbox ports on the web. 3. Run the command on the server. It asks for root itself. It works once, for 15 minutes. `pyo sandbox servers add sbx-1` gives the same command. In the API it's [createSandboxJoinCode](https://pyo.dev/docs/api/reference/sandboxes/create-sandbox-join-code), in place of `addSandboxServer`. How the server joins depends on your team's [Tailscale](https://pyo.dev/docs/cloud/differences#tailscale) on **Integrations**: - **With it**, the command carries a single-use key from your team's Tailscale. The server joins your tailnet, gets an HTTPS certificate for its name there, then joins Pyo Cloud over HTTPS. The cluster that keeps your Tailscale has to be connected when you add the server. - **Without it**, the command carries no Tailscale key. The server joins Pyo Cloud with its one-time code alone. See [Without Tailscale](#without-tailscale). Either way the server reaches Pyo Cloud over HTTPS, at the address your clusters' agents use. It gets its work there with a key of its own, and every command is signed for that one server. Pyo Cloud never connects to the server and never reaches into your tailnet. See [How Pyo and the server talk](#how-pyo-and-the-server-talk). With Tailscale, the desktop, terminal and files open at the server's own name on your tailnet, like `https://sbx-1.tail1234.ts.net:7443`. So they open only from devices on your team's tailnet. Elsewhere the dashboard says **Opens from devices on your team's tailnet.** The [SDK](#typescript-sdk) and the CLI's `exec`, `shell` and `cp` use that address too. [MCP](#mcp) tools go through Pyo Cloud, so they work from anywhere. Without Tailscale, the terminal and files go [through Pyo Cloud](#what-passes-through-pyo), and the desktop needs Tailscale. Pyo Cloud doesn't have: - **Servers from a cloud provider.** Pyo Cloud doesn't make sandbox servers at Hetzner. Buy a server at any provider and run the command on it. - **Shared servers.** Each team has only its own sandbox servers. A self-hosted Pyo can also have servers of the installation, which every team may use. - **Templates from Pyo's registry.** Pyo Cloud has no registry of its own. Make [your own templates](#your-own-templates) from public images. ### How the files are checked The sandbox server's files come with each Pyo release. [`server.sh` checks `pyo-server`](https://pyo.dev/docs/pyo-server#how-pyo-server-is-checked) before it runs. Before anything changes on the server, `pyo-server` checks the release's `release.json` against its Sigstore signature, for exactly its own release. Then it checks the files against the SHA-256 that `release.json` lists for that architecture in its `sandbox` field, and gVisor's files against its `sandboxGvisor` field. gVisor is a pinned release, checked against its own SHA-512 when Pyo's release is made. If anything doesn't match, nothing is installed. ### Options Pyo's command carries everything that joins the server. You can add these after the token. They change how it installs: | Option | What it does | | --- | --- | | `--edge-domain D` | Serve sandbox ports at `-.D` on ports 80 and 443. Also `PYO_SANDBOX_EDGE_DOMAIN`. See [Edge domain](#edge-domain). | | `--edge-cert FILE` | The certificate for `*.D`, as PEM with the full chain. Default `/etc/pyo-sandbox/edge/cert.pem`. | | `--edge-key FILE` | Its private key. Default `/etc/pyo-sandbox/edge/key.pem`. | | `--bundle FILE` | Sandbox files from a file or URL instead of the release. Also `PYO_SANDBOX_BUNDLE`. They're checked against `--bundle-sha256`, or else against the signed `release.json`. | | `--bundle-sha256 SUM` | The SHA-256 to check `--bundle` against. Also `PYO_SANDBOX_BUNDLE_SHA256`. | | `--gvisor-bundle X` | gVisor's files from a file or URL instead of the release, for a server without KVM. Also `PYO_SANDBOX_GVISOR_BUNDLE`. They're checked against the signed `release.json`. | | `--dev` | Skip the check, for files you built yourself. Also `PYO_SANDBOX_DEV=1`. | `server.sh` takes two more, which Pyo adds when they're needed: | Option | What it does | | --- | --- | | `--version X` | The Pyo release whose `pyo-server` and sandbox files to install, like `0.53.0`. The copies of `server.sh` on pyo.dev and in Pyo know their release without it. | | `--dev-commit C` | For a development build of Pyo: the `pyo-server` and files CI published for commit `C` on `dev`, instead of a release's. Their `release.json` must be signed by Pyo's development workflow on `dev` and name that commit, and the files must match the SHA-256 it lists. A development build's command uses it in place of `--version`. | ### Update the daemon Run this on the server as root: ```bash sudo pyo-server update ``` It brings `pyo-server` to the release your Pyo runs, then updates the daemon. Running sandboxes keep running. The server keeps the way it joined, with or without Tailscale. A gVisor server gets the release's gVisor too. See [Update](https://pyo.dev/docs/pyo-server#update). A server set up before 0.53.0 has no `pyo-server` yet. Run `server.sh` of your Pyo's release with `sandbox` and no token, which installs `pyo-server` and updates the daemon: ```bash curl -fsSL https://pyo.dev/v/0.53.0/server.sh | bash -s -- sandbox ``` ### Take it off a machine To take Pyo off the server, remove it on the **Clusters** page or with `pyo sandbox servers rm`. Pyo stops taking the server's key at once. Its sandboxes keep running there until their lifetime ends, or until you run this on it: ```bash sudo pyo-server uninstall ``` It stops the daemon and ends its sandboxes. It removes the daemon's files in `/usr/local/lib/pyo-sandbox`, `/etc/pyo-sandbox` and `/var/lib/pyo-sandbox`, its units, its firewall rules and `/var/lib/pyo-server`. Tailscale stays, and so does the system user `pyo-sandbox`. A server set up before 0.53.0 takes the script's command: ```bash curl -fsSL https://your-pyo/install/sandbox.sh | bash -s -- --uninstall ``` ### How Pyo and the server talk - **The join.** The server makes a key of its own and joins Pyo with the one-time code. With Tailscale, Pyo takes the join only from a server your tailnet lists as one of Pyo's. [Without Tailscale](#what-passes-through-pyo), the code alone guards it. - **Its work.** The server asks Pyo for its commands and sends back their results and a report every 15 seconds. It signs each request with its key. The key opens only that server's commands, and lasts a day. The server renews it by itself. - **Signed commands.** Pyo signs each command with its own key, for that one server. The server checks the signature, the server it names and that it's new before it runs it. It takes Pyo's key from the command you ran. - **Reset access.** Choose **Reset access** on the server's menu on the **Clusters** page. Pyo stops taking the server's key at once, and gives you a new command for the same server. Its sandboxes keep running. Run the command on the server to join it again. A server that was off for more than a day needs this too, since its key ran out. The new command joins it on your tailnet when there's Tailscale, without it otherwise. So it also [moves a server onto your tailnet](#move-a-server-onto-your-tailnet). ### Update a server A sandbox server that joined before Pyo 0.52.0 needs an update. Pyo no longer reaches it the old way, so it takes no commands until you update it. The **Clusters** page shows **Needs update** and "This server needs an update. Press Update to reconnect it." Each sandbox on it shows the same. Until then, creating, deleting, pausing or resuming its sandboxes, opening their ports, the terminal, files and the desktop all say so. Its sandboxes keep running. Choose **Update** on the server or on one of its sandboxes. Pyo shows a command for the same server. Run it on the server as root. The server joins over HTTPS and takes commands again, and its sandboxes keep running. The command joins it on your tailnet when there's Tailscale, [without it](#without-tailscale) otherwise. `pyo sandbox servers ls` shows **needs update** for such a server. A command with `--pyo` no longer works. Running it, or updating such a server with `pyo-server sandbox` and no token, says to press **Update** in Pyo. ## Edge domain Opened ports are served by the sandbox server's edge proxy, at `https://-.`, like `https://3000-sbx-abc.sbx.example.com`. Give a server an edge domain when you add it, under **Edge domain**, or with `--edge-domain`. Without one, ports can't be opened on that server. The edge domain needs a wildcard DNS record, `*.sbx.example.com`, pointing at the server's public address. HTTPS needs a wildcard certificate for it. ### With Cloudflare When your [Cloudflare](https://pyo.dev/docs/cloudflare) connection can edit the domain's zone, the server's menu on the **Clusters** page offers: - **Create DNS record**, which adds the wildcard record pointing at the server's public addresses, not proxied by Cloudflare. A record already on that name is never changed. - **Get certificate**, which gets a wildcard certificate from Let's Encrypt and puts it on the server. Pyo renews it 30 days before it runs out. **Renew certificate** renews it now. Pyo gets the certificate itself, so your Cloudflare token never goes to the sandbox server. ### Your own certificate Without Cloudflare, put a wildcard certificate on the server yourself, at `/etc/pyo-sandbox/edge/cert.pem` and `/etc/pyo-sandbox/edge/key.pem`, or the paths you gave with `--edge-cert` and `--edge-key`. The edge serves it within a minute, with no restart. Until there's a certificate, ports are served over plain HTTP. ## Templates A sandbox starts from a sandbox template, made from a container image. Find them under **Templates**, in the sidebar's **Sandboxes** menu. ### The base template Every Pyo has `base`, a template Pyo makes for you. A sandbox starts from it when you don't name a template, and **New sandbox** picks it first. It's listed under **Sandbox templates** from the start, even before you add a sandbox server. It's Ubuntu 24.04 LTS with the tools coding agents expect: - **System:** git, curl, wget, jq, ripgrep, zip, unzip, rsync, openssh-client, sudo, vim, nano and the usual network tools. - **Build tools:** build-essential, pkg-config, cmake and ninja. - **Python:** Python 3.12 with pip, venv and [uv](https://docs.astral.sh/uv/). - **JavaScript:** Node.js 24 LTS with npm, pnpm, [Bun](https://bun.sh) and [Deno](https://deno.com). - **CLIs:** GitHub's `gh` and the Docker CLI with buildx and compose. There's no Docker daemon in it, so point `DOCKER_HOST` at one. - **Coding agents:** Claude Code, Codex and opencode. Commands run as root in `/root`. pip installs into the system Python, since a sandbox is thrown away. The full list with versions is in [pyo-sandbox-images](https://github.com/upsetdev/pyo-sandbox-images#base). `base` belongs to the installation, so every team has it. It can't be deleted, and no other template can be named `base`. ### The desktop template `desktop` is `base` with a desktop and a browser, for agents that use a browser and for people who want to watch them. Its sandboxes get 2 CPUs and 2 GiB of memory unless you ask for more. - **The screen:** a desktop you watch and use in your browser, served by voxl on port 6080 inside the sandbox. Choose **Desktop** in the sandboxes list or **Open desktop** on the sandbox's page. It opens over HTTPS on your tailnet, so it needs [Tailscale](https://pyo.dev/docs/tailscale) set up in Pyo. Until then, **Open desktop** is greyed out. On a server that joined [without Tailscale](#without-tailscale) it says **Needs Tailscale**. Set up Tailscale, then choose **Reset access** on the server. - **The browser:** Google Chrome on x86-64 and Chromium on arm64. Drive it over the Chrome DevTools Protocol at `127.0.0.1:9222` inside the sandbox, with Playwright or Puppeteer. **Browser** in the sandboxes list opens the screen with the browser in front. Nothing starts until it's used: the first look at the screen or the first CDP connection starts the desktop, then the browser. ```bash pyo sandbox create desktop ``` Like `base`, it belongs to the installation and can't be deleted. ### On first use A sandbox server doesn't get `base` or `desktop` when it joins. It makes each the first time a sandbox needs it there: it downloads the image, about 0.9 GB for `base` and 1.25 GB for `desktop`, then unpacks it and boots it once. The create waits for that and then starts the sandbox, so the first sandbox from it on a server takes longer. Later ones on that server start at once. While it waits, the dashboard says **Getting base ready on sandbox-1…** with how far it got, and the templates list shows each server's progress. Two sandboxes created at once on that server wait for the same download. The templates page says `base` is **Ready to use** and lists the servers that have it. If a server isn't done after 4 minutes, the create stops with "base is still getting ready on sandbox-1. Try again in a minute." The server keeps going, so the next try starts once it's done. ### How base and desktop update Their images come from [pyo-sandbox-images](https://github.com/upsetdev/pyo-sandbox-images), `ghcr.io/upsetdev/pyo-sandbox-images/base` and `ghcr.io/upsetdev/pyo-sandbox-images/desktop`. They're rebuilt every week with Ubuntu's security updates. Each build is signed, and so is the list of its images, `images.json`, which names each image by digest. Pyo reads the latest `images.json` from GitHub every hour and uses it only when its signature checks out. Each Pyo release also carries the one of when it was made, so a Pyo that can't reach GitHub still has images. `PYO_UPDATE_CHECK=off` stops the hourly check too. When a newer build comes out: - Each sandbox server that has the template makes the new one in the background. Servers that never used it wait for their first sandbox from it. - New sandboxes start from it once it's ready on their server. Until then they start from the one before. - Running and paused sandboxes keep the one they started from. The server deletes it once no sandbox uses it. A template never moves back to an older build. ### Your own templates Make a template from any image: ```bash pyo sandbox templates create node-22 node:22 ``` The image can be public on any registry, or in [Pyo's registry](https://pyo.dev/docs/registries#push-your-own-images). A server without Tailscale can't pull from Pyo's registry, which is on Pyo's tailnet. Every sandbox server that may use the template pulls the image and unpacks it. A Firecracker server then boots it once and saves a snapshot to start sandboxes from. A gVisor server starts each sandbox from the unpacked disk. A template is ready once one server has it. Each template shows its state on each server: pending, building (pulling, unpacking or snapshotting), ready or failed, with its size once ready. To add your own tools to `base`, build on its image and push the result to Pyo's registry: ```dockerfile FROM ghcr.io/upsetdev/pyo-sandbox-images/base:24.04 RUN apt-get update && apt-get install -y --no-install-recommends postgresql-client \ && rm -rf /var/lib/apt/lists/* RUN uv pip install --system pandas ``` Pyo doesn't use an image's `USER`, `ENV` or `WORKDIR` yet. Commands run as root in `/root`, with `PATH` set to the usual system folders, so put tools in `/usr/local/bin` or `/usr/bin`. An image may take up to 10 GiB, and the server needs the disk space to unpack it. A server builds one template at a time. Templates belong to your team, or to the installation, which every team can use. Deleting a template removes it from the servers that made it. ## Networking A sandbox has the internet by default. Choose **No network** (`network: "none"`) for a sandbox with no network at all. Opened ports still work then, since the edge reaches them through the sandbox server, not the network. A sandbox with network can't reach: - the sandbox server itself, on any of its addresses - your tailnet - other sandboxes - private and link-local ranges, like `10.0.0.0/8`, `192.168.0.0/16` and `169.254.169.254` - anything over IPv6 DNS goes to `1.1.1.1` and `8.8.8.8`. Nothing from outside can open a connection into a sandbox. Only replies come back. Sandboxes get addresses from `198.18.0.0/16`, a range nothing routes. If that overlaps the server's own networks, the daemon won't turn networking on. To change the range or the DNS servers, or to block more ranges, edit `/etc/pyo-sandbox/local.json` on the server and restart `pyo-sandbox`. ### Docker and ufw on the server Docker and ufw set the server's forwarding policy to drop. When it is, the daemon adds two rules of its own, to `DOCKER-USER` when Docker made it, or else to `FORWARD`, so sandbox traffic gets out and its replies come back. It never changes the policy itself. With ufw active, the setup command also opens the daemon's port on `tailscale0`, and ports 80 and 443 for the edge. Without Tailscale it opens only 80 and 443. Any other firewall in front of the server needs 80 and 443 open too. ## Limits Each sandbox can have: | | Default | Range | | --- | --- | --- | | CPUs | 1 | 1 to 32 | | Memory | 512 MiB | 128 MiB to 64 GiB | | Disk | 2 GiB | 64 MiB to 256 GiB | | Lifetime | 5 minutes | up to 365 days, or no limit | A sandbox ends when its lifetime runs out. Extend it while it runs. A sandbox with no limit (`ttl: "none"`) runs until you delete it. Each team also has limits on all its sandboxes together. Paused ones count. | Limit | Default | | --- | --- | | Sandboxes at once | 10 | | CPUs | 16 | | Memory | 16 GiB | | Disk | 100 GiB | | Longest lifetime | 1 day | The team's owners and admins change them in the team's **Settings**, under **Sandboxes**, when every sandbox server the team uses is its own. When the installation has sandbox servers that every team shares, only the installation's admin changes them. On Pyo Cloud each team has only its own servers, so its owners and admins always can. Setting **Sandboxes at once** to 0 turns sandboxes off for the team. **Longest lifetime** can be up to 365 days, or **No limit**, which lets the team's sandboxes run until they're deleted. ## Names Every sandbox has a name, to tell it apart from the others and find it. Give one when you create it, like `checkout tests`, of up to 63 letters, digits, spaces, dashes, underscores and dots. Without one, Pyo makes up a short one like `quiet-river`. Names don't have to be unique, and they never address a sandbox: its id does. So renaming one breaks nothing. Rename a sandbox from its name on its page, with `pyo sandbox rename`, with `rename_sandbox` in [MCP](#mcp), or with a `PATCH` in the [API](https://pyo.dev/docs/api). The sandboxes list searches by name or id. ## Use sandboxes An [API key](https://pyo.dev/docs/api#what-a-key-can-do) needs **Sandboxes** or **Full** access to use sandboxes. **Sandboxes** access can read, and create and use sandboxes, but change nothing else. ### TypeScript SDK Install `@pyodev/sandbox`: ```bash npm install @pyodev/sandbox ``` It reads `PYO_URL`, `PYO_API_KEY` and `PYO_TEAM` from the environment, or takes them as options. It works in Node 20 and later, and in Bun. ```ts import { Sandbox } from "@pyodev/sandbox"; // From base. Pass template to start from another one, and server to pick the server. const sbx = await Sandbox.create({ ttl: "1h" }); // Commands const r = await sbx.exec("node -v"); console.log(r.stdout, r.exitCode); // Files await sbx.files.write("/app/index.js", "console.log('hi')"); const text = await sbx.files.read("/app/index.js"); // A terminal const pty = await sbx.pty({ cols: 120, rows: 30, onData: (b) => process.stdout.write(b) }); pty.write("ls\r"); // Ports await sbx.spawn("npx serve -l 3000"); const url = await sbx.ports.open(3000); await sbx.delete(); ``` - **Commands:** `exec` waits for a command and returns its output and exit code. A command times out after 60 seconds unless you set `timeoutMs`, and keeps up to 8 MiB of each output. `spawn` starts one and returns at once, for servers and interactive input. - **Files:** read, write, list, stat and remove files. Each call moves up to 64 MiB. - **Terminals:** `pty` opens a terminal, with resize. - **Ports:** `ports.open` returns the port's URL on the [edge](#edge-domain). A private port, with `{ public: false }`, needs the sandbox token on each request. `ports.connect` opens a TCP connection to a port inside the sandbox, even with no network. - **Lifetime:** `extend`, `pause`, `resume` and `delete`. A paused sandbox keeps its memory and files and resumes where it was. - **Servers:** `Sandbox.servers()` lists the team's sandbox servers, each with its `runtime`, `firecracker` or `gvisor`. The token for the sandbox server lasts an hour. The SDK gets a new one from Pyo five minutes before it runs out. To use a sandbox from a browser without an API key, your backend passes on `sbx.connection()` and refreshes the token for it. The SDK builds every call from the connection's `url`, so the same code works on both kinds of server. The [API](https://pyo.dev/docs/api/reference/sandboxes/create-sandbox) gives the same `connection`: | Field | With Tailscale | Without Tailscale | | --- | --- | --- | | `url` | The server's address on your tailnet, like `https://sbx-1.tail1234.ts.net:7443` | An address on Pyo itself, under the address you reached Pyo at | | `webUrl` | The same as `url`, for the desktop and web pages | Left out | | `proxied` | Left out | `true`: the calls are proxied by Pyo | Lists of sandboxes have `url` and `proxied` too. A server without Tailscale has no `tailnetName` in the list of servers. Through Pyo, the [limits](#limits-through-pyo) above apply, and a browser page on another origin can't make the calls. The SDK also has ready-made tools for the Claude API and the Vercel AI SDK. See its [README](https://github.com/upsetdev/pyo-sandbox-js) for every option. ### MCP Once your team can use a sandbox server, [MCP](https://pyo.dev/docs/mcp) gets sandbox tools, so an assistant can run code for you in a sandbox. Give the assistant **Sandboxes** or **Full** access. | Tool | What it does | | --- | --- | | `create_sandbox` | Creates a sandbox, from `base` unless the assistant names a template, on the server it names or one Pyo picks, and returns its id | | `rename_sandbox` | Gives a sandbox another name | | `run_code` | Runs Python, Node or Bash code and returns its output | | `exec` | Runs a shell command | | `read_file` and `write_file` | Read and write a file | | `open_port` and `close_port` | Serve a port at a URL, or stop serving it | | `pause_sandbox` | Pauses a sandbox | | `delete_sandbox` | Ends a sandbox and throws away its files | These go through Pyo, so the assistant doesn't need your tailnet. See the [full tool list](https://pyo.dev/docs/mcp/tools). ### CLI The [`pyo` CLI](https://pyo.dev/docs/cli) has `pyo sandbox`: ```bash pyo sandbox create --name checkout-tests --ttl 30m pyo sandbox exec sbx_abc123 "node -v" pyo sandbox shell sbx_abc123 pyo sandbox cp ./app.js sbx_abc123:/app/app.js pyo sandbox ports open sbx_abc123 3000 pyo sandbox rm sbx_abc123 ``` `pyo sandbox create` starts from `base`. Name a template to start from another one, like `pyo sandbox create node-22`, and pick the server with `--server sandbox-1`. `--ttl` takes a lifetime like `30m`, `6h` or `7d`, or `none` to keep it until you delete it. It also has `ls`, `get`, `rename`, `pause`, `resume`, `extend` and `token`, and `servers` and `templates` to manage those. `exec`, `shell` and `cp` call the sandbox server at its connection's address. With Tailscale that's on your tailnet, so they need your tailnet. Without it they go through Pyo. See the [command reference](https://pyo.dev/docs/cli/commands#pyo-sandbox). ### Dashboard The **Sandboxes** page lists your sandboxes by name, with a search. A running sandbox has **Terminal** right in the list, and a desktop sandbox has **Desktop** and **Browser** too. The **New sandbox** button in the page's header opens a menu with **New sandbox** and **Add server**. **New sandbox** creates one, and shows the same choices as SDK code, ready to copy. Its **Server** field is **Any server** by default, and lists each server with its runtime and free memory. Its **Lifetime** goes from 5 minutes up to the team's longest, or **No limit** when the team allows it. **Sandbox templates** has a **Use** button on each template that opens **New sandbox** on it. A sandbox's page has its **Overview** with its ports, a **Terminal**, its **Files**, the **Commands** it ran and its **Metrics**. ## Planned These aren't in Pyo yet: - Templates from a Git repository or a Dockerfile. - Pausing a sandbox on its own when it's idle. - Allow and deny lists for a sandbox's outgoing traffic. - A Python SDK. - Promote a sandbox to a service, with a domain, HTTPS and autoscaling. --- # Scaling a service Run more replicas, set resources and choose where services run. ## Replicas Set how many replicas of a service run, from the dashboard or through [MCP](https://pyo.dev/docs/mcp). Scaling takes effect without a redeploy. From a terminal, run [`pyo scale 3`](https://pyo.dev/docs/cli/commands#pyo-scale). It also sets `deploy.replicas` in a linked [`pyo.jsonc`](https://pyo.dev/docs/cli/pyo-jsonc) that has it, so the next deploy keeps the new count. There's no fixed maximum: run as many replicas as your servers have room for. If you ask for more than fits, Pyo still accepts it and tells you how much CPU and memory they need against what's free. The replicas that don't fit show as **Waiting for room** and start once there's space, for example after you add a server. A very large change asks you to confirm first: one to 20 or more replicas that's over 10 times what the service had, or over twice what your servers have room for. ## Autoscaling Pyo can choose the number of replicas for you, between a minimum and a maximum, based on CPU use and, optionally, memory use. Open a service, choose **Scale**, turn on **Autoscale** and set: - **Minimum:** the fewest replicas it runs, even when idle. - **Maximum:** the most it can run. Pyo tells you if your servers don't have room for that many. - **CPU target:** the average use to aim for, as a percentage of each replica's CPU request. - **Memory target:** optional. Turn on **Also scale on memory** to aim for a memory use too, as a percentage of each replica's memory request. When both are on, whichever needs more replicas wins. With a target of 70% and a request of 100m, Pyo adds replicas once they average more than 70m each. It removes them a few minutes after use drops, so a short dip doesn't cut capacity. Deploys keep the current number of replicas, so a deploy during a busy period won't shrink your service. If you turn autoscaling off, the service stays at the size it had reached. Autoscaling has some limits: - It follows CPU, and memory if you turn it on, but not requests per second. - Many programs don't give memory back once they've used it. With a memory target, such a service may scale up and not come back down, so set it with care. - Set realistic [requests](#resources), because use is measured against them. If the request is much lower than what the service needs, it scales up early. - It can only add replicas as far as your servers have room. If they're full, new replicas wait until there's space. Pyo doesn't add servers. - Services with a volume run as one replica, so they can't autoscale. - It needs metrics-server, which comes with k3s. Keep it enabled. ## Deploys without downtime Pyo starts a new replica and waits for it to be ready before stopping an old one, so deploys don't drop traffic. A stopping replica keeps serving briefly while traffic moves away from it. Services with a single-writer volume are the exception: they restart on deploy, to protect their data. ## Resources Each service has its own CPU and memory requests and limits. The request is what Pyo reserves for it, and the limit is the most it can use. ## Choosing where services run By default, a service can run anywhere in its cluster. Pick its servers under **Servers** on its **Resources** tab, or with [`pyo place`](https://pyo.dev/docs/cli/commands#pyo-place). You can narrow it down by: - **Region:** servers in one [region](https://pyo.dev/docs/regions). - **Tags:** every server with one of the picked tags, like `gpu`, including servers tagged later. - **Server:** specific servers by name. A new pick applies right away, with no redeploy. Pyo refuses one that no server can run, like a server without the service's volume or a GPU it needs. A service pinned to one server can't move if that server goes down. Replicas also spread across regions on their own. See [Serving traffic by region](https://pyo.dev/docs/regions). ## Self-healing Crashed containers restart on their own. With more than one server, stateless services move to a healthy server if one goes down. --- # Securing Pyo What to do right after installing, before you put anything real on it. Pyo is safe to try on a private network as it is. If your server is on the internet, do these first, in this order. ## 1. Take the dashboard off the public internet A single server starts with its dashboard at `https://pyo..nip.io`, so you can reach it without Tailscale. Plain HTTP on port 8000 only answers the machine itself, private networks and your tailnet, never a public address. Once you set up [Tailscale](https://pyo.dev/docs/tailscale), Pyo is at `https://pyo..ts.net` too. Then close the public dashboard on the **Tailscale** card under **Integrations**. See [Closing the public dashboard](https://pyo.dev/docs/tailscale#closing-the-public-dashboard). ## 2. Close the ports you don't need Only ports 80 and 443 need to be open to the world, for your services. | Port | What it is | Who should reach it | | --- | --- | --- | | 80, 443 | Your services, and Pyo's dashboard at `pyo..nip.io` until you close it | Everyone | | 8000 | Pyo's dashboard and API, over plain HTTP. It answers only the machine itself, private networks and your tailnet. | You and your agents | | 5005 | Pyo's registry for this machine, over plain HTTP. It only listens on the machine itself. | Nobody else | | 5006 | Pyo's registry for your other servers and builders. It answers only your tailnet, and every request needs a login. | Your servers, on your tailnet | | 6443 | The Kubernetes API | Only your servers | | 22 | SSH | Only you | > Use your provider's firewall, in front of the server. Firewalls on the machine itself, like `ufw`, may not cover these ports, because k3s forwards the traffic before those rules apply. Then check from a different network. These should time out: ```bash curl -m 5 http://your-public-ip:8000 curl -m 5 http://your-public-ip:5006 ``` The provider's firewall guards the server itself. To choose who can reach your services, by address, range or country, use Pyo's [firewall](https://pyo.dev/docs/firewall). To inspect website requests for attacks, add the [web application firewall](https://pyo.dev/docs/waf). ## 3. Put a CDN in front of your services A CDN hides your server's address and absorbs attacks before they reach it. It only protects you if nobody can go around it, so lock the server down in the same step. This matters most for public services. If yours are private, skip it. The examples use Cloudflare, but any CDN with published IP ranges and client certificates works the same way. ### Point your domains at the CDN 1. Add your domains to the CDN with proxying on, and set its connection to your server to verify certificates. In Cloudflare, that's **Full (strict)**. 2. Create an origin certificate with your CDN and upload it under [Certificates](https://pyo.dev/docs/certificates). 3. Set each domain's HTTPS to that certificate. Let's Encrypt can also work, as long as its validation requests reach port 80 through the CDN. An origin certificate is simpler, because it doesn't depend on that. ### Allow only the CDN through your firewall In your provider's firewall, block all inbound traffic to ports 80 and 443, then allow only your CDN's IP ranges. Cloudflare publishes its [IPv4](https://www.cloudflare.com/ips-v4) and [IPv6](https://www.cloudflare.com/ips-v6) ranges. These lists change, so check them from time to time. | Port | Allow from | | --- | --- | | 80, 443 | Your CDN's IP ranges only | | 8000, 5006 | Your tailnet only | | 6443 | Your servers only | | 22 | You only | Then check from a different network, using your server's own address. This should time out: ```bash curl -m 5 -k https://your-server-ip ``` ### Require the CDN's certificate with mTLS CDN IP ranges are shared, so anyone with an account on the same CDN can still reach your server through them. mTLS closes that gap. Your server then only accepts HTTPS connections from a client that holds the certificate your CDN presents. Pyo creates the certificate and turns this on for you. Move all your domains behind the CDN first, then open your cluster's **Settings** and turn on **mTLS**: 1. Choose a certificate, or create one. 2. Save the certificate and private key in a password manager. You only see them once, and Pyo doesn't keep them. 3. Upload both to your CDN and turn the feature on there. In Cloudflare, it's called [Authenticated Origin Pulls](https://developers.cloudflare.com/ssl/origin-configuration/authenticated-origin-pull/). 4. Check the list of domains it affects, confirm your CDN is presenting the certificate, and turn on mTLS. The switch comes on once the cluster has applied it. Do this for each cluster. Requests through your CDN keep working. A direct HTTPS connection now fails during the handshake. > This applies to every HTTPS domain on the cluster. Anything not behind your CDN stops working, including [free domains](https://pyo.dev/docs/domains#free-domains). If something goes wrong, turn **mTLS** off in the cluster's **Settings**. mTLS doesn't cover plain HTTP on port 80, so keep the firewall rule as well. Pyo warns you 30 days before the certificate expires. Replace it before then, because your CDN can't reach your services once it expires. See [Mutual TLS](https://pyo.dev/docs/certificates#mutual-tls-mtls) for how. ### What changes behind a CDN - [Observability](https://pyo.dev/docs/observability) records the CDN's address instead of the visitor's, so visitor locations and IP-based counts won't be accurate. Use your CDN's own analytics for real visitor data. - The [firewall](https://pyo.dev/docs/firewall) and its rate limits see the CDN's addresses too. Pyo doesn't read `X-Forwarded-For`, so put rules for visitors in your CDN. - Services see the CDN as their client. To get the visitor's address, read the header your CDN sets, like `CF-Connecting-IP`. Pyo Gateway passes it on only while mTLS is on, or to a service [behind Cloudflare](https://pyo.dev/docs/firewall#behind-cloudflare). See [Client IP headers](#client-ip-headers). - Pyo's own sign-in limits and audit log see the CDN's address too, until you list the CDN's ranges in `PYO_TRUSTED_PROXIES`. See [Client IP headers](#client-ip-headers). - The CDN decrypts your traffic to do its job, so choose one you trust with it. ### Client IP headers Headers like `CF-Connecting-IP` name the visitor, but any client can send them. So Pyo Gateway removes these from every request: `CF-Connecting-IP`, `CF-Connecting-IPv6`, `True-Client-IP`, `Fastly-Client-IP`, `X-Real-IP`, `X-Client-IP` and `Forwarded`. They only get through where your CDN is the only one who can connect: | Where | What gets through | | --- | --- | | HTTPS with [mTLS](#require-the-cdns-certificate-with-mtls) on | `CF-Connecting-IP`, `CF-Connecting-IPv6`, `True-Client-IP` and `Fastly-Client-IP` | | HTTPS of a service [behind Cloudflare](https://pyo.dev/docs/firewall#behind-cloudflare) | `CF-Connecting-IP` and `CF-Connecting-IPv6` | | Everything else, plain HTTP included | None of them | `X-Forwarded-For` always stays. The gateway adds the address it saw at the end, so the last entry is the one to trust. A cluster that doesn't refresh its install on its own, like one on Pyo Cloud, starts removing these headers once you run the command under **Refresh this cluster** in its settings. Until then, the cluster shows **Update needed**. Pyo itself never takes the visitor from `CF-Connecting-IP` on a request that came through the gateway. It reads `X-Forwarded-For` from right to left and skips the addresses in `PYO_TRUSTED_PROXIES`. By default that's the cluster's pod network, where the gateway runs. The first address not in the list is the visitor. Sign-in limits, rate limits and the [audit log](https://pyo.dev/docs/audit-log) all use it. With the dashboard behind a CDN and mTLS, that first address is the CDN's. To see the real visitor, add your CDN's IP ranges after the default. This example shows two of Cloudflare's, so list them all: ```bash sudo k3s kubectl -n pyo-system set env deployment/pyo \ PYO_TRUSTED_PROXIES=10.42.0.0/16,2001:cafe:42::/56,173.245.48.0/20,2400:cb00::/32 ``` Cloudflare lists its ranges at [cloudflare.com/ips](https://www.cloudflare.com/ips/). Keep mTLS on, because anyone with an account on the same CDN can send requests from its ranges. If cloudflared on the server itself sends requests straight to Pyo on port 8000, add `127.0.0.1/32`. Pyo then takes the visitor from its `CF-Connecting-IP`. ## 4. Save your master key Your secrets and your backups can only be opened with Pyo's master key. If you lose this server and the key with it, they're gone. Copy it somewhere safe, like a password manager: ```bash sudo k3s kubectl -n pyo-system get secret pyo-secrets \ -o jsonpath='{.data.secret-key}' | base64 -d ``` Keep it away from your backups: anyone with both can read them. ## 5. Turn on backups Set up [backups](https://pyo.dev/docs/backups) for your databases and volumes, and for Pyo's own data, in a bucket off this server. A backup on the same machine won't survive losing it. ## 6. Give people only what they need - Invite teammates with the lowest [role](https://pyo.dev/docs/teams) that works for them. - Require [two-factor authentication](https://pyo.dev/docs/two-factor) for your team, or for everyone on your Pyo. - Limit where installation admins can sign in from, with [admin sign-in](https://pyo.dev/docs/admin-sign-in). - Use read or deploy [API keys](https://pyo.dev/docs/api) rather than full ones, and limit them to the teams they need. Let them expire, and revoke the ones you no longer use. - Disconnect [AI assistants](https://pyo.dev/docs/mcp) you no longer use. ## 7. Harden the server itself Pyo can only be as safe as the machine it runs on. Follow [Hardening your server](https://pyo.dev/docs/hardening-your-server) to lock down SSH, keep the system patched and limit who has root. ## 8. Keep what's on by default These protect you out of the box, so leave them on unless you have a reason: - [Closed sign-ups](https://pyo.dev/docs/installation-settings#sign-ups), so only people you invite can join - [Network isolation](https://pyo.dev/docs/network-isolation) between projects - Visitor IP addresses not being kept, in [installation settings](https://pyo.dev/docs/installation-settings) - [Encrypted secrets](https://pyo.dev/docs/encryption): mark passwords and tokens as secret, so they aren't stored as variables - Limits on sign-in attempts. After 10 wrong passwords for one email, or 30 failed sign-ins from one IP address, within 15 minutes, Pyo answers "Too many attempts" until the 15 minutes are up. Signing in resets the email's count. Other attempts are limited too: 30 failed passkey sign-ins per IP address, 10 wrong passwords per account when adding a passkey, and 20 sign-ups per IP address an hour. - For these limits, the IP address is the connection's own, or the one Pyo Gateway reports for it. A forwarded address from anywhere else, your tailnet included, is ignored. If you put another proxy in front of Pyo, list its addresses in `PYO_TRUSTED_PROXIES` as comma-separated ranges. This replaces the default, `10.42.0.0/16,2001:cafe:42::/56`, so keep those in the list. See [Client IP headers](#client-ip-headers). - Sessions: you're signed out after 7 days without using Pyo, and 30 days after signing in. - Invite links: people join a team with the link from their invite, not by signing up with the invited address. See [Inviting your team](https://pyo.dev/docs/teams#invite-people). ## What to keep in mind - The part of [Pyo Gateway](https://pyo.dev/docs/gateway) that handles public traffic holds no cluster credentials, so it can't read your secrets. - On the cluster Pyo runs on, Pyo's own database, ClickHouse and registry only answer Pyo itself, not your services. The [backup store](https://pyo.dev/docs/backups#where-backups-go) answers only signed requests, each team's key reaches only that team's bucket, and only Pyo can make buckets and keys. - Pyo knows which cluster it runs on by a key only that server has. Another cluster can't pose as it to get a backup store key or Pyo's updates. - Everything the agent runs must meet Kubernetes' baseline Pod Security: no added Linux capabilities, no host ports, and no unconfined seccomp or AppArmor. Only Pyo's own builder, log collector and GPU components get the host access they need. - The Pyo agent only changes what Pyo manages, but anyone with admin access to a server, or to Pyo, still controls what runs there. - When Pyo is updated, each agent updates its own limits to match, so new versions of databases and the firewall can install. This is on by default. It means someone who takes over Pyo could also loosen those limits on your connected clusters. To update them yourself instead, set `PYO_AGENT_SELF_UPDATE=false` before connecting clusters, or on a connected cluster run `sudo k3s kubectl delete clusterrolebinding pyo-agent-self-update` on its server. After an update of Pyo, that cluster's page shows **Update needed** and the command to run on its server. - Pyo connects to registries, backup buckets and secret stores from its own network. So it never lets them point at its own server, its cluster's network or cloud metadata addresses. Private networks, like your LAN or tailnet, are allowed. When people you don't fully trust run teams, set `PYO_ALLOW_PRIVATE_NETWORKS=false`, as Pyo Cloud does. See [system reference](https://pyo.dev/docs/system-reference#installation-settings). - What Pyo's install scripts and [`pyo-server`](https://pyo.dev/docs/pyo-server) download as root is checked first: k3s against checksums fixed in each release, and Tailscale and the NVIDIA Container Toolkit by their repositories' signing keys. See [k3s](https://pyo.dev/docs/system-reference#k3s). - Each release's `release.json`, which says what an install or [update](https://pyo.dev/docs/updating-pyo) applies, is signed by Pyo's release workflow. The installer and the dashboard check that signature before using it. `pyo-server` checks it too, for exactly its own release, then checks what it installs against the SHA-256 listed there, like the [sandbox server's files](https://pyo.dev/docs/sandbox#how-the-files-are-checked). - The commands Pyo shows for setting up a server run `server.sh`, which checks `pyo-server` before it runs it. The copy a release publishes on pyo.dev carries the SHA-256 of that release's `pyo-server`. Any other copy checks the signed `release.json` of exactly that release with cosign. See [How pyo-server is checked](https://pyo.dev/docs/pyo-server#how-pyo-server-is-checked). Whoever serves `server.sh` runs code as root on the server, as with any install script. Pyo's commands fetch it from pyo.dev or from your Pyo. - The token in a setup command holds that setup's secrets: a one-time code or join token, a single-use Tailscale key and the cluster's registry login. A pasted command stays in your shell's history. The token's secrets expire within an hour, but the registry login doesn't. To keep the token out of the history, put `-` in its place and paste it at the prompt. See [Keep it off the command line](https://pyo.dev/docs/pyo-server#keep-it-off-the-command-line). - Turn on [two-factor authentication](https://pyo.dev/docs/two-factor), or sign in with a [passkey](https://pyo.dev/docs/passkeys). Use a long, unique password either way. - Agents get their token and their commands, secrets included, from Pyo's address. A public address must be `https://`. Plain `http://` only works on a private network or your tailnet. - Developers can't turn a secret into a variable without entering its value again. An admin can, and it shows in [Activity](https://pyo.dev/docs/activity) and the [audit log](https://pyo.dev/docs/audit-log), the same way revealing a secret does. - If Pyo is reached at its own domain, set `PYO_PUBLIC_URL` to that address, like `https://pyo.example.com`. Pyo uses it as the sign-in address it gives [AI assistants](https://pyo.dev/docs/mcp) and the CLI, and never takes it from request headers. - A template runs someone else's software on your server. Only use ones you trust. --- # Adding a server Add machines to a cluster and look after them. ## Add a server Open a cluster and add a server. Pyo gives you a command to run on the new machine, which joins it to the cluster over [Tailscale](https://pyo.dev/docs/tailscale). Adding a server needs Tailscale set up in Pyo. The server gets the same [memory reserve for k3s](https://pyo.dev/docs/system-reference#k3s) as the cluster's first server. ```bash curl -fsSL https://pyo.dev/v/0.53.0/server.sh | bash -s -- join pyoj1_eyJzZXJ2ZXIi... ``` It runs [`pyo-server`](https://pyo.dev/docs/pyo-server) with a token that carries the cluster's address, its join token, its k3s version, the server's name, a single-use Tailscale key and the cluster's login to Pyo's registry. The command works for an hour. `pyo-server token show` prints the token with the secrets hidden. If the cluster's first server isn't on the tailnet yet, Pyo shows a second command to run there first, with `tailnet` and a token. It puts the server on your tailnet and moves k3s onto it, with one restart. If k3s doesn't come back, it puts k3s back as it was and exits with code 3. Or let Pyo make the server for you at [Hetzner](https://pyo.dev/docs/hetzner). ### Servers joined before 0.52.1 From 0.52.1, a server pulls Pyo's images from Docker Hub when ghcr.io is down (see [Where images come from](https://pyo.dev/docs/install#where-images-come-from)). The join command sets that up on new servers. **Refresh this cluster** sets it up on the cluster's first server only. A server that joined before 0.52.1 still pulls from ghcr.io only. To give it the fallback, run `pyo-server join` without a token on each such server. A server that has no `pyo-server` yet gets it with the same line: ```bash curl -fsSL https://pyo.dev/v/0.53.0/server.sh | bash -s -- join ``` It adds Pyo's `ghcr.io` entry to `/etc/rancher/k3s/registries.yaml`, the same entry the join command writes, unless the file has a `ghcr.io` entry already. It also brings Pyo's [memory settings for k3s](https://pyo.dev/docs/system-reference#k3s) and AppArmor profile up to date. When something changed, k3s-agent restarts once. Containers keep running. It ends with `This server is up to date. Its containers kept running.` The rewrite keeps every other ghcr.io image off Docker Hub. Only `upsetdev/pyo` and `upsetdev/pyo-*` can come from there. Removing the server and adding it again also works, but its workloads move. ## Tags Add tags to servers, like `gpu`. You can then [place](https://pyo.dev/docs/scaling#choosing-where-services-run) services by tag, region or server name. ## Regions Pyo detects each server's region from its address. To group servers your own way, rename it with **Change region** in the server's menu. Replicas spread across regions, and each region's traffic is answered there by default. See [Serving traffic by region](https://pyo.dev/docs/regions). Every server answers requests for your sites through [Pyo Gateway](https://pyo.dev/docs/gateway), except build-only servers. Whether the cluster takes public traffic at all is a [cluster setting](https://pyo.dev/docs/clusters#public-traffic). ## Maintenance From a server's page you can: - **Pause scheduling**, so no new replicas land on it. - **Mark it for maintenance.** - **Drain it**, moving its services to other servers. - **Remove it** from the cluster. Then uninstall k3s on the machine, as in [Remove a server](https://pyo.dev/docs/uninstall#remove-a-server). ## Low disk space A server that runs low on disk space stops some of what runs on it to free space. Pyo keeps the parts that serve and report running through it: - [Pyo Gateway](https://pyo.dev/docs/gateway), so your sites keep answering - the [WAF](https://pyo.dev/docs/waf) and [websites on your tailnet](https://pyo.dev/docs/tailscale#websites-on-your-tailnet) - the agent and the log collector, so the server keeps reporting to Pyo Your services aren't protected this way. Below 5% free disk, the server may stop some of their replicas. With other servers in the cluster, Pyo starts them there. Pyo tells you in **Activity**, like "web-1 is low on disk space", and again when the server has enough. It can also send an [alert](https://pyo.dev/docs/alerts). The server's page shows its **Disk** condition. What Pyo cleans up by itself: - Images no service uses. Cleanup starts when the disk is 85% full and goes on until it's down to 75%. - The stopped replicas left behind when a server was short of disk. What you should do: 1. Find what fills the disk. It's often something outside Pyo, like old logs, downloads or another program's data. 2. Free that space, or give the server a bigger disk. 3. If a service's own data fills it, move that data to a [volume](https://pyo.dev/docs/volumes). The server counts as low on disk until it has 1 GiB more than the 5% free. Then it runs services again. A server gets these settings from its setup command. To apply them on a cluster's first server that was set up earlier, run the command under [Refresh this cluster](https://pyo.dev/docs/clusters#refresh-a-cluster). This works the same on Pyo Cloud, since it all happens on your own servers. Everyone in the team sees the activity. Team owners and admins set up alerts. --- # System reference The PYO_ environment variables, and everything Pyo runs on your server. Most of Pyo is configured from the dashboard. This page covers what sits underneath it, for when you run or troubleshoot the installation yourself. ## Change a setting Pyo reads its environment variables when it starts. Set one on the deployment, and Kubernetes restarts Pyo with the new value: ```bash sudo k3s kubectl -n pyo-system set env deployment/pyo PYO_ALLOW_SIGNUP=true ``` To see what's set now: ```bash sudo k3s kubectl -n pyo-system set env deployment/pyo --list ``` Pyo has two deployments, and some settings belong on both. `pyo` serves the dashboard and API, and `pyo-worker` runs deploys, backups and other background work. > Updating Pyo puts back the values it sets in its own manifest, like `PYO_REGISTRY_PULL`. Variables you've added, like `PYO_ALLOW_SIGNUP` and `PYO_COOKIE_SECURE`, are kept. ## Installation settings These are the ones you're most likely to change. | Variable | Default | What it does | | --- | --- | --- | | `PYO_ALLOW_SIGNUP` | `false` | Lets anyone who can reach the dashboard create an account. See [sign-ups](https://pyo.dev/docs/installation-settings#sign-ups). | | `PYO_COOKIE_SECURE` | `false` | Sends the session cookie over HTTPS only. Turn it on when the dashboard is behind HTTPS. | | `PYO_PASSKEY_ORIGINS` | Not set | More HTTPS addresses of the dashboard where [passkeys](https://pyo.dev/docs/passkeys#where-passkeys-work) work, comma-separated, like `https://pyo.example.com`. | | `PYO_ADMIN_PASSWORD` | Generated | The first admin's password. It's only read when an installation has no accounts yet, and it has to be replaced on first sign-in. | | `PYO_TRUSTED_PROXIES` | `10.42.0.0/16,2001:cafe:42::/56` | The proxies whose `X-Forwarded-For` Pyo believes, as comma-separated ranges. The default is the cluster's pod network, where Pyo Gateway runs. Behind a CDN, add its ranges after the default. See [Client IP headers](https://pyo.dev/docs/securing-pyo#client-ip-headers). | | `PYO_ADMIN_SIGNIN_ANYWHERE` | Not set | Set `1` to ignore the [admin sign-in](https://pyo.dev/docs/admin-sign-in) rule while it's set, so admins can sign in from anywhere. For an admin who's locked out. | | `PYO_ALLOW_PRIVATE_NETWORKS` | `true` | Lets teams use addresses on private networks, like your LAN or tailnet, for [registry logins](https://pyo.dev/docs/registries), [backup buckets](https://pyo.dev/docs/backups), [secret stores](https://pyo.dev/docs/external-secrets) and [GitLab](https://pyo.dev/docs/gitlab). Pyo's own server and cluster network are never allowed. Set `false` when people you don't fully trust run teams, as Pyo Cloud does. | | `MAXMIND_LICENSE_KEY` | Not set | Your GeoLite2 license key, to keep visitor location data up to date. Without one, Pyo uses the copy it ships with. | ## Connections Pyo sets these when it's installed, so you'll rarely need to touch them. | Variable | Default | What it does | | --- | --- | --- | | `DATABASE_URL` | Required | The PostgreSQL database that holds Pyo's data. | | `PYO_DB_POOL` | By memory | The most database connections each process opens. By default it follows Pyo's database, which is sized by the server's memory. See [Memory tiers](#memory-tiers). | | `CLICKHOUSE_URL` | Not set | The ClickHouse server for [observability](https://pyo.dev/docs/observability). Without it, observability is off. | | `CLICKHOUSE_USER` | `default` | The ClickHouse user. | | `CLICKHOUSE_PASSWORD` | Empty | The ClickHouse password. | | `PYO_AGENT_API_URL` | `http://pyo.pyo-system.svc:8000` | The address agents connect to. | | `PYO_LOCAL_URL` | `http://127.0.0.1:8000` | How the install command for **This machine** reaches Pyo, and where it downloads its script. | | `PYO_SCRIPTS_URL` | Pyo's own address | Where the commands for connecting other servers download their scripts. When not set, they download from Pyo itself, at the address the command gives the server, like your tailnet or public URL. Without one, they use this release's scripts on pyo.dev, at `https://pyo.dev/v/`. **This machine** always downloads from Pyo on it. | | `PYO_SETUP_SCRIPTS` | Not set | Set `1` to show the setup scripts' commands (`connect.sh`, `join.sh`, `sandbox.sh`) in place of [`pyo-server`](https://pyo.dev/docs/pyo-server)'s, also on the servers Pyo makes at Hetzner. Set it on the `pyo` deployment. | | `PYO_AGENT_SELF_UPDATE` | `true` | Lets agents update their own limits when Pyo is updated, on clusters connected while it's on. Set `false` to update them yourself. The cluster's page then shows **Update needed** with the command to run on its server. See [Securing Pyo](https://pyo.dev/docs/securing-pyo#what-to-keep-in-mind). | | `PYO_REGISTRY_PULL` | `127.0.0.1:5005` | The registry address servers pull images from. | | `PYO_REGISTRY` | `pyo-registry.pyo-system.svc.cluster.local:5000` | The registry itself, which only Pyo reaches. | | `PYO_BACKUP_STORE_URL` | Not set | The backup store on this cluster. | | `PYO_BACKUP_STORE_ADMIN_URL` | Not set | The backup store's admin API, where Pyo sets it up and makes each team's bucket and key. | | `PYO_BACKUP_STORE_ADMIN_TOKEN` | Not set | The token for the backup store's admin API. | | `PYO_BACKUP_STORE_ACCESS_KEY` | Not set | Pyo's own key to the backup store. Teams never get it. | | `PYO_BACKUP_STORE_SECRET_KEY` | Not set | Pyo's own secret key to the backup store. | ## Running Pyo | Variable | Default | What it does | | --- | --- | --- | | `PYO_ROLE` | `all` | What a process does: `web`, `worker` or `all`. | | `LISTEN_ADDR` | `0.0.0.0:8000` | The address Pyo listens on. | | `PYO_WEB_DIR` | `dash/dist/client` | Where the built dashboard is. | | `PYO_AGENT_IMAGE` | `127.0.0.1:5005/pyo/agent:dev` | The agent image for new clusters. | | `PYO_BUILDER_IMAGE` | `127.0.0.1:5005/pyo/builder:dev` | The image for new builders. | | `RUST_LOG` | `pyo_api=info,tower_http=info` | How much Pyo writes to its logs. | ## Builds Set these on both `pyo` and `pyo-worker`. See [Setting up builders](https://pyo.dev/docs/builders). | Variable | Default | What it does | | --- | --- | --- | | `PYO_BUILD_TIMEOUT_MINUTES` | `60` | The longest a build may take, and wait for a builder. At least 5. | | `PYO_BUILDKIT_MEMORY_REQUEST` | `8Mi` | The memory BuildKit asks for on every builder, like `1Gi`. | | `PYO_BUILDKIT_MEMORY_LIMIT` | By memory | BuildKit's memory limit on every builder, like `4Gi`. By default it's a share of the builder's server memory, by its [tier](#memory-tiers). It's never below the request. | ## Encryption These decide how your [secrets](https://pyo.dev/docs/encryption) are protected. | Variable | Default | What it does | | --- | --- | --- | | `PYO_SECRET_KEY` | Set by the installer | The master key, as 64 hex characters. [Save a copy](https://pyo.dev/docs/securing-pyo#4-save-your-master-key). | | `PYO_SECRET_KEY_PREVIOUS` | Not set | The old master key, while you rotate it. | | `PYO_KMS` | Not set | Set to `openbao` or `vault` to protect team keys with OpenBao or Vault. | | `OPENBAO_ADDR` | Not set | Your OpenBao or Vault address. `VAULT_ADDR` works too. | | `OPENBAO_TOKEN` | Not set | Your OpenBao or Vault token. `VAULT_TOKEN` works too. | | `PYO_KMS_MOUNT` | `transit` | The Transit secrets engine's mount. | | `PYO_KMS_KEY` | `pyo` | The Transit key's name. | > Rotating the master key only moves team variables to the new key. Saved credentials, like your GitHub App, registry and SMTP passwords and certificate keys, and existing backups of Pyo itself can't be opened with a new key. Keep `PYO_SECRET_KEY` as it is, even with OpenBao or Vault, unless the key has leaked. If it has, add those credentials again afterwards and take a new backup. ## Updates Set these on both `pyo` and `pyo-worker`. | Variable | Default | What it does | | --- | --- | --- | | `PYO_UPDATE_CHECK` | On | Set to `off` to stop looking for new releases, for a server that can't reach GitHub. Nothing goes to `api.pyo.dev` or GitHub then, including [usage counts](https://pyo.dev/docs/updating-pyo#usage-counts). | | `PYO_UPDATE_SOURCE` | `https://api.pyo.dev`, then `https://api.github.com/repos/upsetdev/pyo` | A mirror of GitHub's release API to check instead. Only the mirror is asked then. | The install command reads these too, when you run it: | Variable | What it does | | --- | --- | | `PYO_VERSION` | The release to install, like `0.1.0`. Takes the place of `--version`. | | `PYO_YES` | Set to `1` to update without asking, after you've read the release's notices. Takes the place of `--yes`. | | `PYO_UPDATE_SOURCE` | The mirror to get the release from, as above. | | `PYO_TELEMETRY` | Set to `off` on a fresh install to skip the [install count](https://pyo.dev/docs/install#install-count) and start Pyo with [usage counts](https://pyo.dev/docs/updating-pyo#usage-counts) off. | See [Updating Pyo](https://pyo.dev/docs/updating-pyo). ## CLI Set these on the machine where you run `pyo`, like in [CI](https://pyo.dev/docs/cli/ci). | Variable | What it does | | --- | --- | | `PYO_URL` | Your Pyo's address. Takes the place of `--url`. | | `PYO_API_KEY` | An API key. Takes the place of `--token`. | | `PYO_INSTALL_DIR` | Where the CLI installer puts `pyo`. | | `PYO_VERSION` | The release the CLI installer installs, like `0.3.0`. | | `PYO_NO_UPDATE_CHECK` | Set to `1` to stop the daily look for a new CLI. | | `NO_COLOR` | Turns off colored output. | `pyo login` saves your sign-in to `~/.config/pyo/config.toml`. The daily look for a new CLI keeps what it found in `~/.cache/pyo/update-check.json`. On Windows, they're `%APPDATA%\pyo\config.toml` and `%LOCALAPPDATA%\pyo\update-check.json`, in your user profile. ## Inside your services Pyo doesn't add `PYO_` variables to your services. It only sets `PORT` to the service's first port, unless you've set `PORT` yourself. Everything else is what you add under [environment variables](https://pyo.dev/docs/deploy/environment). ## Set by Pyo Pyo sets these itself, so leave them as they are. | Variable | What it does | | --- | --- | | `PYO_API_URL` | The address agents and builders connect to. | | `PYO_AGENT_TOKEN` | How an agent signs in to Pyo. | | `PYO_BUILDER_TOKEN` | How a builder signs in to Pyo. | | `PYO_GEOIP_DB` | Where the visitor location data is kept. | ## What runs on your server Pyo keeps its own parts in the `pyo-system` namespace: ```bash sudo k3s kubectl -n pyo-system get pods ``` | Name | What it does | | --- | --- | | `pyo` | The dashboard and API. | | `pyo-worker` | Runs deploys, backups and other background work. | | `pyo-agent` | Carries out Pyo's instructions on each cluster. It connects out to Pyo, so nothing has to connect in to it. | | `pyo-postgres` | Pyo's own data, in the `pyo` database. | | `pyo-clickhouse` | Requests and metrics for observability, in the `pyo_observability` database. | | `pyo-vector` | Collects request logs on each server and passes them to Pyo. | | `pyo-backup-store` | S3-compatible storage on this cluster ([Garage](https://garagehq.deuxfleurs.fr), a single instance), the default destination for [backups](https://pyo.dev/docs/backups). Each team's key reaches only its own bucket. | | `registry` | Holds the images your builds produce. Only Pyo reaches it. | | `pyo-host` | Puts the registry on port 5005 of the machine itself, for its k3s and BuildKit. | | `buildkitd` | Builds Pyo's own images when Pyo is built from source. Stopped otherwise. Your images are built by builders. | | `pyo-builder-*` | Your [builders](https://pyo.dev/docs/builders). Their BuildKit runs only while there are builds. | Pyo also relies on these, outside that namespace: | Name | Where | What it does | | --- | --- | --- | | k3s | The host | The Kubernetes distribution everything runs on. | | Gateway controller (Envoy Gateway) | `pyo-gateway` | Sets up the gateway's proxies, and keeps your sites' certificates. See [Pyo Gateway](https://pyo.dev/docs/gateway). | | Gateway proxy (Envoy) | `pyo-gateway` | One on each server, except build-only servers. Takes traffic on ports 80 and 443, and public TCP and UDP ports, and routes it to your services. Published on the servers only while the cluster [accepts public traffic](https://pyo.dev/docs/clusters#public-traffic). | | `pyo-tunnel` | `pyo-system` | Two cloudflared connectors, on different servers when it can, while the cluster has a [Cloudflare Tunnel](https://pyo.dev/docs/cloudflare-tunnel). They dial out to Cloudflare and hand requests to the gateway through `pyo-tunnel-origin`. The tunnel's token is the `pyo-tunnel` Secret. | | `pyo-tunnel-origin` | `pyo-gateway` | The gateway's HTTPS inside the cluster, for the tunnel's connectors. | | `pyo-public-ports` | `pyo-gateway` | Public TCP and UDP ports on the servers while the cluster takes its websites through the tunnel. | | `pyo-tailnet` | `pyo-system` | One on each server that runs a gateway proxy, once [Tailscale](https://pyo.dev/docs/tailscale) is set up. Hosts Pyo's names on the tailnet and keeps their certificates. | | `pyo-forward` | `pyo-system` | On the machine Pyo runs on. Answers port 8000 from the machine itself, private networks and the tailnet, and the registry's port 5006 from the tailnet only. | | Gateway API | The cluster | The standard routing objects Pyo Gateway reads. k3s 1.37 and later include it. On older k3s, Pyo installs it, and k3s takes it over when you upgrade to 1.37. It stays if you remove Pyo. | | `pyo-waf` | `pyo-gateway` | The [web application firewall](https://pyo.dev/docs/waf), only while a service on the cluster has it on. | | `pyo-static` | `pyo-static` | Serves the cluster's [static sites](https://pyo.dev/docs/deploy/static-sites#served-as-static-files) as files, only while it has one. Reads their files from Pyo with a token that reaches only that cluster's sites, and keeps a copy on its server's disk. | | cert-manager | `cert-manager` | Issues HTTPS certificates. A certificate's Secret is deleted with it. | In `pyo-system`, [network policies](https://kubernetes.io/docs/concepts/services-networking/network-policies/) turn away everything Pyo doesn't need: Pyo's database, ClickHouse, the registry and the backup store's admin API only answer Pyo itself. Pyo's dashboard and API answer the gateway, Pyo's own parts and the servers, never your services' pods directly: they reach it through its public or tailnet address, like anyone else. Your services reach the backup store's S3 API with a key. ### Image names From 0.52.1, Pyo's own images have flat names, the same on ghcr.io and Docker Hub: `ghcr.io/upsetdev/pyo-agent` and `docker.io/upsetdev/pyo-agent`. Up to 0.52.0 they were `ghcr.io/upsetdev/pyo/agent`. Releases until 2027-03-01 are also published under the old names, so older installs and CLIs keep working. Tags published under the old names stay after that date. The other projects' images, like PostgreSQL and Envoy, come from Docker Hub by digest. [IMAGES.md](https://github.com/upsetdev/pyo/blob/main/IMAGES.md) lists every image with its version and what it's for. If you allow images by name, for example in an admission policy of your own, allow `ghcr.io/upsetdev/pyo` and `ghcr.io/upsetdev/pyo-*`. If the gateway fails to install, the cluster's page says so. Its installer's log has the reason: ```bash sudo k3s kubectl -n kube-system logs job/helm-install-envoy-gateway ``` Each project gets its own namespace, named when you create the project. Pyo labels what it creates with `pyo/project-id` and `pyo/service-id`. > Pyo manages everything here. Changes you make with `kubectl` can be overwritten by the next deploy or update. ## k3s On a machine without k3s, the installer installs the version that release of Pyo was tested with: **v1.37.2+k3s1** for this release. It downloads k3s from its GitHub release and checks both k3s and its installer against checksums fixed in the release. If one doesn't match, it stops before anything is installed. Servers you add to a cluster get the cluster's own k3s version, checked against that k3s release's published checksums. Tailscale, and the NVIDIA Container Toolkit for GPUs, come from their vendors' package repositories, whose signing keys are checked by fingerprint. To use another k3s version, install k3s yourself before installing Pyo. Pyo uses the k3s it finds and doesn't change its version, including when Pyo updates. On a machine with less than 3.5 GiB of memory, the k3s that Pyo installs gets a soft memory limit, so it frees memory sooner instead of growing. The limit is 40% of the memory, and at least 768 MiB. With less than 2.75 GiB and no swap, Pyo also turns on compressed swap in memory (zram, `pyo-zram.service`), half the size of the memory, for k3s itself. Your services don't swap. Both are worked out again each time the machine starts, by `/usr/local/lib/pyo-memory.sh` (k3s runs it from `/etc/systemd/system/k3s.service.d/pyo-memory.conf`, or `k3s-agent.service.d` on servers you add). Uninstalling Pyo with k3s removes them. From 3.5 GiB of memory, k3s gets neither. At any size, the same script sets aside memory for k3s and the system, so containers are only scheduled into what's left. It writes kubelet's `kube-reserved` and `system-reserved` to `/etc/rancher/k3s/config.yaml.d/50-pyo-memory.yaml` each time k3s starts. See [Memory tiers](#memory-tiers) for the amounts. Servers you [add](https://pyo.dev/docs/servers) get all this too, when they join. On a server that already runs k3s, running the connect command again on the cluster's first server, or `install.sh` on the machine Pyo runs on, sets all this up. A cluster's **Settings** tab shows the command under [Refresh this cluster](https://pyo.dev/docs/clusters#refresh-a-cluster): ```bash curl -fsSL http://127.0.0.1:8000/install/connect.sh | bash ``` That's on the machine Pyo runs on. On another cluster's first server, the command runs [`pyo-server`](https://pyo.dev/docs/pyo-server) instead: `curl -fsSL https://your-pyo/install/server.sh | bash -s -- connect`, with your Pyo's address. It reads the agent's token from the agent already there. On a server that joined a cluster, `pyo-server join` without a token does the same. When the memory reserve or limit changes, k3s restarts briefly to use it. Your services keep running while it does. The same commands keep Pyo's entries in `/etc/rancher/k3s/registries.yaml`: the registry Pyo builds into, its login, and the `ghcr.io` entry that pulls Pyo's own images from Docker Hub when ghcr.io is down (see [Where images come from](https://pyo.dev/docs/install#where-images-come-from)). Your own entries stay. A file in a layout Pyo can't read is left as it is, and the command prints what to add. When the file changes, k3s restarts once, together with any memory restart. ## pyo-server What [`pyo-server`](https://pyo.dev/docs/pyo-server) keeps on the servers it sets up: | Path | What it is | | --- | --- | | `/usr/local/bin/pyo-server` | The program. `pyo-server.previous` next to it is the one before the last `pyo-server update`. | | `/var/log/pyo-server.log` | The log of every run that changed the machine. Only root can read it. | | `/var/lib/pyo-server/state.json` | What this machine is, its release, Pyo's address and the last run. No secrets. | | `/run/pyo-connect.lock` | Held while a setup changes the machine, so two never run at once. | | `/run/pyo-server/tailscale-key` | The Tailscale key while the machine joins your tailnet. Root only, deleted right after. | A sandbox server also has the daemon's files: | Path | What it is | | --- | --- | | `/usr/local/bin/pyo-sandbox`, `/usr/local/lib/pyo-sandbox` | The daemon, Firecracker, the guest kernel, and gVisor on a server without KVM. | | `/etc/pyo-sandbox` | Its settings, its edge certificate and its tailnet certificate. | | `/var/lib/pyo-sandbox` | Its sandboxes' data. | | `pyo-sandbox.service`, `pyo-sandbox-cert.timer` | The daemon, and the renewal of its tailnet certificate. In `/etc/systemd/system`. | A server Pyo makes at [Hetzner](https://pyo.dev/docs/hetzner) also logs its first boot to `/var/log/pyo-join.log`. ## Memory tiers Pyo reads the server's memory each time a part of it starts, so a server you resize gets the matching settings after a restart: | Memory | k3s | Set aside for k3s and the system | Pyo's database | Connections per process | | --- | --- | --- | --- | --- | | Under 1.5 GiB | Soft memory limit and compressed swap | 256 MiB | 16 MB of cache, 40 connections | 5 for `pyo`, 12 for `pyo-worker` | | 1.5 to 2.75 GiB | Soft memory limit and compressed swap | 512 MiB | 16 MB of cache, 40 connections | 5 for `pyo`, 12 for `pyo-worker` | | 2.75 to 3.5 GiB | Soft memory limit | 512 MiB | 16 MB of cache, 40 connections | 5 for `pyo`, 12 for `pyo-worker` | | 3.5 to 8 GiB | As it is | 768 MiB | 32 MB of cache, 80 connections | 10 for `pyo`, 16 for `pyo-worker` | | 8 GiB or more | As it is | 1 GiB | 64 MB of cache, 120 connections | 15 for `pyo`, 24 for `pyo-worker` | Pyo's own parts ask for about the memory they hold at rest, and may use more up to their limits. On a single server with databases set up, they and k3s's DNS and metrics ask for around 890 MiB. `PYO_DB_POOL` sets the connections per process instead. Keep two of each process within the database's connections, since an update runs the old and new ones side by side. [Observability](https://pyo.dev/docs/observability#turning-it-on-or-off) is a setting, not a tier: a new install under 3.5 GB starts with it off, and after that it changes only when an admin changes it. ## Agent policy To limit what the agent may do on a cluster, create a `pyo-policy` ConfigMap in `pyo-system` on that cluster. The agent only reads it, so only someone with access to the server can change it. | Key | Value | Effect | | --- | --- | --- | | `terminal` | `off` | No terminals into services. | | `forceRemoveServers` | `off` | Servers are only removed after their services have moved away. | | `readOnly` | `true` | The agent reports, and changes nothing. | ```bash sudo k3s kubectl -n pyo-system create configmap pyo-policy --from-literal=terminal=off ``` The team's **Security** page shows each cluster's policy. ## Secrets Pyo keeps its keys as Kubernetes Secrets in `pyo-system`. | Secret | What it holds | | --- | --- | | `pyo-secrets` | The master key. Back this up, and never delete it. | | `pyo-admin` | The password the installer printed. It stops working once you've set up your account. | | `pyo-agent` | How this cluster's agent signs in to Pyo. | | `pyo-vector` | How log collection connects to Pyo. | | `pyo-postgres` | The password and address for Pyo's database. | | `pyo-clickhouse` | The ClickHouse password. | | `pyo-backup-store` | The backup store's internal secret and admin token, and Pyo's own key to it. Teams' keys are kept in Pyo's database, encrypted. | | `pyo-bootstrap` | The key this machine uses to connect itself, and to prove it's the cluster Pyo runs on. Only on that cluster. | | `pyo-geoip` | Your GeoLite2 license key, if you've added one. | --- # Connecting with Tailscale Join servers and clusters over your tailnet. One server with a public IP needs no Tailscale. Pyo is on its public IP over HTTPS and on your own network over HTTP. A server at home, behind NAT, has no HTTPS address without Tailscale. Pyo and your services are then only on your own network over HTTP. See [Where Pyo is](https://pyo.dev/docs/install#where-pyo-is). Pyo uses [Tailscale](https://tailscale.com) when you add a second server or connect another cluster. Servers then talk over your tailnet, so one cluster can span data centers, providers and your homelab, with no open ports between them. ## Setting it up Tailscale is set up once for each team, on **Integrations**. Every cluster of the team joins that tailnet, the ones you connect later too. A team admin sets it up. For the team that has the cluster Pyo runs on, an installation admin does. You need to be an Owner or Admin of your tailnet. 1. In the Tailscale admin console, open [**Settings › Keys**](https://login.tailscale.com/admin/settings/keys) and generate an API access token that expires in 1 day. 2. In Pyo, open **Integrations** and paste it on the **Tailscale** card. Click **Check**. 3. Pyo shows what it will change, with the lines it adds to your tailnet policy. Click **Set up**. Pyo then does the rest: - It turns on **MagicDNS** and **HTTPS Certificates**. - It adds `tag:pyo` to your tailnet policy. It edits the policy in place, so your comments and formatting stay. - It creates an OAuth client of its own, with only the scopes it needs. - It deletes the token. If it can't, it tells you to delete it under **Settings › Keys**. It expires within a day anyway. Pyo never stores the token. Running the setup again on a tailnet that's set up changes nothing. ### Before a cluster connects A team with no cluster yet can paste the token anyway. It stays in your browser tab, never in Pyo. [Connect a cluster](https://pyo.dev/docs/clusters), and the review opens as soon as it connects. Closing the tab drops the token. If your policy is managed in Git, Pyo doesn't edit it. It shows the lines to add there instead. Add them, then click **Check again**. ### With an OAuth client If you'd rather not paste an admin's token, make the OAuth client yourself: 1. In the Tailscale admin console, add this to your tailnet policy file: ```json "tagOwners": { "tag:pyo": ["autogroup:admin"] } ``` 2. Turn on **MagicDNS** and **HTTPS Certificates** under **DNS**. 3. Under **Settings › Trust credentials**, add an OAuth client with these scopes: - **Devices › Core**, write, with `tag:pyo` - **Auth Keys**, write, with `tag:pyo` - **Services**, write 4. In Pyo, open **Integrations**. On the **Tailscale** card, click **Set up with an OAuth client instead** and paste the client ID and secret. If your policy only allows some traffic, also let your tailnet reach `tag:pyo` on ports 80 and 443: ```json "grants": [{ "src": ["autogroup:member"], "dst": ["tag:pyo"], "ip": ["tcp:80", "tcp:443"] }] ``` Pyo approves the servers that host its Services by itself. To have your policy approve them too, add `"autoApprovers": { "services": { "tag:pyo": ["tag:pyo"] } }`. The token setup adds both when they're needed. Pyo checks the client before saving it and says what's missing. **Test** checks it again. ## One cluster keeps it The OAuth client lives in one cluster of the team, as a secret in its `pyo-system` namespace. The card shows it under **Kept on**. Pyo picks the cluster it runs on, else the team's oldest connected cluster. That cluster's agent does Pyo's Tailscale work for every cluster of the team, in signed commands: their names on your tailnet and the keys their new servers join with. The other clusters keep no Tailscale credential at all. Pyo keeps only what isn't secret. While that cluster is offline, new servers can't join and names don't change. Servers already on your tailnet, names and certificates keep working. If the cluster is removed or gone for good, set Tailscale up again with a new token. Pyo then picks another cluster and lists the old OAuth client to delete. The card lists the team's clusters: - **On your tailnet**: a server of it is on your tailnet. - **Not on it yet**: none of its servers has joined. - **On another tailnet**: it keeps a client of its own for another tailnet. See [Clusters on another tailnet](#clusters-on-another-tailnet). - **Waiting for** the cluster that keeps it, while that one is offline. **Servers** counts Pyo's tagged devices on your tailnet. Tailscale plans include 50 tagged devices, and the card says so from 40 on. Clusters set up before 0.51.0 kept a client each. Pyo moves them to one by itself: the one on the most clusters' tailnet keeps it, and the others forget theirs. The card lists their OAuth clients to delete in the Tailscale console under [**Settings › Trust credentials**](https://login.tailscale.com/admin/settings/trust-credentials). The add-server and connect-cluster pages link to the card until Tailscale is set up, and take you back once it's saved. ## What Pyo does with it - **Pyo's own server joins your tailnet.** A timer on it asks Pyo for a key, installs Tailscale if needed and joins. This takes about a minute. Then it restarts k3s once to run it over your tailnet, so servers you add can reach it. If k3s doesn't come back, it puts the old setup back and tries again the next day. The **Tailscale** card shows how it's going. - **Pyo gets names on your tailnet.** `https://pyo..ts.net` for the dashboard and API, `registry..ts.net` for [Pyo's registry](https://pyo.dev/docs/registries#push-your-own-images), and `sandboxes..ts.net`. All use Tailscale's certificate on port 443. Since 0.52.0 the `sandboxes` name serves no sandbox pages. It answers only with the notice to [update a sandbox server](https://pyo.dev/docs/sandbox#update-a-server). The desktop opens on the sandbox server's own name on your tailnet. - **Servers join on their own.** Each command to add a [server](https://pyo.dev/docs/servers) or connect a [cluster](https://pyo.dev/docs/clusters) carries a fresh key: single use, valid for an hour, tagged `tag:pyo`. You never paste anything for a new cluster. - **Sandbox servers join your tailnet.** The terminal, files and desktop of their sandboxes then open there. A [sandbox server](https://pyo.dev/docs/sandbox#without-tailscale) also works without Tailscale: its terminal and files then go through Pyo, and the desktop doesn't open. - **Services get tailnet domains.** Like `blog..ts.net`, reachable only from your tailnet. They need no DNS record, since Pyo sets up the name on your tailnet. See [Tailnet domains](https://pyo.dev/docs/domains#tailnet-domains). Pyo's names are [Tailscale Services](https://tailscale.com/kb/1552/tailscale-services), hosted by every server that runs a Pyo Gateway proxy. Pyo only touches Services it made. If a name is taken on your tailnet, Pyo picks `pyo-` instead, then adds `-2`. An admin can rename them on the card. If someone else takes the sandboxes' name later, Pyo moves to the next free one by itself. A tailnet domain you type that's already taken shows **Taken on your tailnet**. `pyo`, `registry` and `sandboxes` are kept for Pyo. ## Tailnet Lock With [Tailnet Lock](https://tailscale.com/kb/1226/tailnet-lock) on, a new server waits until a signing device signs its key. The join command prints the command to run there: ```bash tailscale lock sign nodekey:… ``` The dashboard shows it too, while a new cluster, server or sandbox server waits: **Waiting for a Tailnet Lock signature**, with the command to copy. Then it carries on by itself. ## Closing the public dashboard Once Pyo answers at `https://pyo..ts.net`, turn off **Public dashboard** on the **Tailscale** card to close `https://pyo..nip.io`. Pyo is then only on your tailnet and your own network. Turn it on again any time. Removing Tailscale opens it again too. ## Clusters on another tailnet A cluster that kept a client of its own for another tailnet stays there, and its own agent keeps doing its Tailscale work. Nothing about it changes by itself. A cluster with one server moves with **Move** on the card. Pyo deletes its names on the old tailnet, forgets its client, and moves its tailnet domains to your team's tailnet. Then run the command it shows on the server. The server leaves the old tailnet, joins yours, and k3s follows with one restart. Delete the old client in the old tailnet's console. ### Move a cluster by hand A cluster with more servers runs k3s over its tailnet, so its servers' addresses can't all change at once. Move it like this: 1. [Connect a new cluster](https://pyo.dev/docs/clusters). It joins your team's tailnet. 2. Move its services to the new cluster. 3. [Remove the old cluster](https://pyo.dev/docs/clusters#disconnecting) from Pyo. 4. In the old tailnet's console, remove its servers and delete its OAuth client. ## Removing a cluster When a cluster is removed, its servers leave the tailnet and Pyo's names for it are deleted. The cluster that keeps the client does it. For a cluster on another tailnet, another cluster of the team on that tailnet does it. When there's none, the card lists the servers to remove in that tailnet's console. Removing the cluster that keeps the client asks you to set Tailscale up again afterwards. ## Disconnecting **Disconnect** on the card is for the whole team: - Every cluster of the team leaves your tailnet in Pyo. - New servers can't join. - Tailnet domains stop working. - For the team with Pyo's own cluster, Pyo's tailnet address stops working and the public dashboard opens again. Servers stay on your tailnet, since clusters with more servers run k3s over it. Remove them in the Tailscale console if you like, and delete the OAuth client the card names. On a self-hosted Pyo, a team without its own Tailscale still adds servers over the tailnet of the team that has Pyo's cluster. ## Websites on your tailnet A cluster's [free domains](https://pyo.dev/docs/domains#free-domains) can use its servers' Tailscale addresses, like `shop-web.100.64.0.2.nip.io`. Then your services' websites are reachable from your tailnet on ports 80 and 443, whatever the cluster's other [traffic paths](https://pyo.dev/docs/clusters#public-traffic) are. Each server's Tailscale address answers, except on build-only servers. A service's [firewall](https://pyo.dev/docs/firewall) and [WAF](https://pyo.dev/docs/waf) apply there too, and they see each device's own tailnet address. A server behind NAT uses this by default. > HTTPS certificates are public. Names on your tailnet show up in public Certificate Transparency logs. They stay reachable only from your tailnet. Still, to keep the names from giving much away, give your tailnet a random name with **Rename tailnet** under **DNS** in the admin console. ## Tailscale switch **Settings › Traffic › Tailscale** decides whether your services' websites answer on the tailnet. Off, their ts.net names and free domains on Tailscale addresses stop answering. Your servers, Pyo's own tailnet names and the registry stay on the tailnet. On the cluster Pyo runs on, turning it off or on drops open connections to Pyo on the tailnet once. Not once the cluster's connect command has run for Pyo 0.52.0. --- # Configuring your team Name your team and set its defaults. Find these under **Settings**, in the sidebar's **Team** section: - **Team name and slug:** the slug appears in your dashboard URLs. - **Default target cluster:** where new deploys go. - **Observability:** what your team's servers collect and keep. See [below](#observability). - **Agents:** on Pyo Cloud, whether your clusters' agents update automatically. See [Agent updates](https://pyo.dev/docs/cloud/agent-updates). Owners and admins change these settings. Other members see them read only. Only owners can delete a team. Other members don't see **Delete team**. Deleting a team removes its projects and clusters from Pyo. Nothing on the clusters is touched. ## Observability Find it under **Settings → Observability**, in the sidebar's **Team** section. Owners and admins change it. Other members see the values. - **Observability:** whether Pyo collects analytics, request logs and usage history for your team. Off, Pyo stops collecting for your team. What was collected is kept. - **Request logs:** whether your servers keep every request. Off, requests still count in analytics. - **IP addresses:** Don't store, Anonymized or Full. Options above your installation's limit can't be picked. Your installation's admin can allow more. - **Query strings:** Keep, Names only or Don't keep, up to your installation's limit. Passwords and tokens are always hidden. - **Logs:** how many days and how much space each cluster keeps for your [request logs](https://pyo.dev/docs/observability#request-logs). 7 days and 1 GB by default. Each cluster's storage for them grows to fit. Where it can't grow, the cluster keeps what fits. - **Analytics:** how long your [analytics](https://pyo.dev/docs/observability#how-long-its-kept) are kept, up to as long as the installation keeps them. When the installation lowers a limit, your team keeps less from then on and gets an entry in its [activity](https://pyo.dev/docs/activity). Addresses already kept are hidden at once and expire with your request logs. Your own choice is kept, and applies again if the limit goes back up. With the CLI: ```bash pyo observability --team acme pyo observability off --team acme pyo observability --team acme --ip anonymized --query-strings names --request-logs off ``` --- # Inviting your team Work together, with the right access for each person. Everything in Pyo belongs to a team, and you can be in several. ## Roles | Role | What they can do | | --- | --- | | Owner | Full control, including deleting the team | | Admin | Manage members, clusters and every project | | Developer | Deploy and configure services | | Viewer | Read-only access | ## Invite people Sign-ups are closed, so people join by invitation. Invite them by email under **Members**, in the sidebar's **Team** section. With [email](https://pyo.dev/docs/email) set up, the invite goes straight to them. Without it, you get a link to share yourself. People join through the link. Signing up with the invited address isn't enough. The link works once, for 14 days, and only for an account with the invited address. Someone who already has an account with that address is added right away. **Resend invite** and **Copy invite link** make a new link, and the old one stops working. ## Reset a member's sign-in An owner can send a member a link to choose a new password, with **Reset sign-in** under **Members**. See [Getting back in](https://pyo.dev/docs/getting-back-in#a-team-owner-resets-it). ## Two-factor and the audit log Owners and admins can require [two-factor authentication](https://pyo.dev/docs/two-factor#require-it-for-a-team) for every member. The [audit log](https://pyo.dev/docs/audit-log) shows them who did what in the team, and from where. ## API keys and assistants [API keys](https://pyo.dev/docs/api) and [AI assistants](https://pyo.dev/docs/mcp) act as the person who created or approved them, with that person's role. --- # Deploying a template Popular software, ready to run. Templates run popular software with sensible defaults: storage, a health check, resource limits and generated passwords. Open **Service templates** in the dashboard, pick one, and deploy it. Browse them all on the [Templates page](https://pyo.dev/templates). For Postgres, MySQL or KV, use [databases](https://pyo.dev/docs/databases) instead. ## WordPress and Ghost [WordPress](https://pyo.dev/templates/wordpress) and [Ghost](https://pyo.dev/templates/ghost) keep their data in a [MySQL database](https://pyo.dev/docs/databases#mysql) that Pyo runs. When you deploy one, its **Database** section asks which database to use. **New database** creates one on the same cluster. **Existing database** picks one of your team's databases there. Pyo connects it before the first deploy, with the variable names each one expects: | Template | Variables | | --- | --- | | WordPress | `WORDPRESS_DB_HOST` (host and port), `WORDPRESS_DB_USER`, `WORDPRESS_DB_PASSWORD`, `WORDPRESS_DB_NAME` | | Ghost | `database__connection__host`, `database__connection__port`, `database__connection__user`, `database__connection__password`, `database__connection__database`, with `database__client` set to `mysql` | These variables show on the database's **Connect** tab like any connection, and follow it if it changes. - **WordPress** keeps themes, plugins and uploads on its volume (`/var/www/html/wp-content`) and takes uploads up to 64 MB. Its keys and salts are generated once, so sign-ins survive deploys. Add a domain, then finish the setup at its address. It works behind the [Gateway](https://pyo.dev/docs/gateway) over HTTPS. Turn on the [WAF](https://pyo.dev/docs/waf) on its **Firewall** tab to block common attacks. - **Ghost** needs a domain: its `url` is the service's own address (`${{self.PUBLIC_URL}}`, filled in from the domain). Its content stays on its volume (`/var/lib/ghost/content`). Create the admin account at `/ghost`. Mail is optional: for newsletters and sign-ups, add `mail__transport` (`SMTP`), `mail__options__host`, `mail__options__port`, `mail__options__auth__user`, `mail__options__auth__pass` and `mail__from` as variables. Both run one replica with their own volume, and restart on each deploy. ## Database extensions Some templates need a Postgres [extension](https://pyo.dev/docs/databases#extensions). A new database is made with the ones Pyo turns on. If you pick an existing database that doesn't have them on, the **Database** section asks to turn them on before connecting it. Turning on some of them restarts the database. The service creates any others itself, like `pg_trgm` for Wiki.js. ## Stateful templates Databases and other stateful templates run one replica with their own volume. Replication isn't set up for you, so plan [backups](https://pyo.dev/docs/backups) before storing production data. ## Contribute a template Templates are open source, in [pyo-templates](https://github.com/upsetdev/pyo-templates). Each one is a short YAML file that says what to run. The [contributing guide](https://github.com/upsetdev/pyo-templates/blob/main/CONTRIBUTING.md) shows you how to add yours. Each template has its own `version`, bumped on every change. Pyo records it on each service it deploys, with the images and your choices in the deploy form. Secret values are never recorded. --- # Two-factor authentication Ask for a code from an authenticator app after your password. With two-factor authentication on, signing in takes your password and a 6-digit code from an authenticator app. Someone who learns your password still can't get in without your phone. ## Turn it on 1. Go to **Profile** and choose **Set up** under **Two-factor authentication**. 2. Enter your password. 3. Scan the QR code with your authenticator app. If you can't scan it, enter the key shown next to it. 4. Enter the code the app shows and choose **Turn on**. Pyo then shows 10 recovery codes. Each one signs you in once if you lose your app. They're shown only this once, so copy or download them and keep them somewhere safe, like a password manager. You manage two-factor from the dashboard only, never with an API key. ## Signing in After your password, Pyo asks for the code from your app. You have 5 minutes and 5 tries, then you start again. Each code works once. A sign-in link from [Getting back in](https://pyo.dev/docs/getting-back-in) asks for a code too, after you choose your new password. A [passkey](https://pyo.dev/docs/passkeys) skips the code. It already proves both your device and you. Lost your phone? Choose **Use a recovery code** on the code step and enter one of yours. ## Recovery codes **Profile** shows how many recovery codes you have left. Choose **New codes** and enter a code to get 10 new ones. The old ones stop working. ## Turn it off Choose **Turn off** on **Profile** and enter a code from your app or a recovery code. Each of your teams sees this in its **Activity**, and Pyo emails you when [email](https://pyo.dev/docs/email) is set up. You can't turn it off while it's required of you. ## Require it for a team Team owners and admins can require two-factor for every member. Open **Security**, in the sidebar's Infrastructure section, and turn on **Require for members** under **Two-factor authentication**. Turn it on for your own account first. The page shows how many members use it. A member without two-factor can't see a team that requires it until they set it up. The team is left out of the dashboard, their [API keys](https://pyo.dev/docs/api) and their [AI assistants](https://pyo.dev/docs/mcp). Opening the team in the dashboard shows that it requires two-factor, and their **Profile** still works so they can set it up. ## Require it for everyone On a self-hosted Pyo, the installation's admin can require two-factor of every account. Go to **Settings › Security** and turn on **Require two-factor for everyone**. Turn it on for your own account first. Accounts without it can only open their profile until they set it up. Pyo Cloud's staff always use two-factor. ## Lost your app and your recovery codes On a self-hosted Pyo, run this on the server Pyo runs on: ```bash sudo pyo-reset-login you@example.com ``` The link it prints turns two-factor off for that account and lets you choose a new password. Then set two-factor up again. See [Getting back in](https://pyo.dev/docs/getting-back-in#on-the-server). A team owner's **Reset sign-in** link doesn't turn two-factor off. ## Limits After 5 wrong codes for one account, or 30 from one IP address, within 15 minutes, Pyo stops accepting codes for a while. A correct code resets the account's count. --- # Uninstalling Pyo Remove a server, disconnect a cluster, or remove Pyo from your machine. There are four ways to take Pyo off your machines: - [Remove a server](#remove-a-server) from a cluster. - [Disconnect a cluster](#disconnect-a-cluster) that already had Kubernetes, and keep the cluster. - [Uninstall Pyo](#uninstall-pyo) from the machine you installed it on. - [Take a sandbox server off a machine](https://pyo.dev/docs/sandbox#take-it-off-a-machine). ## Before you start > Each of these can delete services, volumes and databases for good. Back them up first. - [Back up your volumes and databases](https://pyo.dev/docs/backups) to a bucket of your own, not Pyo's built-in store. That store runs on the machine Pyo is on, so it goes with Pyo. - Export each database you want to keep with its own tool, like `pg_dump` or `mysqldump`, from a service connected to it. - Before you uninstall Pyo itself, [back up Pyo's own data](https://pyo.dev/docs/backups#backing-up-pyo-itself) to a bucket elsewhere. ## Remove a server 1. In Pyo, open the server and choose **Remove server** from its menu. Pyo moves its services to the other servers. 2. When the server shows **Drained: uninstall k3s on the machine to finish**, run this on that machine: ```bash sudo /usr/local/bin/k3s-agent-uninstall.sh ``` 3. Once the machine goes offline, Pyo removes it from the cluster. This deletes k3s and everything it kept on that machine, including the files of any volumes there. On a joined server, `pyo-server uninstall` removes nothing and points to this script. A server whose volumes keep data on its disk can't be drained, so move or delete those services first, and delete detached volumes that are on it. A server that's already offline is removed with **Remove by force** instead. The machine stays on your tailnet. If the [join command](https://pyo.dev/docs/servers) installed the NVIDIA Container Toolkit, it stays too. To remove the firewall rules it added, find the ones marked `Pyo ingress` or `k3s over Tailscale` and delete them by number: ```bash sudo ufw status numbered sudo ufw delete ``` To remove Pyo's [memory settings for k3s](https://pyo.dev/docs/system-reference#k3s): ```bash sudo systemctl disable --now pyo-zram.service sudo rm -f /etc/systemd/system/pyo-zram.service /etc/systemd/system/k3s-agent.service.d/pyo-memory.conf /usr/local/lib/pyo-memory.sh sudo systemctl daemon-reload ``` If the first line of `/etc/apparmor.d/cri-containerd.apparmor.d` is `# Managed by Pyo`, it's Pyo's AppArmor profile, which k3s no longer needs: ```bash sudo apparmor_parser -R /etc/apparmor.d/cri-containerd.apparmor.d sudo rm /etc/apparmor.d/cri-containerd.apparmor.d ``` ## Disconnect a cluster This removes everything Pyo put into a cluster and leaves the cluster itself, with k3s, running. 1. In Pyo, delete or move the cluster's services. Pyo only removes a cluster with no services left. 2. On the cluster's **Settings** tab, choose **Remove cluster**. This deletes nothing on the cluster. 3. On the cluster's first server, run: ```bash curl -fsSL https://your-pyo/install/server.sh | bash -s -- uninstall ``` Put your Pyo's address in place of `https://your-pyo`, as in the cluster's commands in the dashboard. It runs [`pyo-server uninstall`](https://pyo.dev/docs/pyo-server#uninstall). On a server that has `pyo-server` already, `sudo pyo-server uninstall` does the same. The command from before 0.53.0, `connect.sh` with `--uninstall`, still works. It lists what it will remove, and asks you to type `yes`. It stops the agent first, so nothing is put back, then removes: | What | Where | | --- | --- | | The Pyo agent, its roles and its admission policy | `pyo-system` | | Your projects, with their services, volumes and databases | Their namespaces, and `pyo-db-*` | | The databases system and the WAF | `pyo-databases`, `pyo-waf` | | Pyo Gateway | `pyo-gateway` | | cert-manager, if Pyo installed it and nothing else uses it | `cert-manager` | | Join tokens, the GPU device plugin and a DNS disruption budget | Pyo's own objects in `kube-system` | It only deletes objects Pyo made, found by their names and Pyo's labels. Other namespaces, the Gateway API and k3s's own components stay. A volume with a `Retain` policy keeps its data on the server's disk. It lists those with their paths. Run on the server, it also removes [automatic updates](https://pyo.dev/docs/cloud/agent-updates) when they're set up there. | Option | What it does | | --- | --- | | `--keep-data` | Keeps your projects' namespaces, databases and volumes, with the databases system and cert-manager that run them. The volumes of what it removes keep their data on disk too (see below). | | `--dry-run` | Only lists what it would delete. | | `--yes` | Doesn't ask first, for scripts. | With `--keep-data`, the volumes in the namespaces it removes, like Pyo's own database, registry and backup store when Pyo itself goes, are set to `Retain` first. Their data and their PersistentVolumes stay. When it's done, it lists each one with its directory and server, for example `/var/lib/rancher/k3s/storage/pvc-…`, and `--dry-run` lists them beforehand. To delete them later: ```bash sudo k3s kubectl delete pv … sudo rm -rf # on the server it's on ``` With `--keep-data`, run it before you remove the cluster in Pyo. Your services stay on the cluster, and it shows as unreachable. After 10 minutes, choose **Remove anyway** on its **Settings** tab. Pyo then forgets the cluster, its services, databases and volumes, and leaves everything on the cluster as it is. On the server it uses k3s's `kubectl`. To run it from another Linux machine against any cluster, install `pyo-server` there, then run it with `KUBECONFIG` set and without `sudo`: ```bash curl -fsSL https://pyo.dev/v/0.53.0/server.sh | bash -s -- version KUBECONFIG=~/.kube/config pyo-server uninstall ``` It uses that machine's `kubectl`. The machine Pyo itself runs on is disconnected by [uninstalling Pyo](#uninstall-pyo). If the connect command installed k3s and you don't need the cluster any more, remove it in Pyo, then run `sudo /usr/local/bin/k3s-uninstall.sh` on its first server and `sudo /usr/local/bin/k3s-agent-uninstall.sh` on the others. That deletes the whole cluster with its data. ## Uninstall Pyo Run this on the machine you installed Pyo on: ```bash curl -fsSL https://pyo.dev/install.sh | bash -s -- --uninstall ``` It lists what it will remove, and asks you to type `yes`. It removes: - Pyo's timers and scripts: `pyo-connect`, `pyo-tailnet`, `/usr/local/lib/pyo` and `/etc/pyo`. - k3s, with Pyo and all your services, volumes and databases in it, through k3s's own `k3s-uninstall.sh`. Before that, it moves the files of Pyo's own database and registry, your volumes and your databases to `/var/lib/pyo-kept/