-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Currently we're running self hosting a superbase instance as per the docs but have run into a few issues in running pgflow when attempting to integrate with this deployment type.
I've been able to get the pgflow working by simply updating to the most recent supabase/postgres image (15.14.1.098) as the one currently used doesn't include a suitable pgmq version.
Besides the normal work around(s) due to the supabase cli not liking self hosting (ie. functions are deployed directly into the volumes/functions and mounted directly; so I've also added the flows to the volumes and mounted appropriately. Thankfully the migrations can still be run trivially via PGSSLMODE=disable npx supabase migrations up --db-url $DB_URL)
Anyways, now the only problem I'm seeing is the edge-worker is failing to resolve postgres (at least thats the assumption given this error).
supabase-edge-functions | [Error] worker_id=b59ad5d3-e2b3-4924-897a-3bb7f4eb3b6b module=Worker Error in worker main loop: Error: failed to lookup address information: Name or service not known
supabase-edge-functions |
supabase-edge-functions | runtime has escaped from the event loop unexpectedly: event loop error: Error: failed to lookup address information: Name or service not known
supabase-edge-functions | at async Object.connect (ext:deno_net/01_net.js:583:55)
supabase-edge-functions | at cachedError (https://jsr.io/@oscar6echo/postgres/3.4.5-d/src/query.js:170:23)
supabase-edge-functions | at new Query (https://jsr.io/@oscar6echo/postgres/3.4.5-d/src/query.js:36:24)
supabase-edge-functions | at Queries.sql (https://jsr.io/@oscar6echo/postgres/3.4.5-d/src/index.js:113:11)
supabase-edge-functions | at Queries.trackWorkerFunction (https://jsr.io/@pgflow/edge-worker/0.14.0/src/core/Queries.ts:58:19)
And running down the error in the source it looks as though its because of the way the supervisor/pooler service is resolved which thankfully has been thought about. So by simply adding EDGE_WORKER_DB_URL: postgresql://postgres.${POOLER_TENANT_ID}:${POSTGRES_PASSWORD}@supavisor:${POOLER_PROXY_PORT_TRANSACTION}/postgres to the containers environment secion I've been able to successfully run pgflow on a self hosted platform.
Anyways long story short. If the user:
- Updates the
supabase/postgresimage to 15.14.1.098 (or later; moving to 17 images caused more issues so just bumped the 15 version) - Follows the manual installation guide
- Explicitly set the (edge worker connection](https://www.pgflow.dev/deploy/database-connection/) inline with the environment variables (see above's EDGE_WORKER_DB_URL. I simply just added this env on the functions container; also it was unclear as to how to use the sql option outlined)
- Adds the appropriate volume mounts for the functions service to access the 'flows' functions provide
Everything seems to work as expected. (And thanks for your great work)