# Orbit hosting

Orbit hosting runs your plugin's server for you, in London (AWS region eu-west-2). You build a container image and push it to a private registry Orbit creates for the plugin. Orbit runs it, gives it a public HTTPS address, injects the settings it needs to talk to Orbit, keeps its logs, meters what it uses and bills your card each month. Self hosting stays available: you can run the plugin on your own servers and give Orbit its address instead.

Every starter from [the orbit-plugin tool](/guides/plugin-tool) already meets the image requirements on this page, so `docker buildx build --platform linux/arm64 .` in a starter folder gives you an image Orbit runs as it is.

## Who can use it

Every approved partner. Hosting is a paid subscription per plugin, from £29 a month; there is no free tier. You choose it when you create a plugin in the partner dashboard (**Plugins**, **New plugin**, then the **Orbit Plugin Hosting** card), or later on the plugin's **Hosting** tab. You pick a plan and accept the Orbit Plugin Hosting Addendum, which the dialog shows in full. No card is taken until your first deploy, so a draft can wait as long as you like.

Each hosted plugin gets:

- A public address, `https://<plugin-id>.<hosting domain>`, with HTTPS. The hosting domain is used for nothing but hosted plugins; the Hosting tab shows your plugin's full address. Development and review stores reach the plugin there.
- Up to two domains of your own. Merchants reach a hosted plugin only on one of them: see [Your own domain](#your-own-domain).
- A private container registry.
- A Postgres 16 database of its own, on a shared server, behind a login only your plugin holds.
- Private object storage, reached through the plugin's own role with no keys to manage.
- On the Scale and Business plans, a Redis compatible cache.
- An encrypted store for your environment variables and secrets, logs for 14 days, restart and deploy from the dashboard, usage meters, and a vulnerability scan of every image before it runs.

Not in this version: background workers as separate services, cron schedules, regions other than London, and log shipping to your own tools.

## Plans

| Plan | Price a month | Compute | Copies | Database | Object storage | Bandwidth | Requests |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Starter | £29 | 0.25 vCPU, 0.5 GB memory | 1 | 1 GB, 10 connections | 5 GB | 10 GB | 250,000 |
| Growth | £59 | 0.5 vCPU, 1 GB memory | 1 | 5 GB, 20 connections | 25 GB | 50 GB | 2,000,000 |
| Scale | £199 | 1 vCPU, 2 GB memory | 2 | 20 GB, 50 connections | 100 GB | 200 GB | 6,000,000 |
| Business | £399 | 2 vCPU, 4 GB memory | 2 | 50 GB, 100 connections | 250 GB | 400 GB | 12,000,000 |

Each plan also includes logs (0.5, 2, 8 or 20 GB), outbound traffic (2, 10, 40 or 100 GB) and object operations. Scale includes a cache of about 380 MB and Business about 1,000 MB. Every allowance is for one billing month.

- Above an allowance Orbit bills the overage rather than cutting you off: £0.16 per GB of bandwidth, £4 per million requests, £0.50 per GB a month of database, £0.05 per GB a month of object storage, £1 per 100,000 object writes, £0.10 per 100,000 object reads, £1 per GB of logs and £0.20 per GB of outbound traffic.
- The one exception is an abuse line: a plugin that uses more than ten times a month's allowance of bandwidth, requests, logs or outbound traffic in a single day is paused, and you are told which meter crossed it.
- Memory is a hard limit. A task that asks for more is stopped and started again at once, mid request.
- At 80 percent of an allowance you get a banner, a bell notification and an email. With **Auto upgrade** on (the default, in the **Plan and usage** card), a plugin whose CPU or memory sits at its ceiling for ten minutes moves up one plan, at most once in 24 hours. Turn it off if you would rather approve each move.
- Upgrades apply at once and are prorated; downgrades apply at your next renewal. Prices are in pounds sterling and exclude VAT.

## Deploying

1. Build your image for ARM64. In a starter folder:

   ```sh
   docker buildx build --platform linux/arm64 --load -t my-plugin:latest .
   ```

2. On the plugin's **Hosting** tab, in the **Deploy** card, choose **Get registry login**. The dialog shows a login command once, because it holds the password: copy it before you close the dialog. A login works for this plugin's registry only and lasts up to an hour. Run it in the shell you push from:

   ```sh
   printf '%s' '<password>' | docker login --username AWS --password-stdin <registry host>
   ```

3. Tag and push the image. The **Deploy** card shows the registry address and these commands with your ids filled in, after a `docker login` line that asks for the password (the dialog's command already supplied it):

   ```sh
   docker tag my-plugin:latest <registry host>/partners/<partner-id>/<plugin-id>:v1
   docker push <registry host>/partners/<partner-id>/<plugin-id>:v1
   ```

4. The tag appears in the **Deploy** card with its architecture and scan result after a minute or two. Choose **Deploy** beside it.

The deploy is refused at the scan if the image has no `linux/arm64` variant or the scan found a critical vulnerability; high findings are shown as warnings. Otherwise Orbit starts the new version beside the old one and moves traffic when it is healthy. A new version that is not healthy within ten minutes is rolled back to the previous one automatically. Your first deploy asks for a card if your partner account has none, and starts the subscription.

Use a new tag for every version (`v1`, `v2`, a git commit). Orbit keeps the last ten tagged images. **Roll back to** in the Deploy card deploys the image that was live before the current one, as long as its tag still names that image. **Deploy on push**, off by default, deploys every tag you push without a click; leave it off while you are testing.

While Orbit hosts your plugin, merchants reach it at its main address whatever base URL your release declares. Declare paths in `plugin.json`; Orbit routes merchants to the main address itself. A hosted plugin can be submitted for review only while it runs on Orbit hosting and is not on hold, because reviewers test it live, and only once a domain of your own is its main address.

## Your own domain

A plugin Orbit hosts reaches merchants only from a domain of your own. Until one is live and is the plugin's main address, the API refuses these with `PLUGIN_HOSTING_CUSTOM_DOMAIN_REQUIRED`: submitting the plugin for review, publishing it yourself, staff approval, activating a production release that reaches live stores, and creating install links. Development stores, development releases and review stores keep using the Orbit address. The submit checklist shows the rule as **Custom domain is the main address**.

Connect one in the **Addresses** card on the Hosting tab:

1. Under **Add a domain**, enter a name under a domain you own, such as `app.example.com`, and choose **Add domain**. Only subdomains can be connected: not the domain itself, and not a wildcard.
2. Create the CNAME record the card shows at your DNS provider. If your provider proxies traffic, turn the proxy off for that record.
3. Wait until the domain shows **Live**. Orbit checks the record and issues the certificate, which usually takes a few minutes once the record is in place.
4. Choose **Make main address** beside it. Merchants and your webhooks use that domain from then on, and the Orbit address keeps working.

The plugin has to be running before an address can be made the main address. While the plugin is published, its main address stays a live domain of your own: to remove that domain or go back to the Orbit address, first make another live domain the main address, or unpublish the plugin.

## The image requirements

| Rule | What Orbit requires |
| --- | --- |
| Architecture | Linux, ARM64 (`linux/arm64`). A multi architecture image is fine; Orbit runs its arm64 variant. An image with only amd64 is refused at deploy. |
| Port | Listen on the port in `PORT`, on all interfaces (`0.0.0.0`). Orbit injects `PORT=8080`. Plain HTTP; Orbit terminates TLS. |
| Health check | Answer `GET /health` with a 200 within 5 seconds. |
| Start up | Be listening within 60 seconds of the container starting. |
| Shut down | On `SIGTERM`, finish open requests, close the listener and exit 0 within 30 seconds. |
| User | Your process runs as user id 1000, whatever `USER` your Dockerfile sets. Never require root. |
| Filesystem | The root filesystem is read-only. Only `/tmp` is writable: about 20 GB of scratch space, empty on every new task. |
| Logs | Write to standard output and standard error, one line per event. Orbit keeps 14 days. |
| Scanning | Every image is scanned when pushed. A critical vulnerability blocks the deploy. |

Test it the way Orbit runs it, with a read-only root and only `/tmp` writable:

```sh
docker run --rm --read-only --tmpfs /tmp --user 1000 -e PORT=8080 -p 8080:8080 my-plugin:v1
curl -i http://localhost:8080/health
```

### Health check

Orbit calls `GET /health` every 30 seconds. Two passes in a row make a new task healthy; three failures in a row make it unhealthy, and an unhealthy task is replaced. Answer 200 only when the app can serve requests; `{ "ok": true }` is enough. Do not call other services from it and do not require sign-in. A new task has 60 seconds' grace before failures count.

### Start up and shut down

Do what start up needs (migrations, warm up) in well under 60 seconds, and never `npm install` or build at start: the filesystem is read-only. When a task stops (a deploy, a restart, a plan change or a stop) your process receives `SIGTERM` and has 30 seconds to finish. Your command runs under a small init process, so `SIGTERM` reaches it even as PID 1. Start sending a response within 60 seconds of a request, or the caller gets a gateway timeout; long work belongs in a background loop inside your process.

### Running more than one copy

Scale and Business run two copies of your container behind the same address, and auto upgrade can move you there without asking. Anything your process does on a timer or once at start up then runs in both copies. Take a lock the copies share before scheduled work (a database row claimed with a conditional update, or a Redis key set with `NX` and a time to live on the plans with `REDIS_URL`), keep no state in memory that the other copy needs, and make start up migrations safe to run twice and compatible with the version before. If your plugin cannot run twice, turn auto upgrade off and stay on Starter or Growth.

## Environment

Orbit injects these variables, and refuses variables of yours with the same names:

| Name | What it is |
| --- | --- |
| `ORBIT_API_URL` | The Orbit API (`https://api.myorbitcommerce.net` in production). |
| `PLUGIN_PUBLIC_URL` | Your plugin's Orbit address. Build absolute links from it. It stays the Orbit address when a domain of your own is the main address; read the request's `Host` header when the address a merchant used matters. |
| `WEBHOOK_SECRET` | The secret Orbit signs your plugin's webhooks and connect calls with. Verify every request against it. |
| `DATABASE_URL` | Your plugin's own Postgres database, over verified TLS. See [The database](#the-database). |
| `PGSSLROOTCERT` and `ORBIT_DATABASE_CA_FILE` | `/orbit/certs/rds-ca-bundle.pem`, the certificate authority the database connection verifies against, for tools that want it as a path. |
| `PLUGIN_S3_BUCKET`, `PLUGIN_S3_PREFIX`, `AWS_REGION` | Your object storage: the bucket, your prefix in it (`plugins/<plugin-id>/`) and `eu-west-2`. |
| `REDIS_URL` | Scale and Business only: your cache, `rediss://` (TLS only). |
| `TOKEN_ENCRYPTION_KEY` | A random key, made once for the plugin and never changed, for encrypting the store tokens you keep. |
| `PORT` | `8080`. |
| `NODE_ENV` | `production`. |

The starters read `WEBHOOK_SECRET`, `TOKEN_ENCRYPTION_KEY`, `DATABASE_URL` and `ORBIT_API_URL` from the environment and nothing else, so they need no configuration on Orbit hosting. On your computer, `orbit-plugin dev` writes `WEBHOOK_SECRET` to `.env.local` and `orbit-plugin create` writes a `TOKEN_ENCRYPTION_KEY` there.

Your own variables go in the **Environment** card: up to 50, with upper case names that do not reuse an injected one, values up to 8 KB each and 48 KB of names and values in all. Mark a credential as a secret: it is stored encrypted and never shown again. New values reach the plugin on its next restart or deploy.

## The database

`DATABASE_URL` points at a Postgres 16 database of the plugin's own and ends in `?sslmode=verify-full&sslrootcert=/orbit/certs/rds-ca-bundle.pem`: the connection is encrypted and the server's certificate and name are checked. The server refuses plaintext connections.

- **node-postgres, and Prisma through `@prisma/adapter-pg`:** pass `DATABASE_URL` as it is, with no `ssl` option of your own. node-postgres reads `sslmode` and `sslrootcert` from the string.
- **Prisma's own engine**, which `prisma migrate deploy` uses even when your client uses the adapter, reads different parameters: give it the same address with `?sslmode=verify-full&sslcert=/orbit/certs/rds-ca-bundle.pem&sslaccept=strict`.
- **Anything else** that wants the certificate authority as a file reads its path from `ORBIT_DATABASE_CA_FILE`.

The starters do all of this for you. They use SQLite on your computer and Postgres here, with the same models in `prisma/schema.prisma` and `prisma/postgres/schema.prisma`. Their client uses `@prisma/adapter-pg` when `DATABASE_URL` is a Postgres address, and their start script (`scripts/start.mjs`) runs `prisma migrate deploy` with the rewritten address before the server starts. `migrate deploy` takes a Postgres advisory lock, so two copies starting together are safe. `npm run db:migration <name>` writes the next migration from the schema change, with no Postgres of your own.

The database server is backed up automatically and can be restored to any point in the last seven days; ask support within seven days of a loss.

## Storage and the cache

Your plugin's tasks run as a role that can reach your prefix in Orbit's bucket and nothing else. The AWS SDK finds the role's credentials by itself, so a client built with no keys works:

```ts
import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3';

const s3 = new S3Client({});
await s3.send(new PutObjectCommand({
  Bucket: process.env.PLUGIN_S3_BUCKET,
  Key: `${process.env.PLUGIN_S3_PREFIX}exports/report.csv`,
  Body: 'id,name\n',
}));
```

Every key must start with `PLUGIN_S3_PREFIX`. Never put access keys in your environment variables for this.

On Scale and Business, `REDIS_URL` names a Redis compatible cache (Valkey) of the plugin's own, created on the first successful deploy after moving to one of those plans. Use the whole `rediss://` address, so TLS stays on. It is a cache: it is never backed up, and a plan change can empty it. On Starter and Growth you may save a Redis of your own as `REDIS_URL`; a plugin meant for every plan should treat it as optional.

## Logs

The **Logs** card shows the last 1,000 lines your plugin wrote to standard output and standard error, with a time filter, and Orbit keeps 14 days. Write one line per event (a JSON object per line works well) and never a secret, a token or personal data. Log volume is metered, so keep debug logging off in production. **Restart** starts a fresh copy of the current image and stops the old one once the new one is healthy.

## Stopping hosting

**Stop** on the Hosting tab scales the plugin to zero at once, cancels the subscription at the end of the billing period and shows an export: a full `pg_dump` of the database and a listing of your object storage, available for 30 days. **Download your files** gives you short-lived read-only credentials and the command that copies the files themselves. Thirty days after the stop, Orbit deletes the images, secrets, database, object storage and logs, and emails you a confirmation. Merchants go back to the base URL your current release declares.

To move to your own servers instead, choose **Switch to self hosting** on the Hosting tab: a running plugin keeps running for seven days while you move.

## Servers and alerts

Coming soon.

## Deploy from your code

Coming soon.

## Help

Email support@orbitcommerce.net with "Plugin Hosting" in the subject and the plugin id, and the deployment id when a deploy failed. The addendum you accepted is on the plugin's Hosting tab.
