Skip to content
Weik.ioDocs
2026.2
Try Weik.io

weikio-backend

Weik.io 2026.2

The commands you run on a hub server with the backend image, from the first setup to backups and upgrades. Video

Watch: Backups, restore and upgrades, 3:28

The video makes a backup and restores one document and then the whole hub from it. It also goes through the upgrade steps.

On this page

weikio-backend runs the hub’s backend image as a command on a hub server. Use it for the work you can’t do over the API, such as creating the hub’s storage or using the master key. Its verbs run in a shell on the server and need no sign-in.

A verb that changes records, such as backup or restore, writes to the audit log as the operator, system:operator. It prints Audited <action> on <kind> <id>: <outcome>, record <seq>. on standard error for each audit record it writes.

The other tool, the weikio CLI, reaches your Weik.io installation over the API from anywhere. weikio init scaffolds an integration folder, but weikio-backend init sets up the installation.

How to run the verbs#

Run init once with docker run from the release’s backend image, before the stack exists. The stack’s infra service has the keys and the configuration mounted. Run every other verb through it, in the stack’s folder:

Terminal
$ cd /opt/weikio/deploy/compose/single
$ docker compose run --rm infra weikio-backend doctor

Exit codes#

Code Meaning
0 Success
1 A write failed
2 A usage error, or a configuration that isn’t valid
6 The hub’s message server can’t be reached

init#

weikio-backend init sets up a new installation. It has no prompts and creates the installation’s first files and records from the flags you give:

  • The stack’s compose file and configuration
  • The message server’s keys and the operator seed
  • The credentials of the hub’s own services and the token they send telemetry with
  • The first key the hub signs its tokens with
  • The built-in roles
  • The local admin user
  • The first platform administrator API key

The hub keeps its signing key sealed under the master key and replaces it every 90 days.

init prints the operator seed and the API key once. Save the seed and a copy of the master key outside the server and apart from the backups, because a restore needs both.

Terminal
$ install -d -o 1654 -g 1654 -m 0700 /opt/weikio
$ head -c 32 /dev/urandom > /opt/weikio/master.key && chown 1654:1654 /opt/weikio/master.key && chmod 0400 /opt/weikio/master.key
$ docker run --rm -u 1654:1654 -v /opt/weikio:/opt/weikio -e WEIKIO_HOME=/opt/weikio -e Weikio__Keys__Dir=/opt/weikio/keys \
    -e WEIKIO_MASTER_KEY_FILE=/opt/weikio/master.key -e Weikio__Nats__Urls__0=nats://nats:4222 -e WEIKIO_BACKEND_IMAGE=$IMG \
    $IMG weikio-backend init --public-base-url https://acme.example --public-leaf-url wss://nats.acme.example:443 --disk-budget 40GiB

Set $IMG to the release’s backend image with its digest, as the release’s images.env lists it. For the first start, including the checksum check of images.env, see Install Weik.io on one server.

