Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: database deployment on Supabase #117

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from
Draft

Conversation

jgoux
Copy link
Contributor

@jgoux jgoux commented Oct 23, 2024

This PR introduces the ability to deploy the in-browser database to Supabase.

I had to use a pretty complicated pipeline in order to do this:

image

This pipeline should be simplified once PGlite releases pg_dump in the browser, in which case we will be able to get rid of the browser-proxy in this scenario.

Infra tasks done:

  • Deployed deploy-worker service on Fly staging environment
  • Applied the migration to our Supabase staging project
  • Added the new env variables to Vercel's preview environment
  • Added the callback url "/api/oauth/supabase/callback" to the authorized callback urls in the Supabase Oauth app

Things to polish:

  • Review scopes we truly need from the Supabase account during the Oauth app sign in: Databases read-only, Projects read+write, Organizations read-only.
  • Handle the app removal from Authorized Apps in the organization's Oauth App's screen
  • Reliability of the deployment process, currently it's a giant function which creates a new Supabase project (first deployment), wait for the project to be healthy, and then do the data transfer. This will be done later using Supabase Workflows
  • Check for revokation at deployment start
  • Use the management API to create a temporary db user for pg_restore to avoid storing the project's db password
  • Implement the authorization flow in a new tab. Redirect to a "finalizing authorization" screen which will call the /oauth/callback api endpoint and communicate to the main tab through a BroadcastChannel on success. The main tab will then redirect to the deploy page. The app needs to be "locked" anyway so let's not overthink this and keep the current implementation.
  • Save the org's name to display it in an intermediate dialog after the authorize dialog is done to explain to the user what's going to happen and have them confirm they want to do the deployment
  • Add an intermediate dialog when clicking to "Deploy > Supabase" to show the infos we have about the integration (org name, project name, database and pooler urls) and an action to confirm the deploy/redeploy

Copy link

vercel bot commented Oct 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
database-build ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 15, 2024 9:38am
postgres-new ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 15, 2024 9:38am

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