Which branch to follow
productionis what planpa.ge runs. Every commit on it has run on our staging site first. Follow this one.masteris ahead of it and gets changes first. Use it if you want new things sooner and don't mind the occasional rough edge.
If you cloned with the default branch, switch once:
git checkout production
Take an update
From the repository root:
git pull
pnpm install
cd apps/web
pnpm selfhost:migrate
pnpm selfhost:deploy
Always run the migrations before the deploy. A new version can expect tables or columns that only exist once its migrations have run. Migrations only ever move forward, and running them twice does nothing.
Your wrangler.selfhost.jsonc is yours, so git pull never changes it. When an update adds something to the config, such as a new binding, the template changes too. Check after each pull:
git diff HEAD@{1} -- apps/web/wrangler.selfhost.example.jsonc
and copy anything new into your own file.
Roll back a deploy
If a new version misbehaves, put the previous one back:
npx wrangler rollback -c wrangler.selfhost.jsonc
This rolls back the code only; migrations stay applied. If the update changed the database and the old version doesn't work with it, restore the database to before the update as below.
Back up your data
Everything lives in your Cloudflare account, so back it up there:
D1 keeps a history of your database. Time Travel restores it to an earlier point, within the window Cloudflare keeps.
For a copy you keep yourself, export the database regularly:
npx wrangler d1 export planpage --remote --output planpage-backup.sql -c wrangler.selfhost.jsoncR2 holds the text of every version, uploaded images, rendered diagrams and activity older than 90 days. A database backup without it loses version history, so copy the bucket too, with any S3-compatible tool.
In scaled mode, documents are spread over several databases. Admin → Databases lists them; export each one the same way, by its name.
People can also download their own data at any time; see Your data.