Repository navigation
build(serverpod)!: upgrade to Serverpod 4.0.4 for Cloud deployment - #114
Conversation
Copy serverpod_auth_idp_rate_limited_request_attempt rows through a transaction-scoped temp table while the generator recreates the table to rename nonce to key. Document the upgrade, migration and rollback steps. Refs #110
…f the image Serverpod 4 dependencies use Dart build hooks, so the image now uses dart build cli and ships the emitted bundle. The new .dockerignore keeps .env files and config/passwords.yaml out of the build context, which previously baked local secrets into the runtime image. Refs #110
Add a docker job, triggered by server, domain, lockfile and .dockerignore changes, that builds the image with planted secret files and asserts the bundle exists and passwords.yaml is excluded. Refs #110
Deploying puls3 with
|
| Latest commit: |
93c47ab
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c27b1e6b.puls3-4lw.pages.dev |
| Branch Preview URL: | https://chore-110-serverpod-4-upgrad.puls3-4lw.pages.dev |
…itory The Pages build command cloned Flutter 3.41.4 from the dashboard, so every branch on Serverpod 4 (Dart ^3.12.2) failed version solving. The build now runs scripts/cloudflare-pages-build.sh, which installs the branch's pinned Flutter. A test keeps its version in sync with CI. Refs #110
|
Cloudflare Pages fix (522f6d2): the Pages build command was configured in the dashboard to clone Flutter 3.41.4, so this branch failed version solving (
After this merges, the |
|
@fercodes @Pericena @XxHugheadxX @moises-cisneros this one needs a review with priority: it is P0 and blocks the Serverpod Cloud deploy (#31, stacked in #115). All checks are green, including the new After it merges, everyone needs to upgrade to Flutter 3.44.4 and |
…-upgrade Brings in the hire and hire_payment tables from #93. The generated protocol files are regenerated with serverpod_cli 4.0.4 instead of resolved by hand. The forced upgrade-4-0 migration is removed here because its snapshot predates migration 20261006210458593; it is recreated in the next commit.
… the hire tables The forced upgrade-4-0 migration was created before #93 added migration 20261006210458593 with the hire and hire_payment tables, so its snapshot did not know about them. Recreate it with serverpod_cli 4.0.4 as 20261007214534790-upgrade-4-0 so it now sorts after 20261006210458593 and its definition includes hire, hire_payment, chain_submission and the Serverpod 4 module tables. The migration does not create, drop or alter the hire tables. The hand edit is re-applied: rows of serverpod_auth_idp_rate_limited_request_attempt are copied to a temporary table before Serverpod drops and recreates it, with nonce mapped to key, and restored afterwards, so rate-limit history still survives the upgrade. Refs #110
scripts/tests/*.test.sh were never run in CI, so main broke the env inventory (PULS3_HIRE_JOB_DURATION_SECONDS) without a red check. The new scripts job runs them all and gates the merge. Refs #110
moises-cisneros
left a comment
There was a problem hiding this comment.
Reviewed and tested locally at 93c47ab. No blockers; a few minor comments below.
What I verified
- Migration: loaded the previous (Serverpod 3) schema into Postgres 16, seeded 5 rows in
serverpod_auth_idp_rate_limited_request_attempt, appliedmigration.sql. All 5 rows kept, sameids,noncerenamed tokey, no diff. All four module versions are registered. - Image:
docker buildsucceeds and the CIdockerjob checks pass (server/bin/mainexecutable,production.yamlpresent, nopasswords.yaml). - Runtime: the binary starts on Alpine and reports Serverpod 4.0.4 on Dart 3.12.2. On an empty database with
--apply-migrationsit applies everything,/health/checkanswers, and there are no target-state warnings. scripts/tests/*.test.sh: all five suites pass.- Not run locally:
dart testandflutter build web(my toolchain is older than the pins).
Comments
- The shell-form
ENTRYPOINTignores arguments.docker run <image> --apply-migrationsstarted the server withapplyMigrations: false. It only works by overriding the entrypoint. Inherited from the template, but an exec form or aCMDwould be safer. - No automated test runs the migration over pre-existing rate-limit rows. It works (see above), but it is the only hand-edited SQL, so a regression test would be worth a follow-up issue.
- The runtime stage uses
alpine:latest. Now that the bundle carries native libs, pinning a version would keep the image reproducible. - Scope:
cloudflare-pages-build.shand its test, thescriptsCI job and the.env.exampleadditions are unrelated to the Serverpod 4 upgrade. A separate PR would keep this one easy to revert. prefer_initializing_formals: falsedisables the rule for the whole package; a local// ignorewould be narrower.docs/operations/serverpod-4-migration.md: worth noting that Serverpod Cloud already runs withapplyMigrations: true, so the manual--apply-migrationsstep applies to local/self-hosted setups only.
moises-cisneros
left a comment
There was a problem hiding this comment.
Approving after local verification (migration with pre-existing rate-limit rows, image build, container start and /health/check). The non-blocking comments in my previous review still apply as follow-ups.
Closes #110
Summary
Upgrades puls3 from Serverpod 3.4.13 to Serverpod 4.0.4, the version Serverpod Cloud requires (unblocks #31).
serverpod_cli4.0.4 in the pubspecs, the lockfile, CI and the docs. Everyserverpod*package resolves to 4.0.4.upgrade-4-0migration is checked in. Serverpod 4 recreatesserverpod_auth_idp_rate_limited_request_attemptto renamenoncetokey. The generated SQL would drop the existing rows, so the migration was hand-edited to copy them through a transaction-scoped temp table. Rate-limit history is preserved, not reset (see Notes).dart build cliand ships the emitted bundle, because Serverpod 4 dependencies use Dart build hooks thatdart compile execannot package..dockerignorekeeps.envfiles andconfig/passwords.yamlout of the build context. Before this change, a localpasswords.yamlwas baked into the runtime image;mainhas the same problem.dockerjob that builds the image and asserts the bundle is present andpasswords.yamlis excluded. It runs on server, domain, lockfile and.dockerignorechanges and is wired intogate.docs/operations/serverpod-4-migration.mdgives teammates the exact upgrade commands, explains the migration, and covers rollback.Acceptance criteria
flutter --versionreports 3.44.4 with Dart 3.12.2, andserverpod versionreports 4.0.4.serverpod*dependencies and the lockfile resolve to 4.0.4; no 3.4.x package is left.serverpod generateis clean, and generated server, client and integration-test helpers are committed together.upgrade-4-0migration was generated and reviewed, and it applies cleanly to a disposable database and to a fresh Serverpod Cloud database. The rate-limit table behavior is documented; the rows are preserved instead of reset.serverpod_cli4.0.4.dart build cliand contains the runnable bundle. The same server answers/health/checkon Serverpod Cloud.Verification evidence
Notes for reviewers
noncerenamed tokey) inside the same transaction.migration.sql:101-126is the only hand-edited part of the generated migration.alpine:latest, there is no automated test that runs the migration over pre-existing rate-limit rows, and the shell-formENTRYPOINTcomes from the Serverpod template.docs/operations/serverpod-4-migration.md. A Serverpod 3 server must not run against a database that has the 4.0 migration applied.1fb9790is marked!because generated client APIs changed with the Serverpod 4 regeneration.