Skip to content

test: run two instances against one Postgres and one S3 bucket in CI - #207

Merged
maritonx merged 1 commit into
mainfrom
test/multi-instance
Oct 24, 2026
Merged

maritonx merged 1 commit into
mainfrom
test/multi-instance

Conversation

@maritonx

Copy link
Copy Markdown
Owner

Closes #154 (M5, ADR-0051).

What runs

New CI job multi-instance with Postgres 17 and RustFS, set up like production:

  1. Run easy-cms migrate:create and easy-cms migrate once.
  2. Start two easy-cms serve --trust-proxy instances with NODE_ENV=production.
  3. Put a round-robin proxy in front, written in Node and alternating A/B on every request, with no sticky sessions.

Tests that must prove a request crossed instances call A and B directly. The rest go through the proxy.

Checked How
REST Create on B, read/edit on A, read 6× through the proxy, delete on B → 404 on A
Sessions + CSRF Login on A → /auth/me on B works and gives the same CSRF token; B accepts a POST with A's token and rejects a wrong one; logout on B → session gone on A
Login rate limit 5 failed logins through the proxy (alternating instances) → the right password gets 429 on both
S3 uploads Upload a PNG on A → B serves the same bytes; delete on B → 404 on A
Jobs 20 scheduled publishes + a config job; 10 concurrent jobs/run calls split across A and B → 20 publishes total, the job runs once
  • The test has its own config (multi-instance/vitest.config.ts), and the normal integration suites exclude it.
  • packages/integration gains devDependencies easy-cms, @easy-cms/storage-s3 and aws4fetch (to create the bucket). The lockfile diff is mostly pnpm re-resolving nuxt peers now that aws4fetch is in the graph.
  • No changeset: tests only. The tests found no bugs.

Verified locally (Docker: Postgres 17 + RustFS 1.0.0)

  • 5/5, four runs in a row, about 4 s each.
  • pnpm turbo run test typecheck --continue 81/81, biome ci passes (the 7 warnings were already there).

The 30-second role cache in each process will go in the reference architecture docs (#160) instead of a test.

🤖 Generated with Claude Code

New multi-instance job: two `easy-cms serve` instances (NODE_ENV=production,
migrated first) on one Postgres and one RustFS bucket, behind a
round-robin proxy. It checks that REST writes and reads work from either
instance, a session and CSRF token made on one are accepted by the other
and logout ends it on both, failed logins are counted across instances,
a file uploaded through one is served by the other, and that scheduled
publishes and config jobs run once when both instances run jobs at once.

Runs on its own config (multi-instance/vitest.config.ts), excluded from
the integration suites.

Closes #154

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@maritonx
maritonx merged commit fe02d2c into main Oct 24, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run two instances against one Postgres in CI

1 participant