From 65471e58dafb86c3168a7fae3fc214033bfb8122 Mon Sep 17 00:00:00 2001 From: Raghu Betina Date: Tue, 16 Jun 2026 17:53:24 -0700 Subject: [PATCH 1/2] Co-locate web service with DB region + harden for Supabase pooler - 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). --- config/database.yml | 6 ++++++ render.yaml | 1 + 2 files changed, 7 insertions(+) diff --git a/config/database.yml b/config/database.yml index baabbc0..3cfb7ba 100644 --- a/config/database.yml +++ b/config/database.yml @@ -83,3 +83,9 @@ test: production: <<: *default url: <%= ENV["DATABASE_URL"] %> + # When DATABASE_URL points at a Supabase connection pooler (Supavisor), + # these keep migrations and queries working across pooled connections. + # Harmless on the session pooler (port 5432); required on the transaction + # pooler (port 6543), where db:migrate otherwise hangs on an advisory lock. + prepared_statements: false + advisory_locks: false diff --git a/render.yaml b/render.yaml index c925b17..688675f 100644 --- a/render.yaml +++ b/render.yaml @@ -3,6 +3,7 @@ services: name: my-app-name # the name of this service, you should change this runtime: docker # use Dockerfile for deployment plan: free # make sure to set this to free or you'll get billed $$$ + region: oregon # set this to the SAME region as your database (Supabase "West US" = oregon) to avoid slow cross-region queries dockerfilePath: ./Dockerfile envVars: # this section sets some ENV variables needed by Render for deployment - key: SECRET_KEY_BASE From ade7896d3a929222bfbc1a92bf5be8c6d8565283 Mon Sep 17 00:00:00 2001 From: Raghu Betina Date: Tue, 16 Jun 2026 17:57:18 -0700 Subject: [PATCH 2/2] =?UTF-8?q?Default=20region=20to=20ohio=20(US=20East)?= =?UTF-8?q?=20=E2=80=94=20closer=20to=20most=20users=20than=20oregon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- render.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/render.yaml b/render.yaml index 688675f..4e7e3d2 100644 --- a/render.yaml +++ b/render.yaml @@ -3,7 +3,7 @@ services: name: my-app-name # the name of this service, you should change this runtime: docker # use Dockerfile for deployment plan: free # make sure to set this to free or you'll get billed $$$ - region: oregon # set this to the SAME region as your database (Supabase "West US" = oregon) to avoid slow cross-region queries + region: ohio # set this to the SAME region as your database, near your users (Supabase "East US (Ohio)" = ohio) to avoid slow cross-region queries dockerfilePath: ./Dockerfile envVars: # this section sets some ENV variables needed by Render for deployment - key: SECRET_KEY_BASE