charts
charts copied to clipboard
[bitnami/supabase] Auth pod failing in self-hosted Supabase in Kubernetes with external DB
Name and Version
bitnami/supabase 4.0.3
What architecture are you using?
None
What steps will reproduce the bug?
Execute this command:
helm upgrade --install supabase bitnami/supabase --version 4.0.3 -n supabase --values=./values.example.yaml
Are you using any custom parameters or values?
Where the file values.example.yaml contains:
studio:
ingress:
path: /
enabled: true
hostname: 'localhost'
ingressClassName: nginx
postgresql:
enabled: false
externalDatabase:
host: 'my.external.db.host'
port: '5432'
user: 'supabase_admin'
database: 'supabase'
password: 'mysecretpassword'
existingSecret: 'supabase-externaldb'
existingSecretPasswordKey: db-password
What is the expected behavior?
All pods running correctly and connected to the configured External DB
What do you see instead?
Auth pod fails to start with the following error log:
{"level":"info","msg":"Go runtime metrics collection started","time":"2024-04-29T13:17:17Z"}
{"args":[".spdx-gotrue.spdx"],"component":"pop","level":"warning","msg":"ignoring file %s because it does not match the migration file pattern","time":"2024-04-29T13:17:17Z"}
{"args":["auth"],"component":"pop","level":"warning","msg":"ignoring file %s because it does not match the migration file pattern","time":"2024-04-29T13:17:17Z"}
{"args":["gotrue"],"component":"pop","level":"warning","msg":"ignoring file %s because it does not match the migration file pattern","time":"2024-04-29T13:17:17Z"}
{"args":["gotrue-2.149.0.txt"],"component":"pop","level":"warning","msg":"ignoring file %s because it does not match the migration file pattern","time":"2024-04-29T13:17:17Z"}
{"args":[0.018388729],"component":"pop","level":"info","msg":"%.4f seconds","time":"2024-04-29T13:17:17Z"}
{"level":"fatal","msg":"running db migrations: Migrator: problem creating schema migrations: could not execute CREATE TABLE \"schema_migrations\" (\n\"version\" VARCHAR (14) NOT NULL,\nPRIMARY KEY(\"version\")\n);\nCREATE UNIQUE INDEX \"schema_migrations_version_idx\" ON \"schema_migrations\" (version);: ERROR: no schema has been selected to create in (SQLSTATE 3F000)","time":"2024-04-29T13:17:17Z"}
Additional information
problem creating schema migrations: could not execute CREATE TABLE \"schema_migrations\"
no schema has been selected to create in (SQLSTATE 3F000)
Could you provide more details about the external database you're using? For reference, the bundled database is PostgreSQL version 16.2.0
hi @carrodher
I used this Postges image to test it: postgres:16.2
You can run this command to start it:
docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -e POSTGRES_USER=supabase_admin -e POSTGRES_DB=supabase -d postgres:16.2
I am using the same configuration, same error no schema has been selected to create in (SQLSTATE 3F000)
. External DB with admin user. All pods can connect - the initial migration script seems to fail. I am using a managed PostgreSQL 15 database.
👋 I've successfully reproduced the issue and I'm looking into it.
same configuration, same error no schema has been selected to create in (SQLSTATE 3F000)
, with PostgreSQL 16.3.0 as External DB.
hi @alemorcuq
any updates on this issue?
thanks
This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.
hi @carrodher @alemorcuq
any updates on this issue?
thanks
Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.
hi @carrodher @alemorcuq I'm currently experiencing the same issue. Is there any fix for this?
This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.
Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.
Is there any update on this?
Our team is considering migrating to the Bitnami Supabase Helm chart, but this seems like a critical issue that has been open for nearly 90 days without responsive communication from the Bitnami team. This raises concerns about how well-maintained this chart is.
@BeechyM were you able to find a workaround for the auth pod, or is this an ongoing blocker?
Our team is considering migrating to the Bitnami Supabase Helm chart, but this seems like a critical issue that has been open for nearly 90 days without responsive communication from the Bitnami team. This raises concerns about how well-maintained this chart is.
@BeechyM were you able to find a workaround for the auth pod, or is this an ongoing blocker?
We haven't found a solution yet, do use this Helm Chart with en external Database
I can reproduce the issue in the following environment:
$ kind create cluster
$ helm install postgresql oci://registry-1.docker.io/bitnamicharts/postgresql --version 15.5.20 --set auth.username=supabase_admin,auth.password=mysecretpassword,auth.database=supabase
$ cat <<EOF >/tmp/values.example.yaml
postgresql:
enabled: false
externalDatabase:
host: postgresql.default.svc.cluster.local
port: 5432
user: supabase_admin
database: supabase
password: mysecretpassword
EOF
$ helm install supabase oci://registry-1.docker.io/bitnamicharts/supabase --version 5.3.3 --values=/tmp/values.example.yaml
$ kubectl logs deployment/supabase-auth -c gotrue | grep fatal
{"level":"fatal","msg":"running db migrations: Migrator: problem creating schema migrations: could not execute CREATE TABLE \"schema_migrations\" (\n\"version\" VARCHAR (14) NOT NULL,\nPRIMARY KEY(\"version\")\n);\nCREATE UNIQUE INDEX \"schema_migrations_version_idx\" ON \"schema_migrations\" (version);: ERROR: no schema has been selected to create in (SQLSTATE 3F000)","time":"2024-08-08T09:11:56Z"}
The problem here is that supabase is not expected to connect to a bare PostgreSQL database. Instead it has some requirements. Mainly (please, do not take this as an exhaustive list), those are:
Those migrations lead to have some hardcoded database configurations, as commented in the chart templates:
https://github.com/bitnami/charts/blob/95148a9ae1363f9da6415b64085aadfd8add1413/bitnami/supabase/templates/_helpers.tpl#L461-L464
https://github.com/bitnami/charts/blob/95148a9ae1363f9da6415b64085aadfd8add1413/bitnami/supabase/templates/_helpers.tpl#L475-L476
If you wanted to run PostgreSQL externally, you would need to meet those requirements, or use the bitnami/supabase-postgres
container image that bundles all the required extensions and migration scripts (that is what it is done by this chart if postgresql.enabled=true
)
$ kind create cluster
$ cat <<EOF >/tmp/values.postgresql.yaml
image:
repository: bitnami/supabase-postgres
tag: 15.6.1-debian-12-r2
postgresqlSharedPreloadLibraries: "pg_stat_statements, pg_stat_monitor, pgaudit, plpgsql, plpgsql_check, pg_cron, pg_net, pgsodium, timescaledb, auto_explain"
auth:
postgresPassword: mysecretpassword
EOF
$ helm install postgresql oci://registry-1.docker.io/bitnamicharts/postgresql --version 15.5.20 --values /tmp/values.postgresql.yaml
$ cat <<EOF >/tmp/values.supabase.yaml
postgresql:
enabled: false
externalDatabase:
host: postgresql.default.svc.cluster.local
port: 5432
user: supabase_admin
database: postgres # hardcoded
password: mysecretpassword # hardcoded
EOF
$ helm install supabase oci://registry-1.docker.io/bitnamicharts/supabase --version 5.3.3 --values /tmp/values.supabase.yaml
This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.
Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.