Deploy
The dev server, https://sushivr.ovh, runs on a Turing Pi 2 RK1 node of the local network (tp2node3, 10.0.0.19, 16 GB, Ubuntu 24.04 arm64, Docker; the whole backend uses about 1 GB). Everything is by hand: a merge on main only runs the CI (build, tests, validation). Two buttons in Gitea's Actions:
- Release (
.gitea/workflows/release.yml): makes a version of a commit ofmain(images, game client and installer in Gitea's packages, git tagvX.Y.Z). It does not deploy. - Deploy (
.gitea/workflows/deploy.yml): deploys a version (by default the latest) or a commit ofmainon the node. Nothing is built on the node.
flowchart LR
Rel[Actions > Release<br/>version: empty = next patch] --> Pub[Publish-Release.ps1<br/>dev PC, label windows]
Dep[Actions > Deploy<br/>version: empty = latest] --> Prep[Prepare-Deploy.ps1<br/>dev PC]
Prep -- a commit not published yet --> Pub
Pub -- passed the CI? --> Pkg[(Gitea packages<br/>images arm64 :X.Y.Z :latest :next :commit :main<br/>generic client/X.Y.Z, client/commit)]
Prep --> Node[job deploy<br/>node tp2Node3, label deploy]
Pkg --> Node
Node -- deploy/deploy.sh --> Stack[docker compose -p nexusoffates<br/>on the node]
How to
Release and Deploy are the project owner's decision: an agent runs them only when asked. Both are in Gitea: Actions, choose the workflow, Run workflow, fill in the fields, then follow the run (each step's log; the ::notice:: / ::error:: lines say what happened). An agent can do the same through the API (a token of an account that can write the repository): POST /api/v1/repos/nexusoffates/nexusoffates/actions/workflows/release.yml/dispatches with {"ref":"main","inputs":{"version":"0.3.0","commit":""}} (deploy.yml: {"ref":"main","inputs":{"version":""}}), then GET .../actions/runs?limit=5 and GET .../actions/jobs/<id>/logs (see Agents on other PCs in Development.md); Tools/Dev/Release-Deploy.ps1 does it all (CI waited for, Release, Deploy, each result printed).
| I want to | Do |
|---|---|
put what is on main online as a new version |
merge to main through the merge queue (git push origin HEAD:queue/<branch>, see Merging to main in Development.md), then Release with version empty (the next patch) or a chosen number, then Deploy with version empty (= latest) |
| try a version before releasing it | Release 0.4.0-rc.1 (rc.2, rc.3... for the next tries), Deploy next; when it is good, Release 0.4.0 from the same commit (commit = the candidate's) and Deploy empty |
| go back after a bad deploy | Deploy the previous version (0.3.1): seconds, its images are still on the node (the last 3 deploys) |
test the last commit of main without making a version |
Deploy main (or a commit hash of main): published first if needed (~1 min), never latest |
| see what is online | https://sushivr.ovh (the published client's build = the version), or docker ps on the node (the images' tag) |
Which number. X.Y.Z: Z (patch, the default) for fixes, balance and small changes; Y (minor) for a new feature or content, and for a change of protocol (ProtocolVersion.Current: every player must update); X (major) for a milestone (1.0.0: the first public release). Any number above the last one is accepted; a version that exists is refused.
What players see. Before the servers restart, the players online are told in the game: a panel with a countdown ("Update 0.15.0: the server restarts in 2 minutes. You will be logged out; update the game, then come back."), the Orchestrator's announcement (the one the Monitor's Players page sends), sent by deploy/deploy.sh to the version still running; the deploy then waits that long (the workflow's warn input: 2 minutes by default, 10 at most, 0 to restart at once; nobody online: no wait; a server that cannot be told is deployed anyway, with a warning in the run). Then they are logged out. A deploy puts the new client on the server, and every update is mandatory: at the login or character screen, an installed game (dev channel) shows only "A new version is available… Update to play", Update (it downloads it and restarts in it, see Publishing the client in Development.md), Credits and Quit game, never the login form nor the characters; a store's build shows the same screen with the store's text; a client run from the sources is never blocked by a build. A player already in the game is not cut off for it: the client asks for a newer build every 5 minutes, shows a message saying the game must be updated and an Update button in the game menu, and leaving the game leads to the update screen (see Every update is mandatory in Development.md). First install: the Download the game button of https://sushivr.ovh (the installer).
When it fails
| Message | Why, what to do |
|---|---|
has not passed the CI yet |
that commit's build, tests or validation never passed: wait for the CI run of main, or Actions > CI > Run workflow on it (a red CI must be fixed first) |
A local backend runs on the dev PC (CI validation) |
a local session holds the dev ports on the dev PC: Tools/Dev/Stop-Dev.ps1 there, then run again |
Version ... exists already / is already published |
a version is never replaced: choose the next number |
Version ... is not released / No latest version yet (Deploy) |
Release it first |
no Gateway after 180 s, login check (deploy job) |
the new version does not start: Deploy the previous version, then look at the node: cd /home/ubuntu/nexusoffates/src && docker compose -p nexusoffates --env-file ../.env logs --tail 100 |
| a runner never picks the job | its PC / node is off, or the runner stopped: the dev PC's scheduled task GiteaRunner, the node's sudo systemctl status gitea-runner |
Versions
Semantic versions X.Y.Z (0.3.0), and release candidates X.Y.Z-rc.N (1.0.0-rc.2) to try one before releasing it. The first one was 0.1.0. The protocol number (ProtocolVersion.Current) is separate: it is the network contract between clients and servers, not the version.
| Published | Images gitea.akwa.ovh/nexusoffates/<name>: |
Client package client/ |
Client build (shown, compared by the update) | Git tag |
|---|---|---|---|---|
a version 0.3.0 |
0.3.0 and latest |
0.3.0, pointer client/latest → 0.3.0 |
0.3.0 |
v0.3.0 |
a candidate 0.3.0-rc.1 |
0.3.0-rc.1 and next |
0.3.0-rc.1, pointer client/next → 0.3.0-rc.1 |
0.3.0-rc.1 |
v0.3.0-rc.1 |
a commit of main (Deploy, to test quickly) |
<commit> and main |
<commit> |
<protocol>-<commit> |
none |
latest is always the last version (never a candidate nor a commit), next the last candidate. A version is never replaced: a new one is made. The pointers client/latest and client/next are generic packages holding version.txt.
1. Release (Actions > Release)
Inputs: version (empty: the next patch of the last version, 0.3.0 → 0.3.1; or 0.4.0, 1.0.0-rc.1...) and commit (empty: the last one of main). On the dev PC's runner, in the CI's kept clone (C:\nfc\ci\nexusoffates, moved to that commit), Tools/Ci/New-Release.ps1:
- refuses a bad version (
X.Y.ZorX.Y.Z-rc.N) or one that exists (git tag); Tools/Ci/Publish-Release.ps1 -Version:- passed the CI? The commit's content must have passed the build, the tests and the validation (its content keys in
C:\nfc\ci\testedandC:\nfc\ci\validated, see Continuous integration inDevelopment.md). A push onmainruns them; for an older commit, Actions > CI > Run workflow on it. Otherwise it stops and says so; - images:
Tools/Dev/Publish-Images.ps1=docker buildx bake(docker-bake.hcl) for linux/arm64 only, in parallel: the six .NET services share one build stage (Docker/dotnet.Dockerfile: the libraries compiled once, the NuGet restore cached while only sources change), the GameServer's Godot import runs with the PC's own Godot (not under emulation). Thenexusoffatesbuildx builder keeps the layer cache. Credentials:docker login gitea.akwa.ovhdone once on the PC; - game client:
Tools/Dev/Publish-Client.ps1 -Api https://sushivr.ovh -Build <version>(see Publishing the client inDevelopment.md), then its three files into the generic packageclient/<version>:NexusOfFates-<version>.zip(the update),NexusOfFates-setup.exe(the installer),latest.json(last); then the pointer. Credentials:PACKAGES_TOKEN(user:token) if set, else the PC's git credential forgitea.akwa.ovh; - cleanup (
Tools/Ci/Remove-OldPackages.ps1,-WhatIfto see): only the 10 newest commit publications stay, and the candidates of a released version go. Versions,latest,next,mainand the pointers stay;
- passed the CI? The commit's content must have passed the build, the tests and the validation (its content keys in
- tags the commit
vX.Y.Z(annotated) and pushes the tag.
The packages: https://gitea.akwa.ovh/nexusoffates/-/packages. By hand from the PC: ./Tools/Ci/New-Release.ps1 -Version 0.3.0, or ./Tools/Ci/Publish-Release.ps1 for a commit (-NoCheck without the CI check, -Force publishes again).
Locally, docker compose --profile images build still builds the images for the PC itself (nexusoffates/<name>:latest, same Dockerfiles, see docker-compose.yml): the registry is only for the dev server.
2. Deploy (Actions > Deploy)
Input version: empty for latest; next (the last candidate); a version 0.3.0 / 0.3.0-rc.1 (to go back, or try a candidate); main or a commit hash of main (to test a commit quickly without a version). First, on the dev PC, Tools/Ci/Prepare-Deploy.ps1 resolves it: a version must be released; a commit is published now as above if it is not yet (it must have passed the CI; already published: seconds).
Then the job deploy runs on the node itself: runner tp2Node3, label deploy, host mode (bash and the node's Docker), systemd service gitea-runner (/home/ubuntu/gitea-runner, user ubuntu). It checks out that commit into /home/ubuntu/nexusoffates/src (without the LFS models) and runs deploy/deploy.sh <version or commit>:
- stops at once if it was not published (no client package);
- the first time, writes
/home/ubuntu/nexusoffates/.envwith random secrets generated on the node (JWT_KEY,WORKER_KEY,ADMIN_KEY,ADMIN_PASSWORD,POSTGRES_PASSWORD,REDIS_PASSWORD,CLICKHOUSE_PASSWORD,CAMP_SEED; never printed, never in the CI or the repository), and at every deploy the settingsPUBLIC_HOST=game.sushivr.ovh,MONITOR_URL,DOCS_URL,CLIENT_RELEASES,IMAGE_PREFIX=gitea.akwa.ovh/nexusoffates,IMAGE_TAG=<version or commit>,NOF_PRODUCTION=true(the services refuse a missing or development secret); - pulls its images (
docker compose --profile images pull, the Gateway and GameServer ones too); - puts the client package into
client-releases/(latest.jsonlast, 3 updates kept): the clients update themselves at their next login screen; - stops the Orchestrator and removes the old Gateway / GameServer containers (the new Orchestrator starts new ones from the new images), then
docker compose up -d; - checks: a Gateway ready (
/api/gateway, 180 s at most),/api/health, a wrong login answered 401 (ApiServer, DbWorker and PostgreSQL answer), the doc site and the Monitor's login page; - keeps on the node the images of its last 3 deploys only (
deployed.txt: going back to one of them pulls nothing), removes the older ones.
The data (PostgreSQL, Redis, ClickHouse volumes) stays from one deploy to the next. By hand on the node (the same thing): cd /home/ubuntu/nexusoffates/src && git fetch --tags && git checkout --detach v0.3.0 && ./deploy/deploy.sh 0.3.0 (or a commit and its 7-character hash).
Store builds
The builds for Steam (Windows) and Meta (the Quest's APK, package com.nexusoffates.game: it can never change once on Meta) are made by Tools/Dev/Export-Store.ps1 -Store Steam|Meta -Api <server> -Version <x.y.z>, from a clean commit. They differ from the dev channel's:
build.jsonpacked inside (res://build.json,BuildFile,ClientBuild.Load): channelSteamorMeta, the build's name<protocol>-<commit>(the same for both when made from one commit), the server. An APK has no folder of its own; a file next to the executable (the dev channel's) still wins.- VR only: no headset (OpenXR not started), a message and the game quits (
ClientBuild.NeedsHeadset, see Play inDevelopment.md). - No updater: the store updates them (
ClientUpdates.CanInstallis the dev channel's only). The update screen stays, with the store's words: "restart Steam", "update the game from the Meta store" (ClientUpdates.Message). It shows when the server'sclient-releases/latest.jsonnames another build or protocol: the script writesBuildOutput/store/latest.json(no file to download) to copy there once the new builds are live on the stores; a new protocol is refused by the servers anyway. - Meta: the release keystore, made once by the owner and never in git (lost, no update of the app can ever be published: keep two copies, e.g. a password manager and an offline drive):
keytool -genkeypair -v -keystore nexusoffates-release.keystore -alias nexusoffates -keyalg RSA -keysize 2048 -validity 10000(keytool: the JDK's). The script reads it fromGODOT_ANDROID_KEYSTORE_RELEASE_PATH,GODOT_ANDROID_KEYSTORE_RELEASE_USER(the alias) andGODOT_ANDROID_KEYSTORE_RELEASE_PASSWORD. The APK'sversionCodeis the commit count ofHEAD(it must grow at each upload), itsversionName-Version. - Upload: Steam, the folder
BuildOutput/store/steam/<build>/with SteamPipe (the app's depot); Meta,BuildOutput/store/meta/NexusOfFates-<build>.apkto the release channel (Meta Quest Developer Hub orovr-platform-util).
Players online
MAX_PLAYERS in the node's .env (Server__MaxPlayers; unset or 0: no limit) is the most players in the game at once. When the Orchestrator counts that many, a character who wants to enter is refused at /api/characters/{id}/play (status 429, CharacterRoutes.FullStatus) and the game says The server is full: try again in a few minutes (chars.server_full). Not refused: a character already in the game (a reconnection), a DEV account, and everyone while the Orchestrator does not answer. There is no waiting line yet (see The alpha in Todo.md). Raise it for a bots load test. A change needs docker compose up -d apiserver.
Another server
deploy/deploy.sh deploys on any Linux server with Docker (amd64 or arm64: the images are published for both), set by its own deploy.conf in DEPLOY_DIR (deploy/deploy.conf.example; no file: the dev server's settings). For a rented server for the store builds:
- The server: Ubuntu LTS, an SSH key only (no password login), Docker (
curl -fsSL https://get.docker.com | sh), the deploy user in thedockergroup. The containers' logs rotated (they hold IP addresses: the privacy policy says they are overwritten):/etc/docker/daemon.json={"log-driver": "json-file", "log-opts": {"max-size": "10m", "max-file": "3"}}, thensystemctl restart docker. - The firewall (the host's
ufwand the provider's if it has one): SSH (22/tcp), 80/tcp, 443/tcp and 443/udp (Caddy), the Gateways' UDP 7100–7109. Docker publishes pastufw, henceBIND_ADDRESS=127.0.0.1: the API, the Monitor and the doc site then listen only on the server itself, behind Caddy; the Orchestrator's 8090 is always on 127.0.0.1; PostgreSQL, Redis and ClickHouse are never published. - DNS: A records of
API_DOMAIN,MONITOR_DOMAIN,DOCS_DOMAINandPUBLIC_HOST(the Gateways' UDP) to the server. docker login <registry>once (a read-only account), a checkout of the repository (git clone, no LFS needed:GIT_LFS_SKIP_SMUDGE=1),DEPLOY_DIR/deploy.conffrom the example, thendeploy/deploy.sh <version>from the checkout of that version. The first time it writes.envwith new secrets (mode 600, never printed); theTERMS_*,MAX_PLAYERSand the domains ofdeploy.confare copied into it at each deploy.- What changes with
deploy.conf:REGISTRY;DEPLOY_CLIENT=false(no dev-channel game client: the players have the store builds, whose update screen followsclient-releases/latest.json, see Store builds);HTTPS=true(thecaddyservice,--profile https,Docker/caddy/Caddyfile: Let's Encrypt certificates for the three domains, renewed by itself; its data in thecaddydatavolume);BIND_ADDRESS;BACKUP=true(below).
Backups
deploy/backup.sh saves a server's data into DEPLOY_DIR/backups/ (mode 700): PostgreSQL (accounts, characters, feedback: pg_dump -Fc, postgres-<date>.dump) and ClickHouse (the telemetry, the fights: BACKUP DATABASE nexusoffates, written in ClickHouse's own folder (Docker/clickhouse/backups.xml), copied out then removed: clickhouse-<date>.zip); Redis needs none (the Orchestrator rebuilds its state). The last BACKUP_KEEP (7) of each are kept; BACKUP_COPY_TO (an rsync target) copies them elsewhere after each run. With BACKUP=true in deploy.conf, deploy.sh puts it in the deploy user's crontab every night (BACKUP_TIME, default 03:17), its output in backups/backup.log. It reads no secret: the containers use their own passwords.
To restore (the services stopped but postgres and clickhouse, docker compose ... stop apiserver dbworker telemetry orchestrator monitor):
- PostgreSQL:
docker compose ... exec -T postgres pg_restore -U nexusoffates -d nexusoffates --clean --if-exists < backups/postgres-<date>.dump - ClickHouse: copy the zip into the container (
docker compose ... cp backups/clickhouse-<date>.zip clickhouse:/var/lib/clickhouse/backups/), thenclickhouse-client(as inbackup.sh)RESTORE DATABASE nexusoffates FROM File('/var/lib/clickhouse/backups/clickhouse-<date>.zip') SETTINGS allow_non_empty_tables=true(after dropping the tables to replace).
Addresses
| Name | Goes to | Notes |
|---|---|---|
https://sushivr.ovh |
NAS (Traefik, HTTPS) → node :8080 | API, client updates, /client/NexusOfFates-setup.exe (the installer, first install). Its home page (/, HomePage in the ApiServer) shows the server's state, the published client with a Download the game button and how to install it, and links to the Monitor and the doc |
https://monitor.sushivr.ovh |
NAS → node :8091 | Monitor (needs WebSockets). Password: grep ADMIN_PASSWORD /home/ubuntu/nexusoffates/.env on the node. Grant DEV gives the DEV role to an account |
https://doc.sushivr.ovh |
NAS → node :8081 | doc site |
game.sushivr.ovh |
the node directly (DNS only) | the Gateways' UDP ports 7100-7109 (PUBLIC_HOST, so the API hands out this name, not the NAS). UDP, no certificate |
The certificates are the NAS's business (Traefik, its own OVH key); dev.sushivr.ovh (the former address) is to be removed there. The game's UDP traffic is not encrypted (the session token included): fine on the local network, to change before opening the server to the Internet.
The Orchestrator gets the Docker socket and creates nexusoffates-gw-* / nexusoffates-gs-* containers on the nexusoffates_default network from the deployed images (Docker__GatewayImage, Docker__GameServerImage). Its state is in Redis. Developer locomotion and speeds need the DEV role on the account.
Clocks
The servers' clocks give the world time (clouds, moving platforms: Architecture.md): each machine running a service keeps its clock with NTP (timedatectl shows System clock synchronized: yes; chrony or systemd-timesyncd). The containers use their machine's clock. The Monitor's Servers page shows each instance's drift from the Orchestrator (Clock); over 50 ms players on different servers would see moving things in different places.
Before
Until 2026-11-20: a test server mmo.test.nexusoffates.com deployed from the repository PaperClip/MmoRpgVr-deploy by a workflow of PaperClip/deploy (abandoned, as that repository), and Tools/Dev/Deploy-Dev.ps1, which built the images on the node over SSH (replaced by the Deploy workflow).