Uh oh!
There was an error while loading. Please reload this page.
Fixing bootstrapping issues with migrations. - #2047
Conversation
siennathesane
commented
Jun 8, 2025
@kangmingtay can you please review this so it can get merged? It's an ongoing issue for a lot for people. |
Signed-off-by: Sienna Satterwhite <sienna@r3t.io>
ca5c731 to
25697bcComparewillnode
commented
Jul 14, 2025
+1 |
siennathesane
commented
Jul 16, 2025
I guess supabase really doesn't care about OSS contributions |
6f2c5c9 to
5f2b660Comparecstockton
commented
Aug 4, 2025
Hi @siennathesane@willnode — First I wanted to say we do care and appreciate both your contributions very much. Sorry for the delay on these reviews, I'll bring this up with the team to brainstorm how to improve. I reviewed all the migration related PRs/issues and wanted to ensure the original contributions from @willnode (#1983, #2040) and the (id::text = user_id::text fix) in #2047 were preserved correctly so I was going to create a new PR with everything cherry picked. I mistakingly force pushed to the wrong upstream after cherry picking 1983 & 2040, which lost the ID change. To try to fix this I reintroduced your id migration fix as a separate commit using your previous git log message and commit. However, I noticed that GitHub now marks your commit as unverified since it didn’t come from your GPG key, and I want to respect your authorship standards. If you would like to force push a signed commit and tag me I'll make sure this gets reviewed. Sorry for the trouble but looking forward to getting these migration pulls and issues closed out. |
willnode
commented
Aug 4, 2025
You can force push again to the original commit 25697bc which should restore this PR |
5072c4d to
25697bcComparecstockton
commented
Aug 4, 2025
@willnode Since you are okay with losing authorship I've restored the prior commit. Thank you! |
siennathesane
commented
Aug 5, 2025
@willnode when I wrote this, I had included your fixes plus my own. Didn't mean to erase your contribution at all! 🫶 |
willnode
commented
Aug 6, 2025
LGTM |
Pull Request Test Coverage Report for Build 20113075029Details
💛 - Coveralls |
bartcode
commented
Oct 3, 2025
Could this be merged still, @willnode ? There hasn't been an update in two months even though everything is good to go. A lot of people must be waiting for this issue to be fixed. @siennathesane , thank you for this fix! I ran into this exact same issue and luckily found your open PR. |
cstockton
commented
Dec 10, 2025
Sorry for the delay here, I'll merge this after tests run. |
Uh oh!
There was an error while loading. Please reload this page.
## What kind of change does this PR introduce? Big fix for #1729, #1848, #1983, and #2040 with an additional type fix. ## What is the current behavior? The auth service cannot be deployed in a net new environment on PostgreSQL 17. ## What is the new behavior? The service is running properly with PostgreSQL 17 in a cleanroom environment. ## Additional context Here is a redacted version of the terraform I used to deploy it with. I used my own container build with these fixes, `ghcr.io/siennathesane/auth:v2.175.0`, that you can use to verify the fix is valid, if you want. ```hcl locals { f2-auth-db-namespace = "auth" } resource "kubernetes_service_account" "f2-auth" { metadata { name = "f2-auth" namespace = var.namespace } } resource "kubernetes_manifest" "f2-auth-db" { manifest = { "apiVersion" = "postgresql.cnpg.io/v1" "kind" = "Database" "metadata" = { "name" = "f2-auth-db" "namespace" = var.namespace } "spec" = { "cluster" = { "name" = kubernetes_manifest.f2-cluster.object.metadata.name } "allowConnections" = true "name" = local.f2-auth-db-namespace "owner" = kubernetes_secret_v1.f2-auth-db.data.username "schemas" = [{ "name" = local.f2-auth-db-namespace "owner" = kubernetes_secret_v1.f2-auth-db.data.username }] } } } resource "kubernetes_config_map_v1" "f2-auth-initdb" { metadata { name = "sql-commands" namespace = var.namespace } data = { "script.sql" = <<-EOT ALTER USER ${kubernetes_secret_v1.f2-auth-db.data.username} WITH LOGIN CREATEROLE CREATEDB REPLICATION BYPASSRLS; GRANT ${kubernetes_secret_v1.f2-auth-db.data.username} TO postgres; CREATE SCHEMA IF NOT EXISTS ${local.f2-auth-db-namespace} AUTHORIZATION ${kubernetes_secret_v1.f2-auth-db.data.username}; GRANT CREATE ON DATABASE postgres TO ${kubernetes_secret_v1.f2-auth-db.data.username}; ALTER USER ${kubernetes_secret_v1.f2-auth-db.data.username} SET search_path = '${local.f2-auth-db-namespace}'; EOT } } resource "kubernetes_secret_v1" "f2-auth-db" { metadata { name = "auth-db" namespace = var.namespace labels = { "cnpg.io/reload" = "true" } } data = { username = "[REDACTED]" password = random_password.f2-auth-db-password.result database = "auth" } type = "kubernetes.io/basic-auth" } resource "kubernetes_secret_v1" "f2-auth-jwt" { metadata { name = "auth-jwt" namespace = var.namespace } data = { anonKey = "[REDACTED]" secret = "[REDACTED]" serviceKey = "[REDACTED]" } type = "Opaque" } resource "random_password" "f2-auth-db-password" { length = 16 special = false } resource "kubernetes_deployment_v1" "f2-auth" { depends_on = [kubernetes_manifest.f2-auth-db] timeouts { create = "2m" } metadata { name = "f2auth" labels = { "f2.pub/app" = "auth-${var.environment}" } namespace = var.namespace } spec { replicas = 1 selector { match_labels = { "f2.pub/app" = "auth-${var.environment}" } } template { metadata { labels = { "f2.pub/app" = "auth-${var.environment}" } } spec { image_pull_secrets { name = var.ghcr-pull-secret-name } init_container { name = "init-db" image = "postgres:17-alpine" command = ["psql", "-f", "/sql/script.sql"] env { name = "PGHOST" value = "${kubernetes_manifest.f2-cluster.object.metadata.name}-rw" } env { name = "PGPORT" value = "5432" } env { name = "PGDATABASE" value = kubernetes_secret_v1.f2-auth-db.data.database } env { name = "PGUSER" value = kubernetes_secret_v1.f2-auth-db.data.username } env { name = "PGPASSWORD" value = kubernetes_secret_v1.f2-auth-db.data.password } volume_mount { name = "sql-volume" mount_path = "/sql" } } volume { name = "sql-volume" config_map { name = kubernetes_config_map_v1.f2-auth-initdb.metadata[0].name } } container { image = "ghcr.io/siennathesane/auth:${var.goauth-version}" image_pull_policy = "Always" name = "auth" resources { limits = { cpu = "0.5" memory = "512Mi" } requests = { cpu = "250m" memory = "50Mi" } } port { name = "http" container_port = 9999 protocol = "TCP" } env { name = "GOTRUE_DB_DRIVER" value = "postgres" } env { name = "DB_NAMESPACE" value = "auth" } env { name = "DATABASE_URL" value = "postgres://${kubernetes_secret_v1.f2-auth-db.data.username}:[REDACTED]@${ kubernetes_manifest.f2-cluster.object.metadata.name}-rw:5432/${kubernetes_secret_v1.f2-auth-db.data.database}" } env { name = "GOTRUE_JWT_SECRET" value_from { secret_key_ref { name = "auth-jwt" key = "secret" } } } env { name = "API_EXTERNAL_URL" value = "http://[REDACTED]" } env { name = "GOTRUE_SITE_URL" value = "http://[REDACTED]" } env { name = "GOTRUE_API_HOST" value = "0.0.0.0" } env { name = "PORT" value = "9999" } } } } } } ``` Closes#1729Closes#1848Closes#1983Closes#2040 Signed-off-by: Sienna Satterwhite <sienna@r3t.io> Co-authored-by: Chris Stockton <180184+cstockton@users.noreply.github.com>
What kind of change does this PR introduce?
Big fix for #1729, #1848, #1983, and #2040 with an additional type fix.
What is the current behavior?
The auth service cannot be deployed in a net new environment on PostgreSQL 17.
What is the new behavior?
The service is running properly with PostgreSQL 17 in a cleanroom environment.
Additional context
Here is a redacted version of the terraform I used to deploy it with. I used my own container build with these fixes,
ghcr.io/siennathesane/auth:v2.175.0, that you can use to verify the fix is valid, if you want.Closes#1729
Closes#1848
Closes#1983
Closes#2040