Upgrade
Move an existing instance to the latest release without losing data.
Upgrades keep all your artifacts, versions, shares, and live-page data. Database migrations only add to the schema; they never rename or drop anything your data depends on.
Steps
-
Go to the existing install:
cdinto theopen-artifactsdirectory that setup ran from. If it’s gone, for example on a new machine or in CI, clone the latest release as in setup and continue from step 3. Without its saved state, add the install’s--name,--app-host,--content-host, and--owner-emailto the commands below; setup rebuilds the state from Cloudflare by--nameand never guesses the name in a--jsonrun. It also re-verifies Access, so setOA_ACCESS_TOKEN(as in setup) if the Cloudflare login can’t read Access. -
Check out the latest release. This is the latest stable GitHub release; pre-releases are skipped. Release tags look like
vX.Y.Z:TAG=$(curl -fsSL https://api.github.com/repos/leourbina/open-artifacts/releases/latest | sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p') git fetch --depth 1 origin tag "$TAG" git checkout "$TAG"If
TAGcomes back empty orcurlfails, stop and tell the user: “Open Artifacts has no stable release yet; check back later.” -
Install dependencies:
pnpm install. -
Preview, if you like:
pnpm -s oa:setup --upgrade --check --jsonis read-only. It reports each step asdoneortodowithout changing anything, so you can see what the upgrade would do. -
Run the upgrade:
pnpm -s oa:setup --upgrade --json. It reuses the hostnames and email saved by setup. Every step runs, but onlydeploy(new database migrations, then a redeploy) andselftestdo work:prereqsandresourcesverify, andaccess,secrets,owner-token, andagent-configreportskippedunless something is missing. It keeps the existing owner token and needs noOA_ACCESS_TOKENwhen the state is saved. It never creates resources: if one is missing, it reportsaction_requiredand asks for a full setup. Go by the exit code, as in setup:- 0: done.
- 2: relay the
action_requiredline’smessageto the user verbatim, wait until they’ve done it, then run the same command again. - 1: show the user the
errorline’smessage. If it says to rerun setup without--upgrade, runpnpm -s oa:setup --json(it may ask forOA_ACCESS_TOKENagain), then the upgrade again.
-
Tell the user which version is now running: the
deployline’sdata.deployedVersion.
If the Cloudflare login has expired
The prereqs step fails with an error. Ask the user to run npx wrangler login again, then re-run the upgrade.