Skip to content

Hotel install end to end

This guide assumes you know nothing about this setup yet. It starts with the basics, then tours the repo, then follows one hotel through installation, the running system, updates and maintenance. At every step it says what runs, which values it creates, where they're stored, and what happens next.

Part What it covers
0 The basics: what we're building, and every building block explained in plain words
0R A tour of the repo: what every folder and file is for
A Before handover: what's in the repo, and what you send outside it
B Installation on the hotel's machine, step by step
C After install: check-ins, backups, updates, restore
D Three values traced through their whole journey
E Maintenance: routine checks, and what to do when something breaks
F Updating, case by case: new versions, config, features, per-hotel settings, secrets, licenses, backups
G Things to know (limits and rules)
H A simpler install: options for later

The checklist with the commands you run: devops-handover.md. Every variable: site-variables.md.

Where things live (these marks are used throughout)

Mark Meaning
[repo] In the git repo: the same for every hotel
[sent] Sent to the installer outside the repo (private chat)
[machine] A file on the hotel's machine
[secret] A Kubernetes Secret in the hotel's cluster
[Castis] Castis side: coreapi (edge API), GitLab, Headscale, storage

Example used throughout: Ariyana Resort & Spa → https://ariyana.castis.io, following the stable branch.


Part 0 — The basics

0.1 What we're building

Every hotel gets one server in its own building, running all of TellyBoard: the backend, the logins, the media storage, and the web apps staff use. - Staff open https://ariyana.castis.io on the hotel's network, and get a real HTTPS padlock. - The hotel keeps working if its internet goes down, because everything runs locally. - Castis manages every hotel from one place: updates, licenses, backups and support, without logging in to each server for routine work.

0.2 The building blocks, in plain words

Piece What it is Why we need it
Host + VM The physical machine (a Mac mini) runs VirtualBox; the "server" is a Debian VM inside it Both must start by themselves after a power cut (Prepare a VM, Mac host and power-cut tests)
Debian 13 The operating system on the server (the VM) Everything runs on top of it
Container / image A packaged app (coreapi, authapi, Postgres…). An image is the package; a container is it running Every service ships the same way, and runs the same everywhere
Nexus (registry.nexus.castis.io) Castis's store of images The server downloads each service from here
k3s (Kubernetes) The manager that runs all the containers, restarts them if they crash, and connects them So the ~20 services run and heal themselves on one machine
Namespace A folder in k3s grouping related things (db, production, zitadel, argocd, …) Keeps components apart
Pod / Deployment / StatefulSet A running container / "keep N copies of this app running" / the same, for apps with data (Postgres) How k3s knows what to run
Volume (PVC) A disk area that survives restarts Where Postgres and the media are kept
ConfigMap / Secret Settings handed to an app. A Secret is for passwords and keys How each app gets its URLs and passwords
APISIX The front door: takes every HTTPS request on port 443 and sends it on by name (api.ariyana… → coreapi, id.ariyana… → authapi, …) One entrance for all apps
Certificate, cert-manager, Let's Encrypt Let's Encrypt gives out free, trusted certificates; cert-manager asks for them and renews them by itself every ~60 days So browsers show a padlock, not a warning
acme-dns Proves to Let's Encrypt that the hotel may use ariyana.castis.io, without giving the hotel Castis's DNS password (the Cloudflare token) Security: each hotel can only prove its own name
CoreDNS (lan-coredns) The server's own phone book: when a staff phone asks "where is ariyana.castis.io?", it answers with the server's LAN IP The address only exists on the hotel's network
git / GitLab / branch The repo stores the setup as files; a branch (main, canary, stable) is a version line Every hotel follows one branch, and gets updates from it
Argo CD A robot on each server that reads the branch from GitLab and makes the server match it, then keeps it matching Updates arrive by merging in git, with no manual work on servers
Placeholder + render.sh The files in git have blanks like ${IBC_PG_PASSWORD}; render.sh fills them in with this hotel's values just before Argo CD applies them One repo works for every hotel
site.env The file (and its copy in the Secret ibc-site) holding one hotel's values: domain, passwords, license… What makes a server this hotel
Setup wizard A web page on the server at port 8800, used once, during installation The owner names the company, picks the address, and the install finishes by itself
coreapi edge API The Castis-side API (part of coreapi) that approves hotels and hands out their certificate access, license and backup target Castis stays in control of who runs TellyBoard
Approval The moment Castis confirms a new hotel is a real customer Only then does the hotel get certificate access and a license
Check-in Every hour the hotel tells Castis "I'm alive, here's my health", and picks up anything new (e.g. a renewed license) Monitoring, and renewals with no one logging in
Backup (restic) Every night an encrypted copy of the data goes to Castis's storage (switched off for now) A broken server doesn't mean a lost hotel
Tailscale / Headscale A private tunnel from Castis to each server Your team can SSH in for support, with no public IP at the hotel

0.3 The three places information lives

Place Holds Example
[repo] The git repo (same for all hotels) How a hotel is built: templates with blanks, scripts, app versions, shared defaults POSTGRES_PASSWORD: "${IBC_PG_PASSWORD}"
[machine][secret] The hotel's server Which hotel it is: its own values, generated or received during install IBC_PG_PASSWORD='<PG_PASSWORD>'
[Castis] Castis (coreapi, GitLab, Headscale, storage) The list of hotels, approvals, licenses, check-ins, backups "Ariyana: approved, license expires 2027-10-01, last seen 5 min ago"

Golden rule: git never holds a hotel's passwords or secrets. Adding a hotel needs no change in git.

0.4 How a value is chosen

Argo CD runs gitops/render.sh on each hotel, which fills the templates' placeholders in this order (later wins):