Flag What it does
--public-base-url URL Sets the required address of the admin UI and the API. Agents send their telemetry to it too.
--public-leaf-url wss://HOST:PORT Sets the address agents link to, on a separate DNS name, such as wss://nats.acme.example:443.
--standby-leaf-url wss://HOST:PORT Sets the standby hub’s link address for agents to try after the published one.
--hub-network-leaf-url nats://HOST:PORT Sets the address that an agent on the same server links to on the hub’s network, such as nats://nats:7422. Give it on the first run, because you can’t add it later.
--leaf-ca-file FILE Gives the certificate of a private authority that signed the certificate of the --public-leaf-url address. Every Linux bundle, and a Windows bundle that links through that address, includes it as hub-ca.crt. The agent’s message server trusts it on its link to the hub. On Linux, the agent also trusts it on its calls to the --public-base-url address.
--dev Writes a stack for trying Weik.io. It has no backup service, but it has the dev agent, the project sandbox and the environment devtest.
--servers N Writes one folder for each of the hub’s N servers. N is 1 or at least 3.
--replicas 1|3|5 Sets how many copies of the storage the hub keeps. The default on several servers is 3.
--zones ZONE,... Gives the servers’ zones in order, such as availability zones, data centres or cloud providers. Each copy of the storage goes to a different zone.
--apim-instances N Sets the number of APIM instances, one on each server. A later run with a higher number adds the missing instances.
--apim-entrance NAME=ADDRESS:PORT Adds an entrance for the hub’s gateway to listen on, such as internal=10.0.1.11:8443. The public entrance listens on port 443. Give --apim-entrance on the first run, once for each APIM instance in instance order.
--disk-budget SIZE Sets each data server’s storage budget, such as 40GiB, up to 80 % of its storage disk. Without it, the storage has no cap.
--registry HOST Sets the image registry the stacks pull from. The default is Docker Hub.
--maven-repository id=URL[,mirror] Adds a Maven repository that builds resolve dependencies from. Repeat it for each repository, and add ,mirror to one that mirrors everything.
--no-maven-central Leaves Maven Central out, for an air-gapped hub.
--no-observability Writes the stack without the log, metric and trace stores.
--backup-every INTERVAL Sets how often the backup service makes an archive, from 1h to 365d.
--backup-keep N Sets how many archives the server keeps.
--backup-copy-to ADDRESS Copies each archive to an s3://<bucket>/<folder> address or an rclone remote.
--authority-names SUFFIX,... Limits the platform’s own certificate authority to the name suffixes you give, such as internal. They’re fixed once the authority is made.
--dns-provider cloudflare|hetzner Gives the installation its first DNS connection and needs --dns-zone ZONE and --dns-token-file FILE with it. Weik.io then uses DNS to prove ownership of names in the zone.

init runs again at every docker compose up -d and writes only what is missing. It records the first run’s choices in weikio-install.json beside the stack. A later run uses that file for every choice you don’t give.

A flag that differs from the file fails the run. You can still give a higher --apim-instances, or a larger --servers on a hub of several servers. A different --authority-names or backup flag doesn’t fail the run but changes nothing. Where no stack exists yet, as after a restore onto a new host, --public-base-url, --public-leaf-url, --standby-leaf-url and --apim-entrance may differ from the file.

doctor#

weikio-backend doctor checks the hub and changes nothing. It prints one line for each check with the result first, then the check’s name. A warn or fail line ends with fix: and the command that fixes it. Any fail makes doctor exit with an error.

Terminal
$ docker compose run --rm infra weikio-backend doctor

doctor checks the hub’s parts and settings:

  • The message servers and the storage budget
  • The public address over TLS 1.2 or 1.3, the way a browser reaches it
  • The hub’s link addresses
  • The agents’ bundles
  • The backups
  • The telemetry stores and their retention
  • The agent credentials that no longer work

Add -o json to print the same checks for a script.

weikio-backend doctor --hub-certificates runs no checks. For each of the hub’s names, it prints the certificate the hub serves for it and the days the certificate has left. The line starts with Warning: when a renewal is due and hasn’t happened, or when an uploaded certificate has less than 30 days left.

infra plan and infra apply#

weikio-backend infra plan compares the hub’s storage with what the release needs and lists what is missing or different. weikio-backend infra apply creates what is missing and updates what Weik.io created. Because the stack runs infra apply before the backend starts, you run them by hand only to check a hub:

Terminal
$ docker compose run --rm infra weikio-backend infra plan

backup#

weikio-backend backup --to <folder> writes a backup archive of the hub’s records, sealed with the master key, to a folder or an s3:// address. The stack’s backup service runs the same verb on the schedule in the installation’s settings and keeps the newest archives. Run it by hand before a risky change, or when the problem A backup is overdue appears:

Terminal
$ docker compose run --rm infra weikio-backend backup --to s3://backups-eu/weikio/backup-20260916T020000Z

An archive doesn’t contain the master key or the operator seed. Add --reason to store a reason with the audit record.

An archive also lists the agent credentials that no longer work, such as a bundle that a re-issue replaced. When the backup gets no copy of that list from a message server, the archive’s list can be incomplete. The backup then prints a line on standard error with the setting to check.

restore#

weikio-backend restore --from <folder> restores a hub from an archive, on the same host or on a new one. The archive opens only with the master key it was sealed with. Give that key in WEIKIO_MASTER_KEY_FILE and put the operator seed in the keys folder. Before it writes anything, the restore checks that every file in the archive is intact. With --verify-only, the restore runs only that check.

