Clever CloudHow-toFor adminsApplies from 4.2.3
Upgrading the server and checking state after a migration
Cette page en françaisThis page on the GitHub wiki
Upgrading the Studio Server is the same overlapping redeploy as any other, of a new version: the database migrations run when the new instance starts. This page upgrades both apps and checks, afterwards, that the game is where it was.
What you get
Both apps at the new version, the database migrated to its schema, the game's revision unchanged by the upgrade, writes served again, and a backup taken just before, to go back to if needed.
Context and versions
- A hosted Studio on Clever Cloud, deployed from the repository, from 4.2.3 (the lease handoff).
- This page is about the server. The game's own content (authoring schema 2 → 3, the former
web-scumm/…imports) is upgraded inside the Studio by its owner: Upgrading the engine of a hosted game. - Verified on: 19 October 2026, by the reference deployment: an upgrade from commit 52e68932 to c66fbf56 (both
package.json 4.2.2, before the 4.2.3 tag), with one new migration (
0012, the comments table), following these four steps. This page's exact text is not verified on a live installation.
Prerequisites
- A running Studio with backups (Backups).
- The engine repository on your machine, checked out at the new version,
npm cidone.
Where to run the commands
git, clever deploy: on your machine, in the engine repository. The backup: in a shell on the studio app
(clever ssh --alias my-game-studio).
Steps
-
Read the version's CHANGELOG, and the upgrade notes for the game's content (Upgrade). List the new database migrations between the two versions:
# on your machine, in the engine repository git diff --name-only v4.3.1 v4.4.0 -- studio-server/migrationsMigrations run when the new instance starts, while the old one may still serve. If one changes what the old version reads (a column it uses renamed or dropped, not a new table), stop the old one first,
clever stop --alias my-game-studio, and accept the minute without the Studio.
-
Take a backup to the bucket and note its revision:
# in a shell on the studio app (clever ssh --alias my-game-studio) cd "$APP_HOME" && npm run -s studio-server -- backup --to-bucket
-
Deploy the worker first, then the studio, the same version:
# on your machine, in the engine repository, at the new version clever deploy --alias my-game-worker clever deploy --alias my-game-studioUntil both are at the new version, a job may be refused; the Studio then refuses the write it was checking (it fails closed, a 503) rather than letting it through.
- Watch
/readyzcome back to 200 on the new instance (instancein thelease-takenlog line), check the revision is unchanged, and make one write.
Expected result, and how to check it
Check, in this order:
- It started. The new instance's log has
{"event":"lease-taken",…};https://studio.example.fr/readyzanswers 200,"writes":"served",rpoMsback to 0. - The game did not move. As a member,
GET /api/revisiongives the sameepochandrevisionas before the deploy (or later, if people wrote meanwhile). - It writes. One change (a note) is saved, at the next revision.
- The schema. With
psqland the add-on's URI (Clever's console shows it; never paste it anywhere),SELECT MAX(version) FROM schema_migrationsgives the number of the newest file instudio-server/migrations/of the new version. - The worker. The header's health goes green again and a preview builds (the worker's jobs succeed); in the logs,
no
health-failedorpreview-failedafter the switch. - A restore still works. Run the restore drill with the new version, on a backup taken after the upgrade.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
| Writes 503 "the edit cannot be judged now: …" for a while | The worker at the old version, or redeploying | Wait for both deploys; deploy the worker first |
| Writes refused about 2.5 min | The first deploy onto a version with the lease handoff, from one without | Expected once (Redeploys) |
too many connections in the logs during the deploy | PostgreSQL DEV plan | A larger plan |
| The old instance logs errors on a column the migration changed | A migration that changes what the old version reads | Next time, clever stop first (step 1) |
Files or data changed
The database schema (new migrations applied, recorded in schema_migrations), a new backup under backups/, the two
apps' deployed commit.
Recovery or going back
Redeploying the previous version works only while it can still read the migrated database; an older server refuses a database whose schema is newer than its own. Otherwise, going back is restoring the backup of step 2 into a new add-on, with the previous version: Limits of going back.
References
- The migrations:
studio-server/migrations/(oneNNNN.up.sqlandNNNN.down.sqlper step); the runner:bridge/src/migrations.ts. - Redeploys, Backups,
CHANGELOG.md.