# Source Scope In git? Typical content
1 setup-agent/defaults.env All hotels Yes Parent domain, edge API URL, shared service settings (e.g. IBC_ALLOWED_REDIRECT_URIS)
2 sites/<hotel>/site.env One hotel Yes Non-secret exceptions (feature on for the pilot hotel)
3 [secret] argocd/ibc-site (a copy of the machine's /etc/ibc/site.env made at install) One hotel No Domain, org, owner, generated passwords, acme-dns login, license
— ${IBC_GEN_<NAME>} One hotel No, nothing stored New secrets, derived from the hotel's master key

Every variable, its source and its kind: site-variables.md.

Consequence: a change to 1 or 2 is a git change, and it reaches the hotels by itself. Only 3 lives on a machine. The wizard writes it at install; after that the check-in agent keeps the Secret up to date with what the edge API sends. Changing it by hand is rare (devops-handover.md → Change a value that lives on the machine).


Part 0R — A tour of the repo

ibc-iac/
├── install.sh            ← run once on a new server: installs the base system and starts the wizard
├── prerequisite.sh       ← called by install.sh (base: k3s, APISIX, cert-manager)
│                            and by the wizard (site: certificate + local DNS)
├── restore.sh            ← rebuilds a hotel as itself from its backup, on a new server
├── reset.sh              ← wipes a server back to clean
├── scripts/show-secrets.sh       ← prints the site's passwords and keys with plain labels
├── versions.env          ← every pinned base version (k3s, Helm, charts) + every image Nexus must hold
├── host/macos/setup-host.sh ← run ONCE on the Mac mini host: survive power cuts, start the VM at boot
│
├── setup-agent/          ← the setup WIZARD (install-time only)
│   ├── agent.py          ←   the wizard's server: pages, install steps, talks to the edge API
│   ├── index.html        ←   the pages the owner sees
│   ├── cloud.py          ←   calls to the Castis edge API (registration, approval)
│   ├── defaults.env      ←   shared values for ALL hotels (parent domain, edge API URL, …)
│   └── dev/mock_edge_api.py ← a fake edge API for testing before coreapi has one
│
├── gitops/               ← everything Argo CD uses
│   ├── argocd/           ←   how Argo CD itself is installed (plus the render plugin);
│   │                            upstream/ holds Argo CD's official install file, copied unchanged
│   ├── root/             ←   the ONE app the wizard creates; it points at apps/
│   ├── apps/             ←   one file per component, with its deploy order (sync wave)
│   ├── components/       ←   extra pieces that aren't plain app files:
│   │   ├── site-base/    ←     namespaces, storage class, registry login per namespace
│   │   ├── postgres/     ←     Postgres + "create the databases" job
│   │   ├── seaweedfs/    ←     SeaweedFS + "create the bucket" job
│   │   ├── zitadel/      ←     Zitadel + copying its service token for authapi
│   │   ├── authapi/      ←     authapi + reading that token
│   │   ├── ibc-agent/    ←     the hourly check-in (temporary, until coreapi does it)
│   │   └── backup/       ←     the nightly backup (switched off for now)
│   └── render.sh         ←   fills the blanks with one hotel's values
│
├── infrastructure/       ← app files for the supporting services (Postgres, SeaweedFS,
│                            Zitadel, tusd, Valkey, NATS, VerneMQ)
├── application/          ← app files for the TellyBoard services (authapi, coreapi, the frontends)
│                            overlays/kustomization.yaml holds each app's VERSION (newTag)
├── cdn/                  ← cproxy and streamer
├── apisix/               ← APISIX settings (apisix-values.yaml) and the routes (private/route/)
├── cert-manager/         ← cert-manager install files, the ClusterIssuer, the Certificate
├── coredns/              ← the local "phone book" (lan-coredns)
├── registry-secret.yml   ← the Nexus login every namespace gets
├── sites/                ← optional per-hotel settings (sites/<hotel>/site.env), non-secret only
│
├── *.md                  ← the docs (see README.md for the reading order)
└── archive/              ← OLD, unused. Ignore it

What you edit during normal work:

You want to Edit
Release a new version of an app application/<app>/overlays/kustomization.yaml → newTag
Change a setting for all hotels The app's config file in application/, infrastructure/ or cdn/; or setup-agent/defaults.env
Change a setting for one hotel sites/<hotel>/site.env
Add a new variable Template + defaults.env + a row in site-variables.md

Everything else changes rarely.


Part A — Before handover

A1. What's in the repo (prepared once, for all hotels)

What File You fill / check
Nexus image pull login registry-secret.yml Already set, same for all hotels: the pull-only user regis-read
Pinned base versions, and every image Nexus must hold versions.env When you bump a version: update it, and copy the new images into Nexus
Nexus Helm repo login (APISIX and cert-manager charts) prerequisite.sh (NEXUS_HELM_USER / NEXUS_HELM_PASS) Already set. Warning: Not a pull-only user yet (E6)
Parent domain setup-agent/defaults.env → IBC_PARENT_DOMAIN e.g. castis.io
Edge API URL (coreapi) setup-agent/defaults.env → IBC_CLOUD_URL Warning: Empty until coreapi has the edge API
acme-dns API URL setup-agent/defaults.env → IBC_ACMEDNS_HOST e.g. https://acme.castis.io
Shared service settings setup-agent/defaults.env → IBC_ALLOWED_REDIRECT_URIS, IBC_CDN_ORIGIN_HOST Check
Let's Encrypt contact email cert-manager/02-clusterissuer.yaml → email Team email
App versions application/*/overlays/kustomization.yaml → newTag Tested tags
Per-hotel non-secret overrides sites/<hotel>/site.env Usually none
Every template, script and Argo CD app Everything else outside archive/ Nothing: the placeholders (${IBC_…}, your-domain.example.com) stay as they are

Never in the repo: any hotel's passwords, domain, license, acme-dns login, backup login, the Cloudflare token, the Headscale API key.

A2. What you send outside the repo (per install)

# What Where you get it Used at
1 Git username + deploy token (read-only) GitLab → Settings → Repository → Deploy tokens (made once) git clone, and install.sh step B1.2
2 Headscale pre-auth key (one-time, 24 h) headscale preauthkeys create --user sites --expiration 24h install.sh step B1.3
3 Install commands Message template in devops-handover.md 2.2 —
4 Server requirements: a Mac mini host with VirtualBox (FileVault off, Ethernet, fixed LAN IP, ideally a UPS) and a Debian 13 VM with a bridged network; outbound HTTPS Prepare a VM Before starting
5 Approval token (24 h, 3 uses). Not built yet: the Console and edge API don't exist, so use the mock for tests Playtelly Console → approval tokens (devops-handover.md 2.4) Wizard step B3.2

A3. Must exist on the Castis side

What Needed at Status
Branch pushed to GitLab (stable) B0, and Argo CD at B3.4 You
coreapi edge API (IBC_CLOUD_URL) B2.2 (address check), B3.2 (approval) Warning: To be built (edge-api.md)
acme-dns server: zone acme-dns.castis.io, API acme.castis.io (playtelly-iac/acme-dns/) B3.3 (certificate) Running
Backup storage C2 (nightly backup) Warning: To be decided; the backup is switched off until then

A4. The order credentials arrive in

Nothing can start without credentials, and they arrive in a fixed order. No application is deployed until the approval step has delivered the last ones: the wizard runs save → approval → certificate → Argo CD, in that order.

 BEFORE install.sh        DURING install.sh      WIZARD "Install"       APPROVAL (Castis)         THEN
 ─────────────────        ─────────────────      ────────────────       ─────────────────         ────
 ① git deploy token  ─┐   ④ setup code           ⑤ all site             ⑥ acme-dns account  ──►  certificate
 ② Nexus pull login  ─┼─► (generated)       ──►    passwords       ──►    + license bundle   ──►  Argo CD deploys
 ③ Headscale key     ─┘                            (generated)            (from coreapi)          all 21 apps
# Credential Needed for Comes from Must exist before
① Git deploy token (read-only) git clone, and Argo CD pulling updates Castis creates it once in GitLab; sent in the handover message install.sh
② Nexus pull login Every image, starting with APISIX in install.sh Already in the repo (registry-secret.yml, prerequisite.sh), the same for all hotels install.sh (nothing to do per hotel)
③ Headscale key (one-time) Remote support by Castis. Optional: skip works Castis creates one per install; sent in the handover message install.sh
④ Setup code Opening the wizard install.sh generates it The wizard
⑤ Site passwords and keys (Postgres, Zitadel, S3, …) Every service The wizard generates them when the owner presses Install Approval
⑥ acme-dns account + license bundle The HTTPS certificate; authapi's license coreapi's edge API, when the installer enters Castis's approval token The certificate and Argo CD's deploy
— Cloudflare token Creating the site's challenge CNAME Castis side only (coreapi); never on the hotel —

So for a new hotel, Castis prepares ① (once, for all hotels), ③ and an approval token (per install) beforehand; ② is already in the repo. ④ and ⑤ are created on the machine. ⑥ arrives when the installer enters the approval token.

A5. What the hotel's server must reach (outbound HTTPS only)

Every image comes from your Nexus: k3s pulls public-named images through it (/etc/rancher/k3s/registries.yaml). One catch: if a public-named image is missing from Nexus, k3s quietly pulls it from its public registry (docker.io, quay.io, ghcr.io, public.ecr.aws), so keep the versions.env list complete. What's left is:

Host For When
deb.debian.org (and the Debian security mirror) apt packages Install
mashup.castis.io git: clone, and Argo CD pulling updates Install, then always
registry.nexus.castis.io, nexus.castis.io Every image; the APISIX and cert-manager Helm charts Install, then always
get.k3s.io, github.com The k3s installer and binary (pinned version) Install
raw.githubusercontent.com, get.helm.sh The Helm installer and binary (pinned version) Install
tailscale.com, pkgs.tailscale.com, headscale.castis.io Tailscale, and the tailnet Install, then always
The edge API (IBC_CLOUD_URL) Registration, approval, check-ins Install, then hourly
acme-v02.api.letsencrypt.org, the acme-dns API (IBC_ACMEDNS_HOST) The certificate, and its renewal Install, then every ~60 days
The backup storage (IBC_BACKUP_REPOSITORY) Nightly backup (switched off for now) Nightly

No inbound ports are needed.


Part B — On the hotel's machine

B0. Clone the repo

git clone -b stable https://mashup.castis.io/playtelly/ibc-iac.git
cd ibc-iac

Produces Where Next
A copy of the repo, on branch stable [machine] ~/ibc-iac install.sh reads the repo URL and branch from this checkout

B1. ./install.sh: the base install (5–10 minutes)

Step What happens Asks Values created → stored in Next
B1.1 Reads the repo's remote URL (credentials stripped) and the current branch — GIT_URL = https://mashup.castis.io/playtelly/ibc-iac.git, GIT_REVISION = stable → in memory (saved at B1.8) —
B1.2 Asks for git credentials and tests them with git ls-remote [sent] Git username + token In memory (saved at B1.7) Stops here if they're wrong, or if the branch isn't pushed
B1.3 Installs Tailscale if missing; joins Headscale with --accept-dns=false as ibc-<hostname> [sent] Headscale key (or skip) [Castis] A node in Headscale; a tailnet IP on the machine. The key is now spent Your team can SSH to it from now on
B1.4 apt install python3 curl git openssl — — —
B1.5 prerequisite.sh base phase (PREREQ_PHASE=base), in 8 sub-steps (Steps 0–6):
· Step 0 Installs curl, git, python3 and openssh-server; enables SSH sudo password (once) —
· Step 0b Makes the VM an always-on server: no sleep/suspend/hibernate, clock sync, logs kept across reboots, security updates without automatic reboots, watchdog if present — Config drop-ins under [machine] /etc/systemd/, [machine] /etc/apt/apt.conf.d/
· Step 1 Points k3s at Nexus for every image, installs k3s (get.k3s.io, pinned), disables Traefik, copies the kubeconfig — [machine] /etc/rancher/k3s/registries.yaml (mirrors + the regis-read login, root-only), [machine] /etc/rancher/k3s/k3s.yaml, [machine] ~/.kube/config kubectl works
· Step 2 Installs Helm — —
· Step 3 Adds the Nexus Helm repo (logins from prerequisite.sh); applies registry-secret.yml; installs APISIX + ingress controller (apisix/apisix-values.yaml, chart pinned) — [secret] ingress-apisix/nexus-registry-secret APISIX listens on ports 80/443. The gateway Service uses externalTrafficPolicy: Local so backends see the phone's real LAN IP, not <POD_NETWORK_GATEWAY_IP> (single-node k3s only; on a multi-node cluster use Cluster or run APISIX on every node)
· Step 4 Creates the IngressClass and GatewayProxy that wire routes to APISIX — (a temp file in /tmp, removed after)
· Step 5 Creates a test route, checks it end to end, then deletes it — — Prints TEST PASSED / FAILED
· Step 6 Installs cert-manager (cert-manager/cert-manager-crds.yaml + values, pinned) — — Ready to issue certificates later (B3.3)
· stop Exits: Steps 7–8 need the domain, which doesn't exist yet — — Back to install.sh
B1.6 Installs Argo CD (kubectl apply --server-side --force-conflicts -k gitops/argocd; server-side because the ApplicationSet CRD is too big for a plain apply): upstream install + the ibc-render plugin sidecar + the health rule for apps — Namespace argocd. The sidecar will mount [secret] argocd/ibc-site, which doesn't exist yet (it's optional) Argo CD runs with no apps
B1.7 Saves the git credentials for Argo CD — [secret] argocd/ibc-repo (url, username, password = the deploy token) Argo CD can pull the branch
B1.8 Starts the site file — [machine] /etc/ibc/site.env: IBC_GIT_URL, IBC_GIT_REVISION, IBC_REGISTRY_DOCKERCONFIG_B64 (read from registry-secret.yml) —
B1.9 Creates the setup code — [machine] /etc/ibc/setup-code (6 random digits, root-only) —
B1.10 Installs and starts the setup wizard service ibc-setup (setup-agent/agent.py, runs as root, port 8800) — [machine] /etc/systemd/system/ibc-setup.service Wizard is reachable
B1.11 Prints the result — — The wizard address (http://<SITE_LAN_IP>:8800), the setup code (<SETUP_CODE>) and, for Castis, the tailnet IP (<SITE_TAILNET_IP>)

State after B1: k3s, APISIX, cert-manager and Argo CD (idle) are running. site.env has 3 values. Nothing hotel-specific exists yet.

B2. The wizard, in the browser (a few minutes)

At http://<server IP>:8800, from any device on the hotel network:

Step Page They enter Values created → stored in (at Install) Next
B2.1 Setup code The 6 digits — (checked against [machine] /etc/ibc/setup-code on every request) Unlocks the pages
B2.2 Company → address Ariyana Resort & Spa; the prefix ariyana is suggested. The wizard asks [Castis] GET /v1/edge/subdomains/ariyana whether it's free IBC_ORG_NAME, IBC_SITE_NAME = ariyana, IBC_DOMAIN = ariyana + . + IBC_PARENT_DOMAIN —
B2.3 Owner owner@example.com; the admin password, typed twice; how devices reach the server (empty, except on a VM behind NAT: the host's LAN IP, Install on your own server); optional certificate email IBC_OWNER_EMAIL, IBC_ADMIN_USERNAME (= owner email), IBC_ANSWER_IP (auto or an IP), IBC_ACME_EMAIL —
B2.4 Review → Install — Generated, random: IBC_PG_PASSWORD, IBC_ZITADEL_MASTERKEY (32 chars), IBC_ZITADEL_DB_PASSWORD, IBC_S3_ACCESS_KEY, IBC_S3_SECRET_KEY, IBC_VALKEY_PASSWORD, IBC_AUTHAPI_PSK, IBC_JWT_ACCESS_SECRET, IBC_JWT_REFRESH_SECRET, IBC_COREAPI_ENCRYPTION_KEY, IBC_MQTT_USER, IBC_MQTT_PASSWORD, IBC_MQTT_WEBOS_USER, IBC_MQTT_WEBOS_PASSWORD, IBC_SITE_MASTER_KEY, IBC_INSTALL_SECRET. Chosen by the owner (Owner step, typed twice): IBC_ADMIN_PASSWORD Everything is written to [machine] /etc/ibc/site.env (only values that differ from defaults.env). The install job starts (B3)

B3. The install job (the wizard's progress list, 10–20 minutes)

Step Page shows What happens Values → stored in Next
B3.1 Save site settings Copies the whole site file into the cluster; restarts argocd-repo-server so its render plugin sees the file [secret] argocd/ibc-site (key site.env, mounted into the plugin as /etc/ibc/site.env) —
B3.2 Approval by Castis ① POST /v1/edge/registrations (company, address, owner, installSecret) → registration id.
② "Waiting for approval": polls GET /v1/edge/registrations/{id} every 15 s with Bearer installSecret.
③ The installer enters the [Castis] approval token you sent; the wizard sends it with POST /v1/edge/registrations/{id}/approval-token, and coreapi approves on the spot: it creates the acme-dns account + the CNAME _acme-challenge.ariyana.castis.io, and issues the license bundle.
④ The wizard polls again at once, and the answer returns them
Registration id → [machine] /etc/ibc/setup-state.json.
On approval → [machine] site.env + [secret] ibc-site: IBC_ACMEDNS_ACCOUNT_B64, IBC_LICENSE_KEY, IBC_LICENSE_PUBLIC_KEY, IBC_LICENSE_PRIVATE_KEY, IBC_COMPANY_CODE (read from the license), IBC_REGISTRATION_ID, IBC_LICENSE_VERSION, IBC_ACMEDNS_VERSION
Rejected or revoked → reason shown, Retry registers again
B3.3 Certificate and local DNS prerequisite.sh site phase, with DNS_ZONE=IBC_DOMAIN, ANSWER_IP, ACME_EMAIL, ACME_STAGING, ACMEDNS_HOST, ACMEDNS_ACCOUNT_JSON in the environment:
· 7.1 Saves this hotel's acme-dns login for cert-manager [secret] cert-manager/acme-dns-account (acmedns.json)
· 7.2 ClusterIssuer letsencrypt-prod (02-clusterissuer.yaml, rendered with the domain, email and acme-dns URL) —
· 7.3 Certificate for ariyana.castis.io + *.ariyana.castis.io. cert-manager writes the challenge TXT through acme-dns, and Let's Encrypt follows the CNAME. Waits until issued [secret] ingress-apisix/hotel-castis-io-tls-secret (the certificate)
· 7.4 ApisixTls: APISIX serves HTTPS with it —
· 8.1–8.8 Local DNS: detects the node IP; runs CoreDNS lan-coredns (host network, port 53) answering ariyana.castis.io + *. and playtelly.internal with ANSWER_IP; points the node's own resolver at it; wires k3s's cluster DNS to it too ConfigMap kube-system/lan-coredns-corefile (rendered Corefile) Staff devices can resolve the address once the router uses the server as DNS (B3.6)
B3.4 Hand over to Argo CD Renders gitops/root (fills repoURL / targetRevision from the site file) and applies it Application argocd/ibc-root Argo CD takes over
B3.5 Deploy all components Argo CD pulls stable (with [secret] ibc-repo), renders gitops/apps → 21 apps, then deploys them wave by wave (table below). For each component, render.sh fills the placeholders from defaults.env → sites/ariyana/ (if any) → the site file, and stamps workloads with a config hash See the wave table The wizard counts apps until all are Synced + Healthy
B3.6 Check the address Calls https://ariyana.castis.io, id.… and api.… through APISIX; tells [Castis] POST …/ready, so coreapi emails the owner [machine] setup-state.json: status = done Finish page: URL and user ID (the password is the one the owner chose), and "set the server as DNS in the router"

The Argo CD waves in B3.5: what each one creates, and which values it uses:

Wave App(s) Creates Filled from the site's values
-5 site-base StorageClass local-path-retain, namespaces, [secret] nexus-registry-secret in each IBC_REGISTRY_DOCKERCONFIG_B64
-4 postgres Postgres (20 Gi volume); hook: creates databases authapi, coreapi, dummy IBC_PG_PASSWORD (set on first start only)
-3 zitadel Zitadel. First start: creates its database, the org IBC_ORG_NAME, the admin IBC_ADMIN_USERNAME / IBC_ADMIN_PASSWORD, and a service token. Sidecar: copies the token into [secret] production/zitadel-pat; a hook waits for it IBC_ZITADEL_MASTERKEY, IBC_ZITADEL_DB_PASSWORD, IBC_PG_PASSWORD, org and admin
-3 seaweedfs SeaweedFS (media, 20 Gi); hook: creates bucket playtelly IBC_S3_ACCESS_KEY / _SECRET_KEY
-3 valkey, nats, vernemq Cache, messaging, MQTT IBC_VALKEY_PASSWORD
-2 tusd, cproxy, streamer Uploads, CDN proxy, streamer S3 keys, IBC_DOMAIN, IBC_CDN_ORIGIN_HOST
-1 mediasoup mediasoup (host network, UDP 40000-40100; CoreAPI calls its control API in-cluster) IBC_SERVER_IP (the address in its WebRTC candidates)
-1 authapi authapi, reading the token from zitadel-pat Domain (cookie, CORS, frontend URL), IBC_PG_PASSWORD, JWT secrets, IBC_AUTHAPI_PSK, org, admin, the license bundle, IBC_ALLOWED_REDIRECT_URIS
0 coreapi coreapi Domain URLs, IBC_PG_PASSWORD, S3 keys, IBC_AUTHAPI_PSK, IBC_VALKEY_PASSWORD, IBC_COREAPI_ENCRYPTION_KEY, IBC_ALLOWED_REDIRECT_URIS
1 orgconsole, playoutadmin, tellyboardadmin, tellyid, playtellyinternal, conciergeguestapp The frontends and internal services Domain URLs: playtellyinternal, and the browser-side VITE_* keys the frontends read at container start (window.__ENV__). Everything else is in-cluster URLs
2 routes Every ApisixRoute: ariyana.castis.io, id., api., guest., cproxy., streamer., playtelly.internal IBC_DOMAIN
3 ibc-agent Hourly check-in CronJob (C1) IBC_CLOUD_URL
3 backup Nightly backup CronJob (C2). Switched off for now (not deployed) IBC_BACKUP_*, IBC_PG_PASSWORD, IBC_SITE_NAME

B4. Finish

Who What Result
Hotel IT Sets the server's IP as the DNS server in the router's DHCP settings Staff devices resolve ariyana.castis.io → the server
Owner Signs in at https://ariyana.castis.io with the user ID and the password they chose; then clicks close setup The wizard stops and removes its ibc-setup service (also automatic after 24 h); port 8800 closes
Hotel IT / you On the Mac mini: sudo host/macos/setup-host.sh "<VM name>", then the reboot and power-cable tests (Prepare a VM, Mac host and power-cut tests) The Mac and the VM come back by themselves after a power cut
You Rename the Headscale node (site-ariyana); check the apps over the tailnet; set the backup target once backups are switched on (devops-handover.md 2.6); fill in the site register —

B5. Everything that now exists, and where

Thing Where
The hotel's values (live copy) [secret] argocd/ibc-site. After install this is the one that's kept up to date
The hotel's values (install-time copy) [machine] /etc/ibc/site.env
Git access for Argo CD [secret] argocd/ibc-repo
Certificate access [secret] cert-manager/acme-dns-account
The certificate [secret] ingress-apisix/hotel-castis-io-tls-secret (renewed automatically every ~60 days)
Zitadel's service token [secret] production/zitadel-pat
Data Volumes: Postgres, SeaweedFS (and NATS, VerneMQ, Valkey, streamer)
Wizard state [machine] /etc/ibc/setup-state.json (done), [machine] /etc/ibc/setup-code, log [machine] /var/log/ibc-setup.log
The hotel's record [Castis] coreapi: registration, license, acme-dns account, check-ins
Remote access [Castis] Headscale node site-ariyana

Part C — After install, forever

C1. Hourly check-in

Not built yet

The edge API and the Playtelly Console screens it needs (approval tokens, license renewals, revoking a site) do not exist in coreapi yet. See Edge API. Until they do, a real install stops at Waiting for approval. For a test install, use the mock edge API in step 2.4.

The ibc-agent CronJob does this, as its own component next to coreapi (edge-api.md).

Step What happens Values → stored in
1 Reads the hotel's values From [secret] argocd/ibc-site
2 Reports to [Castis] POST /v1/edge/sites/{id}/checkin (Bearer installSecret): channel, synced commit, app health, license version + expiry, backup version + last success [Castis] coreapi records it
3 If coreapi answers with a newer license / acme-dns account / backup target, applies it [secret] argocd/ibc-site (and [secret] cert-manager/acme-dns-account)
4 Restarts argocd-repo-server and hard-refreshes the apps → render.sh renders the new values → the config-hash stamp changes → only the affected pods restart (e.g. authapi for a new license) —
5 Records the result ConfigMap argocd/ibc-agent-status

C2. Nightly backup, 02:30

Paused: Switched off for now (not in gitops/apps/kustomization.yaml) until Castis decides where hotel backups are stored. The component stays in gitops/components/backup/; to switch it on, uncomment - backup.yaml in gitops/apps/kustomization.yaml.

Step Container What happens Output
1 dump-postgres pg_dumpall of the whole Postgres /work/postgres.sql
2 export-secrets Copies [secret] argocd/ibc-site and [secret] production/zitadel-pat /work/*.json
3 restic Encrypted, incremental backup of /work + the SeaweedFS volume to IBC_BACKUP_REPOSITORY; keeps 7 daily / 4 weekly / 6 monthly [Castis] Backup storage

Skipped (with a log line) while IBC_BACKUP_REPOSITORY is empty.

C3. An update through git

Step What happens
1 You merge a change into stable (via main → canary)
2 Argo CD on the hotel sees it within about 3 minutes and pulls it
3 render.sh fills in the same values (defaults → sites/ → the hotel's own)
4 Argo CD applies the difference. Pods whose image or config changed restart

Nothing happens on the machine by hand. Details per kind of change: Part F.

C4. Restore onto a new machine

./install.sh (B1), then ./restore.sh instead of the wizard: 1. Download the backup. 2. Put back the hotel's values: its passwords, license and acme-dns login, with this machine's branch and registry login. 3. Certificate and local DNS (as B3.3). 4. Postgres, and load the dump. 5. The SeaweedFS volume, filled with its data. 6. Zitadel's token. 7. Hand over to Argo CD (as B3.4).

No wizard and no approval: the hotel comes back as the same registration. Procedure: devops-handover.md Part 5.


Part D — Three values, their whole journey

IBC_PG_PASSWORD 1. B2.4: generated by the wizard → [machine] site.env. 2. B3.1: copied into [secret] argocd/ibc-site. 3. B3.5: render.sh puts it into postgres, zitadel, authapi and coreapi's Secrets/ConfigMaps. Postgres stores it on first start. 4. C2: it's inside the backup. 5. C4: restored with the rest.

IBC_DOMAIN (ariyana.castis.io) 1. B2.2: built from the prefix + IBC_PARENT_DOMAIN. 2. B3.2: registered with coreapi. 3. B3.3: used for the certificate and the local DNS. 4. B3.5: replaces every your-domain.example.com in the templates (routes, URLs, cookie domain). 5. Locked from then on.

The license 1. B3.2: issued by coreapi on approval → IBC_LICENSE_* in [secret] ibc-site. 2. B3.5: render.sh puts it into authapi. 3. C1: 15 days before expiry, coreapi renews it (automatically, or once you approve). The next check-in brings version 2 → ibc-site → re-render → authapi restarts with it.


Part E — Maintenance

E1. What runs by itself (nothing to do)

What When Where to look if you're curious
After a power cut: the Mac mini powers on, its LaunchDaemon starts the VM, k3s starts every app Automatically, a few minutes after power returns On the Mac: sudo host/macos/setup-host.sh --status
Argo CD keeps the hotel matching its branch; puts back manual changes Continuously; new commits within ~3 min kubectl -n argocd get applications
Certificate renewal ~30 days before expiry (every ~60 days) kubectl get certificate -A
Check-in: health report, license renewals, backup target Every hour kubectl -n argocd get configmap ibc-agent-status -o yaml
Backup Every night at 02:30 (switched off for now) backupLastSuccess in the check-in status above
k3s restarts crashed containers Immediately kubectl get pods -A (RESTARTS column)

E2. Connecting to a hotel's server

Over the tailnet, from your laptop (your Headscale user must be allowed by the ACL):

ssh <user>@<hotel's tailnet IP>

All kubectl commands below run on the hotel's server after that.

E3. A quick health check (2 minutes)

Check Command Healthy looks like
The server kubectl get nodes 1 node, Ready
Every component kubectl -n argocd get applications All Synced + Healthy
Anything not running kubectl get pods -A \| grep -v -E 'Running\|Completed' Only the header line
Certificate kubectl get certificate -A READY True
Check-in and last backup kubectl -n argocd get configmap ibc-agent-status -o yaml Recent lastRun, result: ok…, recent backupLastSuccess (empty while the backup is switched off)
Disk space df -h /var/lib/rancher Well under 80%

E4. When something breaks

Symptom Look Usual cause → fix
An app is Degraded / OutOfSync kubectl -n argocd describe application <app> (conditions at the bottom) A render error names the missing value → add it (site-variables.md). A sync error names the resource
A pod is CrashLoopBackOff kubectl -n <namespace> logs <pod> --previous App error: check its config, or roll back the last version (revert the merge)
A pod is ImagePullBackOff kubectl -n <namespace> describe pod <pod> (Events) The tag doesn't exist in Nexus, or the Nexus login / network is failing
Certificate not Ready kubectl describe certificate -n ingress-apisix, then kubectl describe challenge -A The acme-dns login or the _acme-challenge CNAME is wrong (coreapi side), or outbound HTTPS is blocked
Staff can't open the address, but it works from the server On a phone: which DNS server is it using? The router doesn't hand out the server as DNS, or the server's IP changed: run ./scripts/change-ip.sh on the server, then update the router's DNS setting (devops-handover.md, If the server's IP changes)
Check-in failing (result: check-in failed) kubectl -n argocd logs job/<latest ibc-agent job> IBC_CLOUD_URL is wrong, outbound HTTPS is blocked, or coreapi is down
Backup failing, or backupLastSuccess is old kubectl -n seaweedfs logs job/<latest ibc-backup job> -c restic Wrong backup login or password, the storage is unreachable, or no target is set
Site down after a power cut or reboot On the Mac: sudo host/macos/setup-host.sh --status; the log /usr/local/var/log/ibc-vm.log The Mac didn't power on (check pmset -g: autorestart 1), it's waiting at the FileVault screen, or the maintenance flag is set. Inside the VM: journalctl -b -1 shows the previous boot
The whole server is dead — New machine: ./install.sh, then ./restore.sh (devops-handover.md Part 5)

Run a CronJob right away instead of waiting (new job name each time):

kubectl -n argocd create job --from=cronjob/ibc-agent agent-now
kubectl -n seaweedfs create job --from=cronjob/ibc-backup backup-now   # only once the backup is switched on

E5. Changing things

Change How Detail
New app version, config, feature Merge into the branch (via main → canary → stable) Part F
One hotel's setting sites/<hotel>/site.env in git site overrides
A value that lives on the machine (rare) Edit the Secret argocd/ibc-site devops-handover.md → Change a value that lives on the machine
License renewal Automatic, or approve it in the Console Part C1
Removing a hotel Delete its Headscale node; revoke it in the Console; ./reset.sh if the machine is reused devops-handover.md Part 4

E6. Not covered yet, and open follow-ups

Before the first real hotel: - Push the branch. Argo CD pulls from GitLab. - Change the old Nexus login's password. Hotels now use the pull-only regis-read, but the previous login (which could push) is in the git history. Also consider a random password for regis-read. - The installers still download binaries from get.k3s.io / GitHub, get.helm.sh and tailscale.com, at pinned versions (except Tailscale). They could be hosted in a Nexus "raw" repository to remove those too. - Build the edge API in coreapi (edge-api.md → coreapi to-do list), and the backup storage it needs. The acme-dns server it uses is already running. - Give hotels a pull-only Nexus Helm login. Every hotel gets helm with a password kept in prerequisite.sh (NEXUS_HELM_PASS) today (prerequisite.sh Step 3), which may be an upload account. - Enforce Nexus-only pulls once the versions.env list is complete: k3s's disable-default-registry-endpoint stops the quiet fallback to public registries. - Rotate the leaked secrets: the old Cloudflare token and the Zoho secret are in the git history; don't trust licenses signed with the old key pair.

Known gaps, not forgotten: - upgrading the base system (k3s, Argo CD, APISIX, cert-manager) - OS updates that need a reboot (security updates install by themselves, Step 0b, but never reboot) - disk and pod alerts sent to Castis - the server's IP change is a manual step: ./scripts/change-ip.sh, then the router's DNS setting (devops-handover.md); it isn't detected automatically - a rule for database migrations before rollbacks - CoreDNS and the certificate are applied by prerequisite.sh (site phase), not Argo CD


Part F — Updating, case by case

F1. Channels (which hotels get a change, and when)

Each hotel follows one branch, chosen at install (git clone -b <branch>):

Branch Who follows it Purpose
main Lab / test VM Every change lands here first
canary 1 pilot hotel Real-world check, for 1–2 days
stable All other hotels Production

Promoting a change = merging main → canary, then canary → stable. Protect canary and stable in GitLab, so they only change through reviewed MRs.

F2. New version of a service (the most common update)

  1. Service repo: merge the change. Every service (coreapi, authapi, playoutadmin, tellyboardadmin, orgconsole, conciergeguestapp, tellyid, mediasoup, playtellyinternal) releases with a version tag vX.Y.Z: CI promotes the already-signed staging image to registry.nexus.castis.io/playtelly/<service>:prod-vX.Y.Z (mediasoup and playtellyinternal have no staging, so their tag builds and signs that image instead), the same image every environment uses (nothing is rebuilt or copied per customer).
  2. ibc-iac, main: for those services, someone presses deploy:ibc in the tag pipeline (or runs the pipeline on main with DEPLOY_CUSTOMER=ibc and DEPLOY_VERSION=vX.Y.Z), and CI changes one line, newTag: prod-vX.Y.Z in application/<service>/overlays/kustomization.yaml, and pushes it to main (commits like chore(ibc): update coreapi to prod-v0.0.1). To pin a version by hand, make the same one-line change in an MR.
  3. Merge it. The lab VM's Argo CD sees it within about 3 minutes, pulls the image, and rolls the pods. Test there.
  4. Merge main → canary. The pilot hotel updates by itself. Watch it.
  5. Merge canary → stable. Every other hotel updates by itself.
  6. Rollback: revert the merge on that branch. Those hotels go back.

No login to any hotel.

F3. Config change, same for every hotel

Edit the value in the template (e.g. application/coreapi/overlays/configmap.yml), then promote through the channels like F2. The affected pods restart by themselves: render.sh stamps each component's workloads with a hash of their final config, so any change rolls exactly that component's pods and nothing else.

F4. New feature with its own setting

Example (hypothetical, not in the repo): GUEST_CHAT_ENABLED, off everywhere at first.

  1. Code: the app must work, with the feature off, when the setting is false or missing.
  2. One MR to main:
  3. template: GUEST_CHAT_ENABLED: "${IBC_GUEST_CHAT_ENABLED}"
  4. setup-agent/defaults.env: IBC_GUEST_CHAT_ENABLED='false'
  5. the new image tag
  6. a row in site-variables.md
  7. Promote through the channels. Every hotel runs the new code with the feature off, and even hotels installed long ago get the default.
  8. Turn it on for the pilot hotel only: add sites/<pilot>/site.env with IBC_GUEST_CHAT_ENABLED='true', and merge it to the pilot's branch. Only that hotel changes, and its pods restart by themselves.
  9. Turn it on everywhere: change the default in defaults.env to 'true', promote, and delete the pilot's override.

F5. A new secret every hotel needs

Use a derived secret: put ${IBC_GEN_GUEST_CHAT_SECRET} in the template and promote. Each hotel computes its own stable, unique value from its master key. Nothing to store, nothing to do on any hotel. If one hotel must use a specific value instead (e.g. one given by a vendor), set it in that hotel's site.env and it takes priority.

A secret that Castis issues per hotel (like the license) belongs in the edge API instead, next to the acme-dns login and the license bundle. That's a coreapi change.

F6. One hotel permanently different

Add a sites/<hotel>/site.env with only the differing non-secret values (site overrides). It's reviewed and versioned like any other change.

F7. License renewal and check-ins

Every site checks in with the edge API every hour, through the ibc-agent CronJob (deployed by Argo CD), a separate component so coreapi stays simple. It reports health, channel, commit and license expiry, and receives anything newer that coreapi has for it.

  • Renewal is decided in coreapi, per site. With auto, a new license is issued 15 days before expiry if the contract is active. With manual, a renewal request appears in the Console for you to approve.
  • The site picks up the new license within an hour. The agent writes it into Secret argocd/ibc-site, the render plugin re-renders, and the config-hash stamp restarts authapi. Nobody logs in.
  • Castis sees every site (last seen, health, license expiry) from the check-ins. On a site, kubectl -n argocd get configmap ibc-agent-status -o yaml shows the last result.

Timeline, alerts and policy: edge-api.md → Check-in and renewal.

F8. Backups, and restoring a hotel

Paused: Switched off for now (not in gitops/apps/kustomization.yaml) until Castis decides where hotel backups are stored, so nothing below runs yet and restore.sh has no backup to restore from.

Nightly backup (gitops/components/backup/, 02:30): an encrypted, incremental restic copy to the hotel's own backup repository. Retention: 7 daily, 4 weekly, 6 monthly.

Backed up Not backed up (rebuilt or transient)
Postgres (pg_dumpall: authapi, coreapi, Zitadel's users/orgs, dummy for ticketing) NATS JetStream, VerneMQ, Valkey
SeaweedFS volume (uploaded media + its index) The streamer's cache (rebuilt from SeaweedFS via cproxy)
The site's values (Secret ibc-site) and Zitadel's service token Images, and anything in git (re-deployed by Argo CD)

Warning: The app team should confirm the right-hand column really is safe to lose.

  • Where the backup target comes from: the edge API, through the check-in (coreapi creates the per-hotel storage, credentials and encryption password, and keeps them for restores). Until coreapi does, set the four IBC_BACKUP_* values by hand (devops-handover.md 2.6). With no target, backups are off.
  • Is it working? The check-in reports the last successful backup to Castis. On the site: kubectl -n argocd get configmap ibc-agent-status -o yaml (backupLastSuccess).
  • Restoring a hotel on a new machine, as itself (same address, users, media, license):
  • ./install.sh (ignore the wizard it opens).
  • ./restore.sh, with the hotel's address prefix and its four backup values. If the hotel had a fixed answer IP, it asks whether the LAN IP changed.

It puts the data back before anything starts, then hands over to Argo CD. Steps and checks: devops-handover.md Part 5.

F9. What you touch, by case

Change Touch On hotels
New service version newTag in ibc-iac Nothing
Config, same for all The template Nothing (pods restart by themselves)
New setting with a default Template + defaults.env Nothing
One hotel differs sites/<hotel>/site.env Nothing
New per-hotel secret Template with ${IBC_GEN_…} Nothing
New Castis-issued secret coreapi edge API + template Nothing, once coreapi delivers it
Renew a license Nothing (auto), or approve the renewal in the Console (manual) Nothing: arrives at the next check-in
Server died, replace it New machine: ./install.sh, then ./restore.sh The hotel comes back as itself, from last night's backup (once backups are switched on)
A value locked at install (domain, org, admin, Postgres/Zitadel secrets) — Can't be changed in place; plan a reinstall

Part G — Things to know

  • First-start values are locked. Postgres's password, Zitadel's master key, the org and the first admin are read only on first start. Changing them later does nothing, or breaks logins. The wizard locks them for that reason.
  • The machine's own values win. If a key is in the hotel's site.env, a defaults.env or sites/ change for it has no effect there. The wizard writes only values that differ from the defaults, so this only happens on purpose.
  • Deploy order applies at install only. The sync waves order the first install. Later, each component updates independently, so make changes backward compatible, or split dependent changes into two merges.
  • After install, Secret argocd/ibc-site is the hotel's live copy of its values. ibc-agent updates it (e.g. on renewal); /etc/ibc/site.env on the machine is the install-time copy.
  • The repo clone on the hotel's machine isn't updated by Argo CD. It's used by install.sh and the wizard at install time. Everything the running system uses comes from git through Argo CD.
  • Checklist for every MR:
  • Render the changed components locally (walkthrough.md Part 1).
  • Add new variables to site-variables.md.
  • Make sure new settings have a default.
  • Merge to main first.

How the demo's on-prem steps (13–17) map to what's built:

Demo step Now
13 · address availability Edge API GET /v1/edge/subdomains/{name}
14 · verify owner email Not yet (planned in coreapi)
15 · pending approval Wizard waits for the approval token Castis gave the installer
16 · approve → bind acme-dns account + license bundle sent to the site
17 · access email Edge API POST …/ready; the details are also shown on the finish page

Part H — A simpler install: options (proposal, not built)

Today the installer clones the repo, runs ./install.sh, and types three credentials (git username, git token, Headscale key), and later the approval token Castis sends. It works, but it's more than a hotel should need. install.sh stays the engine in every option below; what changes is how it's started and what the installer has to type.

Option What the installer does What Castis does Needs
1. Today git clone … + ./install.sh, types 3 credentials, then enters the approval token Creates the Headscale key and the approval token Nothing more
2. One install code (recommended next) One command, one code: curl -fsSL https://<castis>/ibc-install \| sudo bash -s -- <install-code> Creates the install code in the Console for a known customer (company + address already filled in) Two small edge API endpoints in coreapi (below) + a hosted bootstrap script
3. Appliance image Boots the server from a Castis image (USB/ISO, or an OVA for VMs), opens the wizard. No commands Builds the image (Packer), with k3s, Argo CD, the wizard and the images already on it An image build pipeline; best if Castis supplies the hardware

Why option 2 is the natural next step: - One secret instead of three. The bootstrap exchanges the install code at the edge API for everything else: a git read token (or a release bundle, so no git access at all), a one-time Headscale key, and the enrollment token. Nobody creates or sends keys by hand. - Approval can happen up front. Castis creates the code for a customer it already knows, with the company name and address. The wizard opens pre-filled, and the registration can be approved automatically because Castis vouched for it when creating the code. Installs without a code still use an approval token. - It builds on what exists. install.sh, the wizard and Argo CD stay the same; only how the credentials arrive changes.

Its coreapi addition is sketched in edge-api.md → Planned: install codes.