Skip to content

Co-locate web service region with DB + Supabase pooler hardening#27

Merged
raghubetina merged 2 commits into
mainfrom
render-region-and-pooler
Jun 17, 2026
Merged

Co-locate web service region with DB + Supabase pooler hardening#27
raghubetina merged 2 commits into
mainfrom
render-region-and-pooler

Conversation

@raghubetina

Copy link
Copy Markdown
Contributor

Why

Two small deploy robustness fixes surfaced while deploying a data-backed Rails app via the Render Blueprint + Supabase flow.

1. Region co-location (render.yaml)

The web service had no region:, so Render defaults it to Oregon (US-West). If a student's Supabase project is in a different region (e.g. East US), every query is a cross-country round-trip. Measured on a real app: ~2.5–4.7s of DB time per page vs ~0.3s once the service was moved to the database's region.

Added region: oregon with an inline note to match the database's region (Supabase "West US" = oregon).

2. Supabase pooler settings (config/database.yml)

Added to production:

prepared_statements: false
advisory_locks: false

These are harmless on the session pooler (port 5432) the lesson recommends. They become necessary on the transaction pooler (port 6543) — a very common URL mix-up — where db:migrate otherwise hangs silently forever acquiring its advisory lock. This makes the template robust to either pooler URL.

No behavior change for correctly-configured session-pooler deploys.

- render.yaml: add `region: oregon` with a note to match the database's
  region (Supabase "West US" = oregon). Without this the web service
  defaults to Oregon while a student's Supabase project may be elsewhere,
  causing slow cross-region queries (observed ~2.5-4.7s vs ~0.3s when
  co-located).
- database.yml: set prepared_statements: false and advisory_locks: false
  for production. Harmless on the Supabase session pooler (5432); prevents
  a silent `db:migrate` hang if a student uses the transaction pooler (6543).
@raghubetina raghubetina merged commit 13a58bc into main Jun 17, 2026
1 check passed
@raghubetina raghubetina deleted the render-region-and-pooler branch June 17, 2026 00:59
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.

1 participant