weikio-backend restore document --from <archive> <kind>/<name>[@<environment>] restores one document, such as a variable. Its source is an archive or a folder that weikio export wrote. The archive’s copy replaces a record of that name and keeps the record’s ID.

The restore prints whether the archive’s list of agent credentials that no longer work is complete. On a hub of several servers, restore from an archive whose list is complete.

When the archive’s settings keep telemetry for fewer days than the stores do, add --erase-older-telemetry. With that flag, the restore erases the older telemetry. For the procedure, see Backups and restore.

agents repoint#

Run weikio-backend agents repoint --hub wss://<host>:<port> after you restore a hub at a new address. It makes the new address the first one agents link to. It also writes each agent’s new bundle into a folder of its own under --out DIR. Each agent is offline until you copy its folder to its host and install it there with sudo sh ./setup.sh.

breakglass#

A break-glass window lets emergency accounts sign in when single sign-on doesn’t work. They can sign in only while a window is open, and only from the window’s address ranges. You open the window on a hub server:

Terminal
$ docker compose run --rm infra weikio-backend breakglass enable --hours 4 --cidr 203.0.113.7/32 --reason "identity provider down"
Verb What it does
breakglass enable Opens the window for 1 to 72 hours and ends every break-glass session. It prints a one-time set-password link for each emergency account that has no password yet.
breakglass disable Ends the window early.
breakglass status Shows whether a window is open, until when, from which ranges and how often it was used.

Weik.io records each use of a window in the audit log.

networks#

When the hub’s allowed networks leave out your address, change the list with the networks verbs. weikio-backend networks add RANGE... adds address ranges to the hub’s allowed networks. weikio-backend networks clear removes the list. Every address can then reach the hub.

secrets rotate#

  1. Run weikio-backend secrets rotate --new-key-file <path> on one server. It seals every secret and signing key again under the new master key.
  2. Put the new key where WEIKIO_MASTER_KEY_FILE points on every backend server.
  3. Restart the backends one at a time.

Keep the old key for the backups taken before the rotation, because they open only with it.

upgrade and upgrade.sh#

init writes upgrade.sh beside every stack. To upgrade the hub, run it as root in the stack’s folder with the release’s images.env:

Terminal
$ sudo sh ./upgrade.sh https://weik.io/downloads/releases/2026.2.4/images.env
  1. upgrade.sh backs up the hub.
  2. It runs the new release’s weikio-backend upgrade to write the stack’s files again for the release and keep the previous ones.
  3. It brings the stack up.
  4. It checks that the message server and the backend are up.
  5. It runs doctor.

On a hub of several servers, upgrade.sh runs on one server at a time. Each server leaves the load balancer’s pool before its services restart.

upgrade.sh and weikio-backend upgrade also check an upgrade or roll one back:

Command What it does
upgrade.sh --check Shows what the upgrade would change.
upgrade.sh --rollback Goes back to the previous release when the rollback check finds nothing. Otherwise it prints what the check found and changes nothing unless you add --yes.
weikio-backend upgrade --describe FROM TO Lists the upgrade steps between two releases.
weikio-backend upgrade --check-rollback FROM --env FILE Says what going back to release FROM would erase from the log, metric and trace stores. It lists each identity provider that would stop signing people in and the commands that fix it on FROM. Going back writes platform secret names into the settings of some DNS connections and certificate authorities. The check lists each of those connections and authorities.

Even with --yes, a rollback never moves the message server back to an earlier minor version. Restore the backup the upgrade took instead.

raise-budget and raise-budget.sh#

Once the storage disk has grown, raise-budget.sh raises the storage budget while the hub runs. Run it as root in the stack’s folder:

Terminal
$ sudo sh ./raise-budget.sh 80GiB
You see
Server 1 raised to 80 GiB. The hub's storage is 80 GiB.

The script only raises a budget, up to 80 % of the disk. For a larger size, it changes nothing and prints the largest budget the disk can take. On a hub of several servers, run it on each data server, because the hub’s storage follows the smallest budget among them.

Sign in to the live demo

Sign in with the shared viewer account. It can open every screen of the example projects but can't change anything.

E-mail
viewer@demo.weik.io
Password
try-weikio-live-demo
Open the live demo