Upgrading
Update a self-hosted GoPayLocal to a newer version, apply new database migrations, pick up new configuration, and roll back if needed.
An upgrade is: pull the new code, check the configuration for new entries, migrate the database, deploy the API, then rebuild and deploy the frontends. Migrate before you deploy the API, so the new code never runs against an old schema.
1. Pull the new version
Section titled “1. Pull the new version”If you work in a fork with your own wrangler.toml committed, add the original repository once:
git remote add upstream https://github.com/RayLabsHQ/gopaylocal.gitThen, for each upgrade:
git fetch upstreamgit merge upstream/mainpnpm installapps/api/wrangler.toml in the original repository holds the hosted service’s ids, so a merge may conflict on it. Keep your version:
git checkout --ours apps/api/wrangler.tomlgit add apps/api/wrangler.tomlgit commitpnpm install uses the pnpm version pinned in package.json (through Corepack). If the root package.json raises the Node.js version in engines, upgrade Node first.
2. Check for new configuration
Section titled “2. Check for new configuration”New bindings, variables, cron triggers and rate limits appear in apps/api/wrangler.example.toml. See what changed in this upgrade:
git diff ORIG_HEAD HEAD -- apps/api/wrangler.example.tomlORIG_HEAD is where your branch was before the merge. Copy anything new into your wrangler.toml, and set any new secret with pnpm wrangler secret put <NAME> from apps/api. The Configuration reference describes every entry.
3. Migrate the database
Section titled “3. Migrate the database”List the migrations this upgrade adds:
git diff --stat ORIG_HEAD HEAD -- apps/api/drizzleIf there are new .sql files, apply them from the repository root:
DATABASE_URL="postgres://USER:PASSWORD@HOST:5432/DATABASE?sslmode=require" pnpm db:migratedrizzle-kit applies only the files it has not applied before. If a migration fails, nothing from the run is applied (all new migrations run in one transaction), and the command exits with an error after printing the Postgres error message, its SQLSTATE code, the migration file and line, and the failing statement. Take a database backup first if your provider does not keep one for you.
4. Deploy
Section titled “4. Deploy”From the repository root:
pnpm build:bannercd apps/apipnpm run deploycd ../..VITE_API_URL=https://api.example.com pnpm --filter @gopaylocal/dashboard buildpnpm --filter @gopaylocal/dashboard run deploy:workerVITE_API_URL=https://api.example.com pnpm --filter @gopaylocal/admin buildpnpm --filter @gopaylocal/admin run deploy:workerRebuild the banner every time: the API serves whatever is in packages/banner/dist/banner.js when you deploy.
Alternatively, pnpm run deploy:full in apps/api runs the migration, the admin sync and the API deploy in one step (details).
Rolling back
Section titled “Rolling back”Cloudflare keeps previous versions of each Worker. To go back to the previous API version:
cd apps/apipnpm wrangler rollbackA rollback does not undo database migrations. Before rolling back past an upgrade that added a migration, check that the older code works with the newer schema. See Cloudflare’s rollbacks documentation.