From f652a162645c3dbab15ccc9490a645913341a3ed Mon Sep 17 00:00:00 2001 From: gharvey Date: Fri, 2 Aug 2024 10:42:29 -0700 Subject: [PATCH 01/45] Adds separate supabase realtime config for websocket/api --- .../manifests/declarative-conf-configmap.yaml | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/packages/supabase/manifests/declarative-conf-configmap.yaml b/packages/supabase/manifests/declarative-conf-configmap.yaml index 8a4620f2c..344ec2f48 100644 --- a/packages/supabase/manifests/declarative-conf-configmap.yaml +++ b/packages/supabase/manifests/declarative-conf-configmap.yaml @@ -95,11 +95,31 @@ data: - admin - anon - - name: realtime-v1 - _comment: "Realtime: /realtime/v1/* -> ws://supabase-realtime:80/socket/*" - url: http://supabase-realtime:80/socket + - name: realtime-v1-ws + _comment: "Realtime: /realtime/v1/* -> ws://supabase-realtime:80/socket/websocket/*" + url: http://supabase-realtime:80/socket/websocket routes: - - name: realtime-v1-all + - name: realtime-v1-ws + strip_path: true + paths: + - /realtime/v1/websocket + plugins: + - name: cors + - name: key-auth + config: + hide_credentials: false + - name: acl + config: + hide_groups_header: true + allow: + - admin + - anon + + - name: realtime-v1-api + _comment: "Realtime: /realtime/v1/* -> http://supabase-realtime:80/*" + url: http://supabase-realtime:80 + routes: + - name: realtime-v1-api strip_path: true paths: - /realtime/v1/ From 4b3fd69568b0f43562cfdc41143fd7c9ca99901f Mon Sep 17 00:00:00 2001 From: gharvey Date: Fri, 2 Aug 2024 10:49:51 -0700 Subject: [PATCH 02/45] Updates the default config with necessary vars --- packages/supabase/bitnami-values.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index af26cb2eb..79c7410c1 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -75,6 +75,21 @@ realtime: resourcesPreset: "none" podLabels: sidecar.istio.io/inject: "false" + defaultConfig: | + DB_HOST: {{ include "supabase.database.host" . | quote }} + DB_PORT: {{ include "supabase.database.port" . | quote }} + DB_NAME: {{ include "supabase.database.name" . | quote }} + DB_SSL: {{ .Values.dbSSL | quote }} + PORT: {{ .Values.realtime.containerPorts.http | quote }} + APP_NAME: "supabase-realtime" + ERL_AFLAGS: "-proto_dist inet_tcp" + REPLICATION_MODE: "RLS" + REPLICATION_POLL_INTERVAL: "100" + SECURE_CHANNELS: "true" + SLOT_NAME: "supabase_realtime_rls" + TEMPORARY_SLOT: "true" + DB_ENC_KEY: "testenckeychaangethisforsuresure" + DNS_NODES: "''" rest: enabled: ###ZARF_VAR_ENABLE_REST### From f6d4166298baac263a91a382278ce6d6dc1a3998 Mon Sep 17 00:00:00 2001 From: gharvey Date: Fri, 2 Aug 2024 10:57:28 -0700 Subject: [PATCH 03/45] Adds init container placeholder for seeding tables via curl --- packages/supabase/bitnami-values.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 79c7410c1..e989cf3f0 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -90,6 +90,11 @@ realtime: TEMPORARY_SLOT: "true" DB_ENC_KEY: "testenckeychaangethisforsuresure" DNS_NODES: "''" + initContainers: + - name: realtime-init + image: docker.io/bitnami/os-shell:12-debian-12-r19 + imagePullPolicy: Always + command: ['sh', '-c', 'echo "hello world"'] rest: enabled: ###ZARF_VAR_ENABLE_REST### From 775339b40d7490ed8563fba8e7e1802029412c97 Mon Sep 17 00:00:00 2001 From: gharvey Date: Fri, 2 Aug 2024 11:05:41 -0700 Subject: [PATCH 04/45] Moves configmap changes to extra configs --- packages/supabase/bitnami-values.yaml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index e989cf3f0..c801bbbb1 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -75,19 +75,8 @@ realtime: resourcesPreset: "none" podLabels: sidecar.istio.io/inject: "false" - defaultConfig: | - DB_HOST: {{ include "supabase.database.host" . | quote }} - DB_PORT: {{ include "supabase.database.port" . | quote }} - DB_NAME: {{ include "supabase.database.name" . | quote }} - DB_SSL: {{ .Values.dbSSL | quote }} - PORT: {{ .Values.realtime.containerPorts.http | quote }} + extraConfig: | APP_NAME: "supabase-realtime" - ERL_AFLAGS: "-proto_dist inet_tcp" - REPLICATION_MODE: "RLS" - REPLICATION_POLL_INTERVAL: "100" - SECURE_CHANNELS: "true" - SLOT_NAME: "supabase_realtime_rls" - TEMPORARY_SLOT: "true" DB_ENC_KEY: "testenckeychaangethisforsuresure" DNS_NODES: "''" initContainers: From e6d5394c706868fbb5bdb24fba0b1f2c7a5d1eb1 Mon Sep 17 00:00:00 2001 From: gharvey Date: Fri, 2 Aug 2024 11:14:35 -0700 Subject: [PATCH 05/45] Renames variable for compatbility with supabase version --- packages/supabase/bitnami-values.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index c801bbbb1..4f85548bc 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -76,7 +76,8 @@ realtime: podLabels: sidecar.istio.io/inject: "false" extraConfig: | - APP_NAME: "supabase-realtime" + ALLOC_ID: "supabase-realtime" + FLY_APP_NAME: "supabase-realtime" DB_ENC_KEY: "testenckeychaangethisforsuresure" DNS_NODES: "''" initContainers: From 427ffce6493c2c5fda067d45a6b9b984796e8006 Mon Sep 17 00:00:00 2001 From: gharvey Date: Fri, 2 Aug 2024 11:20:08 -0700 Subject: [PATCH 06/45] Ensures configmap is mounted in container --- packages/supabase/bitnami-values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 4f85548bc..b99171453 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -80,6 +80,7 @@ realtime: FLY_APP_NAME: "supabase-realtime" DB_ENC_KEY: "testenckeychaangethisforsuresure" DNS_NODES: "''" + extraConfigExistingConfigmap: "supabase-realtime-extra" initContainers: - name: realtime-init image: docker.io/bitnami/os-shell:12-debian-12-r19 From 7ba856691048bd4d8eb95eaccdfbe213e5c00eaf Mon Sep 17 00:00:00 2001 From: gharvey Date: Fri, 2 Aug 2024 11:25:23 -0700 Subject: [PATCH 07/45] Specify the variables manuallY --- packages/supabase/bitnami-values.yaml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index b99171453..9991f6a7d 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -75,12 +75,15 @@ realtime: resourcesPreset: "none" podLabels: sidecar.istio.io/inject: "false" - extraConfig: | - ALLOC_ID: "supabase-realtime" - FLY_APP_NAME: "supabase-realtime" - DB_ENC_KEY: "testenckeychaangethisforsuresure" - DNS_NODES: "''" - extraConfigExistingConfigmap: "supabase-realtime-extra" + extraEnvVars: + - name: ALLOC_ID + value: "supabase-realtime" + - name: FLY_APP_NAME + value: "supabase-realtime" + - name: DB_ENC_KEY + value: "testenckeychaangethisforsuresure" + - name: DNS_NODES + value: "''" initContainers: - name: realtime-init image: docker.io/bitnami/os-shell:12-debian-12-r19 From 62a2793c9bf5ec2502fb82d34e6e8da48480216f Mon Sep 17 00:00:00 2001 From: gharvey Date: Fri, 2 Aug 2024 11:27:55 -0700 Subject: [PATCH 08/45] Fixes env var typo --- packages/supabase/bitnami-values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 9991f6a7d..f63344b64 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -76,7 +76,7 @@ realtime: podLabels: sidecar.istio.io/inject: "false" extraEnvVars: - - name: ALLOC_ID + - name: FLY_ALLOC_ID value: "supabase-realtime" - name: FLY_APP_NAME value: "supabase-realtime" From 86f0b4ba9067db976f777eedd46a84725a64a8b4 Mon Sep 17 00:00:00 2001 From: gharvey Date: Fri, 2 Aug 2024 12:26:57 -0700 Subject: [PATCH 09/45] Adds script to seed the realtime instance --- packages/supabase/bitnami-values.yaml | 13 ++++++++++++- packages/supabase/scripts/setup-db.sh | 28 +++++++++++++++++++++++++++ packages/supabase/zarf.yaml | 3 +++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 packages/supabase/scripts/setup-db.sh diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index f63344b64..6fe5fef5c 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -88,7 +88,18 @@ realtime: - name: realtime-init image: docker.io/bitnami/os-shell:12-debian-12-r19 imagePullPolicy: Always - command: ['sh', '-c', 'echo "hello world"'] + env: + - name: SUPABASE_SERVICE_KEY + valueFrom: + secretKeyRef: + name: '{{ include "supabase.jwt.secretName" . }}' + key: '{{ include "supabase.jwt.serviceSecretKey" . }}' + - name: POSTGRESQL_PASSWORD + valueFrom: + secretKeyRef: + name: supabase-postgresql + key: postgres-password + command: ['sh', '-c', 'scripts/setup-db.sh'] rest: enabled: ###ZARF_VAR_ENABLE_REST### diff --git a/packages/supabase/scripts/setup-db.sh b/packages/supabase/scripts/setup-db.sh new file mode 100644 index 000000000..7397a9b0a --- /dev/null +++ b/packages/supabase/scripts/setup-db.sh @@ -0,0 +1,28 @@ +curl --insecure -L -X POST \ + -H 'Content-Type: application/json' \ + -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" \ + -H "apiKey: $SUPABASE_SERVICE_KEY" \ + -d '{ + "tenant" : { + "name": "supabase-realtime", + "external_id": "supabase-realtime", + "jwt_secret": "testenckeychaangethisforsuresure", + "extensions": [ + { + "type": "postgres_cdc_rls", + "settings": { + "db_name": "postgres", + "db_host": "supabase-postgresql", + "db_user": "supabase_admin", + "db_password": "'$POSTGRESQL_PASSWORD'", + "db_port": "5432", + "region": "us-east-1", + "publication": "supabase_realtime", + "ssl_enforced": "false", + "poll_interval_ms": "100", + "poll_max_record_bytes": "1048576" + } + } + ] + } + }' https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants \ No newline at end of file diff --git a/packages/supabase/zarf.yaml b/packages/supabase/zarf.yaml index 74d04ac9a..390503bf4 100644 --- a/packages/supabase/zarf.yaml +++ b/packages/supabase/zarf.yaml @@ -56,6 +56,9 @@ variables: components: - name: supabase required: true + files: + - source: scripts/setup-db.sh + target: /scripts/setup-db.sh charts: # This exists because the jwt token job fails to run in the main helm chart at the proper time due to its reliance on `helm.sh/hook: post-install`. # This annotation causes it to run at the end of the Supabase Zarf component. From 4d9bbd939383d0135b53f7b33474798ee78333d7 Mon Sep 17 00:00:00 2001 From: gharvey Date: Fri, 2 Aug 2024 12:30:11 -0700 Subject: [PATCH 10/45] Moves script somewhere with permissions --- packages/supabase/bitnami-values.yaml | 2 +- packages/supabase/zarf.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 6fe5fef5c..0e54d00ae 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -99,7 +99,7 @@ realtime: secretKeyRef: name: supabase-postgresql key: postgres-password - command: ['sh', '-c', 'scripts/setup-db.sh'] + command: ['sh', '-c', 'setup-db.sh'] rest: enabled: ###ZARF_VAR_ENABLE_REST### diff --git a/packages/supabase/zarf.yaml b/packages/supabase/zarf.yaml index 390503bf4..2fe586c23 100644 --- a/packages/supabase/zarf.yaml +++ b/packages/supabase/zarf.yaml @@ -58,7 +58,7 @@ components: required: true files: - source: scripts/setup-db.sh - target: /scripts/setup-db.sh + target: setup-db.sh charts: # This exists because the jwt token job fails to run in the main helm chart at the proper time due to its reliance on `helm.sh/hook: post-install`. # This annotation causes it to run at the end of the Supabase Zarf component. From 39cc4d5d46c3b4e8712a15b9446f2141e82cefb0 Mon Sep 17 00:00:00 2001 From: gharvey Date: Fri, 2 Aug 2024 12:35:05 -0700 Subject: [PATCH 11/45] Moves script to values file --- packages/supabase/bitnami-values.yaml | 34 +++++++++++++++++++++++++-- packages/supabase/scripts/setup-db.sh | 28 ---------------------- packages/supabase/zarf.yaml | 3 --- 3 files changed, 32 insertions(+), 33 deletions(-) delete mode 100644 packages/supabase/scripts/setup-db.sh diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 0e54d00ae..f8db12217 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -99,7 +99,37 @@ realtime: secretKeyRef: name: supabase-postgresql key: postgres-password - command: ['sh', '-c', 'setup-db.sh'] + command: + - sh + - -c + - >- + curl --insecure -L -X POST + -H "Content-Type: application/json" + -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" + -H "apiKey: $SUPABASE_SERVICE_KEY" + -d '{ + "tenant": { + "name": "supabase-realtime", + "external_id": "supabase-realtime", + "jwt_secret": "testenckeychaangethisforsuresure", + "extensions": [{ + "type": "postgres_cdc_rls", + "settings": { + "db_name": "postgres", + "db_host": "supabase-postgresql", + "db_user": "supabase_admin", + "db_password": "'"$POSTGRESQL_PASSWORD"'", + "db_port": "5432", + "region": "us-east-1", + "publication": "supabase_realtime", + "ssl_enforced": "false", + "poll_interval_ms": "100", + "poll_max_record_bytes": "1048576" + } + }] + } + }' + https://supabase-kong.###ZARF_VAR_DOMAIN###/realtime/v1/api/tenants rest: enabled: ###ZARF_VAR_ENABLE_REST### @@ -209,4 +239,4 @@ postgresql: ## @param postgresql.postgresqlSharedPreloadLibraries Set the shared_preload_libraries parameter in postgresql.conf ## Setting an empty value in order to force the default extensions of supabase-postgres ## - postgresqlSharedPreloadLibraries: "pg_stat_statements, pg_stat_monitor, pgaudit, plpgsql, plpgsql_check, pg_cron, pg_net, pgsodium, timescaledb, auto_explain, vector" + postgresqlSharedPreloadLibraries: "pg_stat_statements, pg_stat_monitor, pgaudit, plpgsql, plpgsql_check, pg_cron, pg_net, pgsodium, timescaledb, auto_explain, vector" \ No newline at end of file diff --git a/packages/supabase/scripts/setup-db.sh b/packages/supabase/scripts/setup-db.sh deleted file mode 100644 index 7397a9b0a..000000000 --- a/packages/supabase/scripts/setup-db.sh +++ /dev/null @@ -1,28 +0,0 @@ -curl --insecure -L -X POST \ - -H 'Content-Type: application/json' \ - -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" \ - -H "apiKey: $SUPABASE_SERVICE_KEY" \ - -d '{ - "tenant" : { - "name": "supabase-realtime", - "external_id": "supabase-realtime", - "jwt_secret": "testenckeychaangethisforsuresure", - "extensions": [ - { - "type": "postgres_cdc_rls", - "settings": { - "db_name": "postgres", - "db_host": "supabase-postgresql", - "db_user": "supabase_admin", - "db_password": "'$POSTGRESQL_PASSWORD'", - "db_port": "5432", - "region": "us-east-1", - "publication": "supabase_realtime", - "ssl_enforced": "false", - "poll_interval_ms": "100", - "poll_max_record_bytes": "1048576" - } - } - ] - } - }' https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants \ No newline at end of file diff --git a/packages/supabase/zarf.yaml b/packages/supabase/zarf.yaml index 2fe586c23..74d04ac9a 100644 --- a/packages/supabase/zarf.yaml +++ b/packages/supabase/zarf.yaml @@ -56,9 +56,6 @@ variables: components: - name: supabase required: true - files: - - source: scripts/setup-db.sh - target: setup-db.sh charts: # This exists because the jwt token job fails to run in the main helm chart at the proper time due to its reliance on `helm.sh/hook: post-install`. # This annotation causes it to run at the end of the Supabase Zarf component. From dca8c6562cb7b5f96fbd8653be37dd17fffd5beb Mon Sep 17 00:00:00 2001 From: gharvey Date: Fri, 2 Aug 2024 12:39:37 -0700 Subject: [PATCH 12/45] Updates url and var for realtime init container --- packages/supabase/bitnami-values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index f8db12217..0b21ded23 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -111,7 +111,7 @@ realtime: "tenant": { "name": "supabase-realtime", "external_id": "supabase-realtime", - "jwt_secret": "testenckeychaangethisforsuresure", + "jwt_secret": "'"$DB_ENC_KEY"'", "extensions": [{ "type": "postgres_cdc_rls", "settings": { @@ -129,7 +129,7 @@ realtime: }] } }' - https://supabase-kong.###ZARF_VAR_DOMAIN###/realtime/v1/api/tenants + https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants rest: enabled: ###ZARF_VAR_ENABLE_REST### From c254ee3e5159b0a43750c151b5e71b2aca8b406a Mon Sep 17 00:00:00 2001 From: gharvey Date: Fri, 2 Aug 2024 13:33:25 -0700 Subject: [PATCH 13/45] Replace initContainer with sidecars --- packages/supabase/bitnami-values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 0b21ded23..9e90a201f 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -84,7 +84,7 @@ realtime: value: "testenckeychaangethisforsuresure" - name: DNS_NODES value: "''" - initContainers: + sidecars: - name: realtime-init image: docker.io/bitnami/os-shell:12-debian-12-r19 imagePullPolicy: Always From 811cefb2924b31ec2a3d3789e13d580ea3722eb6 Mon Sep 17 00:00:00 2001 From: gharvey Date: Fri, 2 Aug 2024 13:49:56 -0700 Subject: [PATCH 14/45] Adds wait for realtime container --- packages/supabase/bitnami-values.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 9e90a201f..6149cb9b6 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -103,6 +103,9 @@ realtime: - sh - -c - >- + echo "Waiting for supabase-realtime to be ready..."; + until nc -z localhost 4000; do sleep 1; done; + echo "supabase-realtime is ready. Sending curl request..."; curl --insecure -L -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" From 1ec9ad869d464c244ab01003e880ee9e6293fa28 Mon Sep 17 00:00:00 2001 From: gharvey Date: Fri, 2 Aug 2024 13:55:08 -0700 Subject: [PATCH 15/45] Replaces os-shell with busybox --- packages/supabase/bitnami-values.yaml | 4 ++-- packages/supabase/zarf.yaml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 6149cb9b6..5c4816b0e 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -86,8 +86,8 @@ realtime: value: "''" sidecars: - name: realtime-init - image: docker.io/bitnami/os-shell:12-debian-12-r19 - imagePullPolicy: Always + image: docker.io/busybox:stable + imagePullPolicy: IfNotPresent env: - name: SUPABASE_SERVICE_KEY valueFrom: diff --git a/packages/supabase/zarf.yaml b/packages/supabase/zarf.yaml index 74d04ac9a..dd14a519c 100644 --- a/packages/supabase/zarf.yaml +++ b/packages/supabase/zarf.yaml @@ -96,6 +96,7 @@ components: - docker.io/bitnami/supabase-storage:0.48.4-debian-12-r2 - docker.io/bitnami/supabase-studio:0.24.3-debian-12-r3 - docker.io/bitnami/kong:3.6.1-debian-12-r18 + - docker.io/busybox:stable - name: supabase-post-process description: "Perform necessary post processing here" required: true From 2829b415b5503ec6b1baac9d2eed54568891bedc Mon Sep 17 00:00:00 2001 From: gharvey Date: Fri, 2 Aug 2024 14:08:49 -0700 Subject: [PATCH 16/45] Replaces busybox container with a curl container --- packages/supabase/bitnami-values.yaml | 4 ++-- packages/supabase/zarf.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 5c4816b0e..dd8b90a7d 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -86,7 +86,7 @@ realtime: value: "''" sidecars: - name: realtime-init - image: docker.io/busybox:stable + image: docker.io/curlimages/curl:latest imagePullPolicy: IfNotPresent env: - name: SUPABASE_SERVICE_KEY @@ -104,7 +104,7 @@ realtime: - -c - >- echo "Waiting for supabase-realtime to be ready..."; - until nc -z localhost 4000; do sleep 1; done; + until nc -z localhost 9999; do sleep 1; done; echo "supabase-realtime is ready. Sending curl request..."; curl --insecure -L -X POST -H "Content-Type: application/json" diff --git a/packages/supabase/zarf.yaml b/packages/supabase/zarf.yaml index dd14a519c..07e37fabd 100644 --- a/packages/supabase/zarf.yaml +++ b/packages/supabase/zarf.yaml @@ -96,7 +96,7 @@ components: - docker.io/bitnami/supabase-storage:0.48.4-debian-12-r2 - docker.io/bitnami/supabase-studio:0.24.3-debian-12-r3 - docker.io/bitnami/kong:3.6.1-debian-12-r18 - - docker.io/busybox:stable + - docker.io/curlimages/curl:latest - name: supabase-post-process description: "Perform necessary post processing here" required: true From 4a30a4b6e7b6298236b15baada7a90feb579d177 Mon Sep 17 00:00:00 2001 From: gharvey Date: Fri, 2 Aug 2024 14:24:23 -0700 Subject: [PATCH 17/45] Replaces nc wait with curl wait --- packages/supabase/bitnami-values.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index dd8b90a7d..4c7a6b360 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -104,9 +104,7 @@ realtime: - -c - >- echo "Waiting for supabase-realtime to be ready..."; - until nc -z localhost 9999; do sleep 1; done; - echo "supabase-realtime is ready. Sending curl request..."; - curl --insecure -L -X POST + curl --max-time 60 --insecure -L -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" -H "apiKey: $SUPABASE_SERVICE_KEY" From ffa7ffa475018277b99d88d151c07025a3989d67 Mon Sep 17 00:00:00 2001 From: gharvey Date: Mon, 5 Aug 2024 09:40:36 -0700 Subject: [PATCH 18/45] Try to replace how the realtimme seed is happening --- packages/supabase/bitnami-values.yaml | 44 ++++++++++----------------- packages/supabase/zarf.yaml | 1 - 2 files changed, 16 insertions(+), 29 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 4c7a6b360..e6b315ad5 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -86,7 +86,7 @@ realtime: value: "''" sidecars: - name: realtime-init - image: docker.io/curlimages/curl:latest + image: docker.io/bitnami/kubectl:1.30.0-debian-12-r0 imagePullPolicy: IfNotPresent env: - name: SUPABASE_SERVICE_KEY @@ -99,38 +99,26 @@ realtime: secretKeyRef: name: supabase-postgresql key: postgres-password + - name: DB_ENC_KEY + value: "testenckeychaangethisforsuresure" command: - sh - -c - >- echo "Waiting for supabase-realtime to be ready..."; - curl --max-time 60 --insecure -L -X POST - -H "Content-Type: application/json" - -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" - -H "apiKey: $SUPABASE_SERVICE_KEY" - -d '{ - "tenant": { - "name": "supabase-realtime", - "external_id": "supabase-realtime", - "jwt_secret": "'"$DB_ENC_KEY"'", - "extensions": [{ - "type": "postgres_cdc_rls", - "settings": { - "db_name": "postgres", - "db_host": "supabase-postgresql", - "db_user": "supabase_admin", - "db_password": "'"$POSTGRESQL_PASSWORD"'", - "db_port": "5432", - "region": "us-east-1", - "publication": "supabase_realtime", - "ssl_enforced": "false", - "poll_interval_ms": "100", - "poll_max_record_bytes": "1048576" - } - }] - } - }' - https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants + until kubectl get pod supabase-realtime -n leapfrogai -o jsonpath='{.status.containerStatuses[?(@.name=="supabase-realtime")].ready}' | grep -q "true"; do + echo "Waiting for supabase-realtime container to be ready..."; + sleep 5; + done; + echo "supabase-realtime container is ready. Creating job to run curl command..."; + kubectl create job --from=cronjob/curl-job curl-job-$(date +%s) -n leapfrogai; + volumeMounts: + - name: curl-job-config + mountPath: /etc/config + volumes: + - name: curl-job-config + configMap: + name: curl-job-config rest: enabled: ###ZARF_VAR_ENABLE_REST### diff --git a/packages/supabase/zarf.yaml b/packages/supabase/zarf.yaml index 07e37fabd..74d04ac9a 100644 --- a/packages/supabase/zarf.yaml +++ b/packages/supabase/zarf.yaml @@ -96,7 +96,6 @@ components: - docker.io/bitnami/supabase-storage:0.48.4-debian-12-r2 - docker.io/bitnami/supabase-studio:0.24.3-debian-12-r3 - docker.io/bitnami/kong:3.6.1-debian-12-r18 - - docker.io/curlimages/curl:latest - name: supabase-post-process description: "Perform necessary post processing here" required: true From 367738316d0920ff2bd6c37b0d9731ad3158c352 Mon Sep 17 00:00:00 2001 From: gharvey Date: Mon, 5 Aug 2024 11:31:11 -0700 Subject: [PATCH 19/45] Replaces job with inline curl call --- packages/supabase/bitnami-values.yaml | 47 +++++++++++++++++++-------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index e6b315ad5..945c460d0 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -105,20 +105,39 @@ realtime: - sh - -c - >- - echo "Waiting for supabase-realtime to be ready..."; - until kubectl get pod supabase-realtime -n leapfrogai -o jsonpath='{.status.containerStatuses[?(@.name=="supabase-realtime")].ready}' | grep -q "true"; do - echo "Waiting for supabase-realtime container to be ready..."; - sleep 5; - done; - echo "supabase-realtime container is ready. Creating job to run curl command..."; - kubectl create job --from=cronjob/curl-job curl-job-$(date +%s) -n leapfrogai; - volumeMounts: - - name: curl-job-config - mountPath: /etc/config - volumes: - - name: curl-job-config - configMap: - name: curl-job-config + echo "Waiting for supabase-realtime to be ready..."; + until kubectl get pod supabase-realtime -n leapfrogai -o jsonpath='{.status.containerStatuses[?(@.name=="supabase-realtime")].ready}' | grep -q "true"; do + echo "Waiting for supabase-realtime container to be ready..."; + sleep 5; + done; + echo "supabase-realtime container is ready. Running curl command..."; + curl --insecure -L -X POST + -H "Content-Type: application/json" + -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" + -H "apiKey: $SUPABASE_SERVICE_KEY" + -d '{ + "tenant": { + "name": "supabase-realtime", + "external_id": "supabase-realtime", + "jwt_secret": "'"$DB_ENC_KEY"'", + "extensions": [{ + "type": "postgres_cdc_rls", + "settings": { + "db_name": "postgres", + "db_host": "supabase-postgresql", + "db_user": "supabase_admin", + "db_password": "'"$POSTGRESQL_PASSWORD"'", + "db_port": "5432", + "region": "us-east-1", + "publication": "supabase_realtime", + "ssl_enforced": "false", + "poll_interval_ms": "100", + "poll_max_record_bytes": "1048576" + } + }] + } + }' + https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants rest: enabled: ###ZARF_VAR_ENABLE_REST### From 395454cc6b5952b9e02a191d87280dd720d40bd0 Mon Sep 17 00:00:00 2001 From: gharvey Date: Mon, 5 Aug 2024 11:39:57 -0700 Subject: [PATCH 20/45] Replaces wget commands with curl --- packages/supabase/bitnami-values.yaml | 68 +++++++++++++-------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 945c460d0..72b9dbd90 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -86,7 +86,7 @@ realtime: value: "''" sidecars: - name: realtime-init - image: docker.io/bitnami/kubectl:1.30.0-debian-12-r0 + image: docker.io/bitnami/os-shell:12-debian-12-r19 imagePullPolicy: IfNotPresent env: - name: SUPABASE_SERVICE_KEY @@ -105,39 +105,39 @@ realtime: - sh - -c - >- - echo "Waiting for supabase-realtime to be ready..."; - until kubectl get pod supabase-realtime -n leapfrogai -o jsonpath='{.status.containerStatuses[?(@.name=="supabase-realtime")].ready}' | grep -q "true"; do - echo "Waiting for supabase-realtime container to be ready..."; - sleep 5; - done; - echo "supabase-realtime container is ready. Running curl command..."; - curl --insecure -L -X POST - -H "Content-Type: application/json" - -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" - -H "apiKey: $SUPABASE_SERVICE_KEY" - -d '{ - "tenant": { - "name": "supabase-realtime", - "external_id": "supabase-realtime", - "jwt_secret": "'"$DB_ENC_KEY"'", - "extensions": [{ - "type": "postgres_cdc_rls", - "settings": { - "db_name": "postgres", - "db_host": "supabase-postgresql", - "db_user": "supabase_admin", - "db_password": "'"$POSTGRESQL_PASSWORD"'", - "db_port": "5432", - "region": "us-east-1", - "publication": "supabase_realtime", - "ssl_enforced": "false", - "poll_interval_ms": "100", - "poll_max_record_bytes": "1048576" - } - }] - } - }' - https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants + echo "Waiting for supabase-realtime to be ready..."; + until curl -s -o /dev/null -w "%{http_code}" http://supabase-realtime.leapfrogai.svc.cluster.local:80/health | grep -q "200"; do + echo "Waiting for supabase-realtime to be ready..."; + sleep 5; + done; + echo "supabase-realtime is ready. Running curl command..."; + curl --insecure -L -X POST + -H "Content-Type: application/json" + -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" + -H "apiKey: $SUPABASE_SERVICE_KEY" + -d '{ + "tenant": { + "name": "supabase-realtime", + "external_id": "supabase-realtime", + "jwt_secret": "'"$DB_ENC_KEY"'", + "extensions": [{ + "type": "postgres_cdc_rls", + "settings": { + "db_name": "postgres", + "db_host": "supabase-postgresql", + "db_user": "supabase_admin", + "db_password": "'"$POSTGRESQL_PASSWORD"'", + "db_port": "5432", + "region": "us-east-1", + "publication": "supabase_realtime", + "ssl_enforced": "false", + "poll_interval_ms": "100", + "poll_max_record_bytes": "1048576" + } + }] + } + }' + https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants rest: enabled: ###ZARF_VAR_ENABLE_REST### From f99eda0f0660b51c7c047aaa15057eb7d193c489 Mon Sep 17 00:00:00 2001 From: gharvey Date: Mon, 5 Aug 2024 11:45:31 -0700 Subject: [PATCH 21/45] Replaces invalid health endpoint on realtime --- packages/supabase/bitnami-values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 72b9dbd90..03a277531 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -106,7 +106,7 @@ realtime: - -c - >- echo "Waiting for supabase-realtime to be ready..."; - until curl -s -o /dev/null -w "%{http_code}" http://supabase-realtime.leapfrogai.svc.cluster.local:80/health | grep -q "200"; do + until curl -s -o /dev/null -w "%{http_code}" http://supabase-realtime.leapfrogai.svc.cluster.local:80/ | grep -q "200"; do echo "Waiting for supabase-realtime to be ready..."; sleep 5; done; From 032709528a1fe6111f295b03a9b1a8730907f1b8 Mon Sep 17 00:00:00 2001 From: gharvey Date: Mon, 5 Aug 2024 11:49:31 -0700 Subject: [PATCH 22/45] Moves the curl command to one line --- packages/supabase/bitnami-values.yaml | 28 +-------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 03a277531..4fdd6b670 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -111,33 +111,7 @@ realtime: sleep 5; done; echo "supabase-realtime is ready. Running curl command..."; - curl --insecure -L -X POST - -H "Content-Type: application/json" - -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" - -H "apiKey: $SUPABASE_SERVICE_KEY" - -d '{ - "tenant": { - "name": "supabase-realtime", - "external_id": "supabase-realtime", - "jwt_secret": "'"$DB_ENC_KEY"'", - "extensions": [{ - "type": "postgres_cdc_rls", - "settings": { - "db_name": "postgres", - "db_host": "supabase-postgresql", - "db_user": "supabase_admin", - "db_password": "'"$POSTGRESQL_PASSWORD"'", - "db_port": "5432", - "region": "us-east-1", - "publication": "supabase_realtime", - "ssl_enforced": "false", - "poll_interval_ms": "100", - "poll_max_record_bytes": "1048576" - } - }] - } - }' - https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants + curl --insecure -L -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" -H "apiKey: $SUPABASE_SERVICE_KEY" -d '{"tenant":{"name":"supabase-realtime","external_id":"supabase-realtime","jwt_secret":"'"$DB_ENC_KEY"'","extensions":[{"type":"postgres_cdc_rls","settings":{"db_name":"postgres","db_host":"supabase-postgresql","db_user":"supabase_admin","db_password":"'"$POSTGRESQL_PASSWORD"'","db_port":"5432","region":"us-east-1","publication":"supabase_realtime","ssl_enforced":"false","poll_interval_ms":"100","poll_max_record_bytes":"1048576"}}]}}' https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants rest: enabled: ###ZARF_VAR_ENABLE_REST### From 18fccace9e56b703db86115c22e6a66cd768ac9a Mon Sep 17 00:00:00 2001 From: gharvey Date: Mon, 5 Aug 2024 14:33:06 -0700 Subject: [PATCH 23/45] Updates versions of supabase-realtime --- packages/supabase/bitnami-values.yaml | 12 +++++------- packages/supabase/zarf.yaml | 26 +++++++++++++------------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 4fdd6b670..9db2a745c 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -76,17 +76,15 @@ realtime: podLabels: sidecar.istio.io/inject: "false" extraEnvVars: - - name: FLY_ALLOC_ID - value: "supabase-realtime" - - name: FLY_APP_NAME + - name: APP_NAME value: "supabase-realtime" - name: DB_ENC_KEY value: "testenckeychaangethisforsuresure" - name: DNS_NODES - value: "''" + value: "supabase-realtime" sidecars: - name: realtime-init - image: docker.io/bitnami/os-shell:12-debian-12-r19 + image: docker.io/bitnami/os-shell:12-debian-12-r27 imagePullPolicy: IfNotPresent env: - name: SUPABASE_SERVICE_KEY @@ -144,7 +142,7 @@ volumePermissions: resourcesPreset: "none" psqlImage: - tag: 15.1.1-debian-12-r69 + tag: 15.6.1-debian-12-r2 kong: enabled: ###ZARF_VAR_ENABLE_KONG### @@ -209,7 +207,7 @@ kong: postgresql: enabled: ###ZARF_VAR_ENABLE_POSTGRES### image: - tag: 15.1.1-debian-12-r69 + tag: 15.6.1-debian-12-r2 debug: true primary: resourcesPreset: "none" diff --git a/packages/supabase/zarf.yaml b/packages/supabase/zarf.yaml index 74d04ac9a..094219fcd 100644 --- a/packages/supabase/zarf.yaml +++ b/packages/supabase/zarf.yaml @@ -66,7 +66,7 @@ components: namespace: leapfrogai url: oci://registry-1.docker.io/bitnamicharts/supabase releaseName: supabase-bootstrap - version: 4.0.5 + version: 5.3.3 valuesFiles: - "bitnami-values.yaml" - "bitnami-values-bootstrap.yaml" @@ -81,21 +81,21 @@ components: namespace: leapfrogai url: oci://registry-1.docker.io/bitnamicharts/supabase releaseName: supabase - version: 4.0.5 + version: 5.3.3 valuesFiles: - "bitnami-values.yaml" images: - - docker.io/bitnami/gotrue:2.150.1-debian-12-r1 - - docker.io/bitnami/jwt-cli:6.0.0-debian-12-r20 - - docker.io/bitnami/kubectl:1.30.0-debian-12-r0 - - docker.io/bitnami/os-shell:12-debian-12-r19 - - docker.io/bitnami/postgrest:11.2.2-debian-12-r15 - - docker.io/bitnami/supabase-postgres:15.1.1-debian-12-r69 - - docker.io/bitnami/supabase-postgres-meta:0.80.0-debian-12-r3 - - docker.io/bitnami/supabase-realtime:2.28.32-debian-12-r2 - - docker.io/bitnami/supabase-storage:0.48.4-debian-12-r2 - - docker.io/bitnami/supabase-studio:0.24.3-debian-12-r3 - - docker.io/bitnami/kong:3.6.1-debian-12-r18 + - docker.io/bitnami/gotrue:2.155.6-debian-12-r3 + - docker.io/bitnami/jwt-cli:6.1.0-debian-12-r5 + - docker.io/bitnami/kubectl:1.30.3-debian-12-r4 + - docker.io/bitnami/os-shell:12-debian-12-r27 + - docker.io/bitnami/postgrest:11.2.2-debian-12-r31 + - docker.io/bitnami/supabase-postgres:15.6.1-debian-12-r2 + - docker.io/bitnami/supabase-postgres-meta:0.83.2-debian-12-r3 + - docker.io/bitnami/supabase-realtime:2.30.14-debian-12-r2 + - docker.io/bitnami/supabase-storage:1.8.2-debian-12-r2 + - docker.io/bitnami/supabase-studio:1.24.5-debian-12-r4 + - docker.io/bitnami/kong:3.7.1-debian-12-r5 - name: supabase-post-process description: "Perform necessary post processing here" required: true From 57765329fd4304289d545c0e6737215a20486be4 Mon Sep 17 00:00:00 2001 From: gharvey Date: Mon, 5 Aug 2024 15:11:03 -0700 Subject: [PATCH 24/45] Sets the ENC_KEY to a default value of 16 chars --- packages/supabase/bitnami-values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 9db2a745c..6621a5451 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -79,7 +79,7 @@ realtime: - name: APP_NAME value: "supabase-realtime" - name: DB_ENC_KEY - value: "testenckeychaangethisforsuresure" + value: "testenckeychange" # This needs to be exactly 16 characters - name: DNS_NODES value: "supabase-realtime" sidecars: @@ -98,7 +98,7 @@ realtime: name: supabase-postgresql key: postgres-password - name: DB_ENC_KEY - value: "testenckeychaangethisforsuresure" + value: "testenckeychange" # This needs to be exactly 16 characters command: - sh - -c From 294ec624851e092b18371cfeef8e7cdc13cc0724 Mon Sep 17 00:00:00 2001 From: gharvey Date: Mon, 5 Aug 2024 15:17:40 -0700 Subject: [PATCH 25/45] Makes the sidecar sleep after a successful run to prevent crashbackloops --- packages/supabase/bitnami-values.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 6621a5451..0ecc90457 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -109,7 +109,16 @@ realtime: sleep 5; done; echo "supabase-realtime is ready. Running curl command..."; - curl --insecure -L -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" -H "apiKey: $SUPABASE_SERVICE_KEY" -d '{"tenant":{"name":"supabase-realtime","external_id":"supabase-realtime","jwt_secret":"'"$DB_ENC_KEY"'","extensions":[{"type":"postgres_cdc_rls","settings":{"db_name":"postgres","db_host":"supabase-postgresql","db_user":"supabase_admin","db_password":"'"$POSTGRESQL_PASSWORD"'","db_port":"5432","region":"us-east-1","publication":"supabase_realtime","ssl_enforced":"false","poll_interval_ms":"100","poll_max_record_bytes":"1048576"}}]}}' https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants + if curl --insecure -L -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" -H "apiKey: $SUPABASE_SERVICE_KEY" -d '{"tenant":{"name":"supabase-realtime","external_id":"supabase-realtime","jwt_secret":"'"$DB_ENC_KEY"'","extensions":[{"type":"postgres_cdc_rls","settings":{"db_name":"postgres","db_host":"supabase-postgresql","db_user":"supabase_admin","db_password":"'"$POSTGRESQL_PASSWORD"'","db_port":"5432","region":"us-east-1","publication":"supabase_realtime","ssl_enforced":"false","poll_interval_ms":"100","poll_max_record_bytes":"1048576"}}]}}' https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants; then + echo "Curl command completed successfully. Entering sleep loop..." + while true; do + sleep 3600 + echo "Sidecar still alive" + done + else + echo "Curl command failed. Exiting..." + exit 1 + fi rest: enabled: ###ZARF_VAR_ENABLE_REST### From b7cb54c0426bbad917e5b3534f6b15ef3cb1d605 Mon Sep 17 00:00:00 2001 From: gharvey Date: Wed, 7 Aug 2024 15:25:58 -0700 Subject: [PATCH 26/45] Adds notify private alpha --- packages/supabase/bitnami-values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 0ecc90457..5f814a0d8 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -109,7 +109,7 @@ realtime: sleep 5; done; echo "supabase-realtime is ready. Running curl command..."; - if curl --insecure -L -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" -H "apiKey: $SUPABASE_SERVICE_KEY" -d '{"tenant":{"name":"supabase-realtime","external_id":"supabase-realtime","jwt_secret":"'"$DB_ENC_KEY"'","extensions":[{"type":"postgres_cdc_rls","settings":{"db_name":"postgres","db_host":"supabase-postgresql","db_user":"supabase_admin","db_password":"'"$POSTGRESQL_PASSWORD"'","db_port":"5432","region":"us-east-1","publication":"supabase_realtime","ssl_enforced":"false","poll_interval_ms":"100","poll_max_record_bytes":"1048576"}}]}}' https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants; then + if curl --insecure -L -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" -H "apiKey: $SUPABASE_SERVICE_KEY" -d '{"tenant":{"name":"supabase-realtime","external_id":"supabase-realtime","jwt_secret":"'"$DB_ENC_KEY"'","extensions":[{"type":"postgres_cdc_rls","settings":{"db_name":"postgres","db_host":"supabase-postgresql","db_user":"supabase_admin","db_password":"'"$POSTGRESQL_PASSWORD"'","db_port":"5432","region":"us-east-1","publication":"supabase_realtime","ssl_enforced":"false","poll_interval_ms":"100","poll_max_record_bytes":"1048576"}}],"notify_private_alpha":"true"}}' https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants; then echo "Curl command completed successfully. Entering sleep loop..." while true; do sleep 3600 From 27b96e3529d06fb155ae6c4ec433cacdc4274b55 Mon Sep 17 00:00:00 2001 From: gharvey Date: Wed, 7 Aug 2024 15:30:10 -0700 Subject: [PATCH 27/45] Replaces DB_ENC_KEY with JWT_SECRET --- packages/supabase/bitnami-values.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 5f814a0d8..0bb308868 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -97,8 +97,11 @@ realtime: secretKeyRef: name: supabase-postgresql key: postgres-password - - name: DB_ENC_KEY - value: "testenckeychange" # This needs to be exactly 16 characters + - name: JWT_SECRET + valueFrom: + secretKeyRef: + name: '{{ include "supabase.jwt.secretName" . }}' + key: '{{ include "supabase.realtime.secretKey" . }}' command: - sh - -c @@ -109,7 +112,7 @@ realtime: sleep 5; done; echo "supabase-realtime is ready. Running curl command..."; - if curl --insecure -L -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" -H "apiKey: $SUPABASE_SERVICE_KEY" -d '{"tenant":{"name":"supabase-realtime","external_id":"supabase-realtime","jwt_secret":"'"$DB_ENC_KEY"'","extensions":[{"type":"postgres_cdc_rls","settings":{"db_name":"postgres","db_host":"supabase-postgresql","db_user":"supabase_admin","db_password":"'"$POSTGRESQL_PASSWORD"'","db_port":"5432","region":"us-east-1","publication":"supabase_realtime","ssl_enforced":"false","poll_interval_ms":"100","poll_max_record_bytes":"1048576"}}],"notify_private_alpha":"true"}}' https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants; then + if curl --insecure -L -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" -H "apiKey: $SUPABASE_SERVICE_KEY" -d '{"tenant":{"name":"supabase-realtime","external_id":"supabase-realtime","jwt_secret":"'"$JWT_SECRET"'","extensions":[{"type":"postgres_cdc_rls","settings":{"db_name":"postgres","db_host":"supabase-postgresql","db_user":"supabase_admin","db_password":"'"$POSTGRESQL_PASSWORD"'","db_port":"5432","region":"us-east-1","publication":"supabase_realtime","ssl_enforced":"false","poll_interval_ms":"100","poll_max_record_bytes":"1048576"}}],"notify_private_alpha":"true"}}' https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants; then echo "Curl command completed successfully. Entering sleep loop..." while true; do sleep 3600 From a2932a4c6f0e730842f3f821cb6d9cfee1205152 Mon Sep 17 00:00:00 2001 From: gharvey Date: Wed, 7 Aug 2024 16:02:18 -0700 Subject: [PATCH 28/45] Updates the JWT_SECRET to be correct --- packages/supabase/bitnami-values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 0bb308868..460347a63 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -100,8 +100,8 @@ realtime: - name: JWT_SECRET valueFrom: secretKeyRef: - name: '{{ include "supabase.jwt.secretName" . }}' - key: '{{ include "supabase.realtime.secretKey" . }}' + name: supabase-bootstrap-jwt + key: secret command: - sh - -c From cc85394c2c81b21b2f1170f556a960df5fe8fef5 Mon Sep 17 00:00:00 2001 From: gharvey Date: Wed, 7 Aug 2024 16:11:35 -0700 Subject: [PATCH 29/45] Removes unnecessary quotes that interfere with SSL configs --- packages/supabase/bitnami-values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 460347a63..63be8dc61 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -112,7 +112,7 @@ realtime: sleep 5; done; echo "supabase-realtime is ready. Running curl command..."; - if curl --insecure -L -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" -H "apiKey: $SUPABASE_SERVICE_KEY" -d '{"tenant":{"name":"supabase-realtime","external_id":"supabase-realtime","jwt_secret":"'"$JWT_SECRET"'","extensions":[{"type":"postgres_cdc_rls","settings":{"db_name":"postgres","db_host":"supabase-postgresql","db_user":"supabase_admin","db_password":"'"$POSTGRESQL_PASSWORD"'","db_port":"5432","region":"us-east-1","publication":"supabase_realtime","ssl_enforced":"false","poll_interval_ms":"100","poll_max_record_bytes":"1048576"}}],"notify_private_alpha":"true"}}' https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants; then + if curl --insecure -L -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" -H "apiKey: $SUPABASE_SERVICE_KEY" -d '{"tenant":{"name":"supabase-realtime","external_id":"supabase-realtime","jwt_secret":"'"$JWT_SECRET"'","extensions":[{"type":"postgres_cdc_rls","settings":{"db_name":"postgres","db_host":"supabase-postgresql","db_user":"supabase_admin","db_password":"'"$POSTGRESQL_PASSWORD"'","db_port":"5432","region":"us-east-1","publication":"supabase_realtime","ssl_enforced":false,"poll_interval_ms":100,"poll_max_record_bytes":1048576}}],"notify_private_alpha":true}}' https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants; then echo "Curl command completed successfully. Entering sleep loop..." while true; do sleep 3600 From a33a3bab756ec8c30dec8d111638ac9673c097a1 Mon Sep 17 00:00:00 2001 From: gharvey Date: Thu, 8 Aug 2024 09:27:44 -0700 Subject: [PATCH 30/45] Replaces sidecar based realtime tenant initialization with init args --- packages/supabase/bitnami-values.yaml | 44 +++------------------------ 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 63be8dc61..37501f7ab 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -82,46 +82,10 @@ realtime: value: "testenckeychange" # This needs to be exactly 16 characters - name: DNS_NODES value: "supabase-realtime" - sidecars: - - name: realtime-init - image: docker.io/bitnami/os-shell:12-debian-12-r27 - imagePullPolicy: IfNotPresent - env: - - name: SUPABASE_SERVICE_KEY - valueFrom: - secretKeyRef: - name: '{{ include "supabase.jwt.secretName" . }}' - key: '{{ include "supabase.jwt.serviceSecretKey" . }}' - - name: POSTGRESQL_PASSWORD - valueFrom: - secretKeyRef: - name: supabase-postgresql - key: postgres-password - - name: JWT_SECRET - valueFrom: - secretKeyRef: - name: supabase-bootstrap-jwt - key: secret - command: - - sh - - -c - - >- - echo "Waiting for supabase-realtime to be ready..."; - until curl -s -o /dev/null -w "%{http_code}" http://supabase-realtime.leapfrogai.svc.cluster.local:80/ | grep -q "200"; do - echo "Waiting for supabase-realtime to be ready..."; - sleep 5; - done; - echo "supabase-realtime is ready. Running curl command..."; - if curl --insecure -L -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $SUPABASE_SERVICE_KEY" -H "apiKey: $SUPABASE_SERVICE_KEY" -d '{"tenant":{"name":"supabase-realtime","external_id":"supabase-realtime","jwt_secret":"'"$JWT_SECRET"'","extensions":[{"type":"postgres_cdc_rls","settings":{"db_name":"postgres","db_host":"supabase-postgresql","db_user":"supabase_admin","db_password":"'"$POSTGRESQL_PASSWORD"'","db_port":"5432","region":"us-east-1","publication":"supabase_realtime","ssl_enforced":false,"poll_interval_ms":100,"poll_max_record_bytes":1048576}}],"notify_private_alpha":true}}' https://supabase-kong.leapfrogai.svc.cluster.local/realtime/v1/api/tenants; then - echo "Curl command completed successfully. Entering sleep loop..." - while true; do - sleep 3600 - echo "Sidecar still alive" - done - else - echo "Curl command failed. Exiting..." - exit 1 - fi + args: + - -ec + - | + realtime eval Realtime.Release.migrate && realtime eval Realtime.Release.seeds(Realtime.Repo) && realtime start rest: enabled: ###ZARF_VAR_ENABLE_REST### From 3882e156cd652cb7ac1105552357e6ab1d61ef11 Mon Sep 17 00:00:00 2001 From: gharvey Date: Thu, 8 Aug 2024 09:32:46 -0700 Subject: [PATCH 31/45] Adds back necessary quotes --- packages/supabase/bitnami-values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 37501f7ab..5ef6dfd8d 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -85,7 +85,7 @@ realtime: args: - -ec - | - realtime eval Realtime.Release.migrate && realtime eval Realtime.Release.seeds(Realtime.Repo) && realtime start + realtime eval Realtime.Release.migrate && realtime eval 'Realtime.Release.seeds(Realtime.Repo)' && realtime start rest: enabled: ###ZARF_VAR_ENABLE_REST### From 5296c66d04fd11421eff4e01b2dab7cf07dc86e0 Mon Sep 17 00:00:00 2001 From: gharvey Date: Thu, 8 Aug 2024 09:47:32 -0700 Subject: [PATCH 32/45] Adds migration to update the freshly seeded db --- ...20240808093300_v0.10.0_realtime_tenant.sql | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 packages/supabase/migrations/20240808093300_v0.10.0_realtime_tenant.sql diff --git a/packages/supabase/migrations/20240808093300_v0.10.0_realtime_tenant.sql b/packages/supabase/migrations/20240808093300_v0.10.0_realtime_tenant.sql new file mode 100644 index 000000000..680b55661 --- /dev/null +++ b/packages/supabase/migrations/20240808093300_v0.10.0_realtime_tenant.sql @@ -0,0 +1,22 @@ +-- Disable the foreign key constraint +ALTER TABLE extensions +DROP CONSTRAINT extensions_tenant_external_id_fkey; + +-- Update the external_id and name for the realtime tenant +UPDATE tenants +SET external_id = 'supabase-realtime', + name = 'supabase-realtime' +WHERE external_id = 'realtime-dev' + AND name = 'realtime-dev'; + +-- Update the tenant_external_id for the realtime extension +UPDATE extensions +SET tenant_external_id = 'supabase-realtime' +WHERE tenant_external_id = 'realtime-dev'; + +-- Re-enable the foreign key constraint +ALTER TABLE extensions +ADD CONSTRAINT extensions_tenant_external_id_fkey +FOREIGN KEY (tenant_external_id) +REFERENCES tenants(external_id) +ON DELETE CASCADE; \ No newline at end of file From 673c07a3352c3d123050ce5c47302478dad2ed11 Mon Sep 17 00:00:00 2001 From: gharvey Date: Thu, 8 Aug 2024 10:04:37 -0700 Subject: [PATCH 33/45] Randomly generates enc_secret instead of hard coding it --- packages/supabase/bitnami-values.yaml | 5 ++++- .../templates/suapbase-realtime-secret.yaml | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 packages/supabase/chart/templates/suapbase-realtime-secret.yaml diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 5ef6dfd8d..a1c1e1103 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -79,7 +79,10 @@ realtime: - name: APP_NAME value: "supabase-realtime" - name: DB_ENC_KEY - value: "testenckeychange" # This needs to be exactly 16 characters + valueFrom: + secretKeyRef: + name: supabase-realtime-extra + key: db-enc-key - name: DNS_NODES value: "supabase-realtime" args: diff --git a/packages/supabase/chart/templates/suapbase-realtime-secret.yaml b/packages/supabase/chart/templates/suapbase-realtime-secret.yaml new file mode 100644 index 000000000..613deb20a --- /dev/null +++ b/packages/supabase/chart/templates/suapbase-realtime-secret.yaml @@ -0,0 +1,18 @@ +{{- $dbEncKey := randAlphaNum 16 }} # This needs to be exactly 16 characters +{{- $existingSecret := (lookup "v1" "Secret" .Release.Namespace "supabase-realtime-extra") }} +apiVersion: v1 +kind: Secret +metadata: + name: supabase-realtime-extra + namespace: {{ .Release.Namespace }} + {{- if $existingSecret }} + annotations: + "helm.sh/resource-policy": keep + {{- end }} +type: Opaque +data: + {{- if $existingSecret }} + db-enc-key: {{ $existingSecret.data.db-enc-key }} + {{- else }} + db-enc-key: {{ $dbEncKey | b64enc | quote }} + {{- end }} \ No newline at end of file From 537239e63f23b6f235955a99086e9b84371f86eb Mon Sep 17 00:00:00 2001 From: gharvey Date: Thu, 8 Aug 2024 10:11:57 -0700 Subject: [PATCH 34/45] Replaces secret name to prevent deployment errors --- packages/supabase/bitnami-values.yaml | 2 +- .../templates/suapbase-realtime-secret.yaml | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index a1c1e1103..6a7446c33 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -82,7 +82,7 @@ realtime: valueFrom: secretKeyRef: name: supabase-realtime-extra - key: db-enc-key + key: dbEncKey - name: DNS_NODES value: "supabase-realtime" args: diff --git a/packages/supabase/chart/templates/suapbase-realtime-secret.yaml b/packages/supabase/chart/templates/suapbase-realtime-secret.yaml index 613deb20a..a762df845 100644 --- a/packages/supabase/chart/templates/suapbase-realtime-secret.yaml +++ b/packages/supabase/chart/templates/suapbase-realtime-secret.yaml @@ -3,16 +3,16 @@ apiVersion: v1 kind: Secret metadata: - name: supabase-realtime-extra - namespace: {{ .Release.Namespace }} - {{- if $existingSecret }} - annotations: - "helm.sh/resource-policy": keep - {{- end }} + name: supabase-realtime-extra + namespace: {{ .Release.Namespace }} + {{- if $existingSecret }} + annotations: + "helm.sh/resource-policy": keep + {{- end }} type: Opaque data: - {{- if $existingSecret }} - db-enc-key: {{ $existingSecret.data.db-enc-key }} - {{- else }} - db-enc-key: {{ $dbEncKey | b64enc | quote }} - {{- end }} \ No newline at end of file + {{- if $existingSecret }} + dbEncKey: {{ $existingSecret.data.dbEncKey }} + {{- else }} + dbEncKey: {{ $dbEncKey | b64enc | quote }} + {{- end }} \ No newline at end of file From 92c314fd39c892ae577f2fec3ad47c4911efa91f Mon Sep 17 00:00:00 2001 From: gharvey Date: Thu, 8 Aug 2024 14:28:34 -0700 Subject: [PATCH 35/45] Creates _realtime schema and sets up deployment to use it --- packages/supabase/bitnami-values.yaml | 2 ++ .../migrations/20240808083300_v0.10.0_realtime_schema.sql | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 packages/supabase/migrations/20240808083300_v0.10.0_realtime_schema.sql diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 6a7446c33..78f2d7bd0 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -78,6 +78,8 @@ realtime: extraEnvVars: - name: APP_NAME value: "supabase-realtime" + - name: DB_AFTER_CONNECT_QUERY + value: "SET search_path TO _realtime" - name: DB_ENC_KEY valueFrom: secretKeyRef: diff --git a/packages/supabase/migrations/20240808083300_v0.10.0_realtime_schema.sql b/packages/supabase/migrations/20240808083300_v0.10.0_realtime_schema.sql new file mode 100644 index 000000000..dd646a86c --- /dev/null +++ b/packages/supabase/migrations/20240808083300_v0.10.0_realtime_schema.sql @@ -0,0 +1,3 @@ +-- Create the _realtime schema if it doesn't exist +create schema if not exists _realtime; +alter schema _realtime owner to postgres; \ No newline at end of file From 5b055e575c497290cfcf47d555f03881b6b3efd3 Mon Sep 17 00:00:00 2001 From: gharvey Date: Thu, 8 Aug 2024 14:34:53 -0700 Subject: [PATCH 36/45] Set the search path back to public --- packages/supabase/bitnami-values.yaml | 2 +- .../migrations/20240808083300_v0.10.0_realtime_schema.sql | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 packages/supabase/migrations/20240808083300_v0.10.0_realtime_schema.sql diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 78f2d7bd0..bb2f6ad6b 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -79,7 +79,7 @@ realtime: - name: APP_NAME value: "supabase-realtime" - name: DB_AFTER_CONNECT_QUERY - value: "SET search_path TO _realtime" + value: "SET search_path TO public" - name: DB_ENC_KEY valueFrom: secretKeyRef: diff --git a/packages/supabase/migrations/20240808083300_v0.10.0_realtime_schema.sql b/packages/supabase/migrations/20240808083300_v0.10.0_realtime_schema.sql deleted file mode 100644 index dd646a86c..000000000 --- a/packages/supabase/migrations/20240808083300_v0.10.0_realtime_schema.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Create the _realtime schema if it doesn't exist -create schema if not exists _realtime; -alter schema _realtime owner to postgres; \ No newline at end of file From c04adf683a436371cb5615f22edf9214905ce348 Mon Sep 17 00:00:00 2001 From: gharvey Date: Thu, 8 Aug 2024 14:37:15 -0700 Subject: [PATCH 37/45] Initialize _realtime table in after connect query --- packages/supabase/bitnami-values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index bb2f6ad6b..5bed2dedb 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -79,7 +79,7 @@ realtime: - name: APP_NAME value: "supabase-realtime" - name: DB_AFTER_CONNECT_QUERY - value: "SET search_path TO public" + value: "create schema if not exists _realtime; alter schema _realtime owner to postgres; SET search_path TO _realtime;" - name: DB_ENC_KEY valueFrom: secretKeyRef: From 87e8a522434bb27f8d90f8403229e53d58a78c24 Mon Sep 17 00:00:00 2001 From: gharvey Date: Thu, 8 Aug 2024 14:50:54 -0700 Subject: [PATCH 38/45] Replaces multiple queries with a single query --- packages/supabase/bitnami-values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 5bed2dedb..7a3428c66 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -79,7 +79,7 @@ realtime: - name: APP_NAME value: "supabase-realtime" - name: DB_AFTER_CONNECT_QUERY - value: "create schema if not exists _realtime; alter schema _realtime owner to postgres; SET search_path TO _realtime;" + value: "DO $body$ BEGIN CREATE SCHEMA IF NOT EXISTS _realtime; ALTER SCHEMA _realtime OWNER TO postgres; SET search_path TO _realtime; END $body$;" - name: DB_ENC_KEY valueFrom: secretKeyRef: From a5cbb4b79e5caa48e065ba8363f02d83ccfd0325 Mon Sep 17 00:00:00 2001 From: gharvey Date: Thu, 8 Aug 2024 14:53:27 -0700 Subject: [PATCH 39/45] Updates the migration to represent the new location --- .../20240808093300_v0.10.0_realtime_tenant.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/supabase/migrations/20240808093300_v0.10.0_realtime_tenant.sql b/packages/supabase/migrations/20240808093300_v0.10.0_realtime_tenant.sql index 680b55661..27f58c83d 100644 --- a/packages/supabase/migrations/20240808093300_v0.10.0_realtime_tenant.sql +++ b/packages/supabase/migrations/20240808093300_v0.10.0_realtime_tenant.sql @@ -1,22 +1,22 @@ -- Disable the foreign key constraint -ALTER TABLE extensions +ALTER TABLE _realtime.extensions DROP CONSTRAINT extensions_tenant_external_id_fkey; -- Update the external_id and name for the realtime tenant -UPDATE tenants +UPDATE _realtime.tenants SET external_id = 'supabase-realtime', name = 'supabase-realtime' WHERE external_id = 'realtime-dev' AND name = 'realtime-dev'; -- Update the tenant_external_id for the realtime extension -UPDATE extensions +UPDATE _realtime.extensions SET tenant_external_id = 'supabase-realtime' WHERE tenant_external_id = 'realtime-dev'; -- Re-enable the foreign key constraint -ALTER TABLE extensions +ALTER TABLE _realtime.extensions ADD CONSTRAINT extensions_tenant_external_id_fkey FOREIGN KEY (tenant_external_id) -REFERENCES tenants(external_id) +REFERENCES _realtime.tenants(external_id) ON DELETE CASCADE; \ No newline at end of file From bcc000d73c941245793cd779968d44270fa0c538 Mon Sep 17 00:00:00 2001 From: gharvey Date: Thu, 8 Aug 2024 15:28:36 -0700 Subject: [PATCH 40/45] Swaps out postgres image for one with wal2json --- packages/supabase/bitnami-values.yaml | 6 ++++-- packages/supabase/zarf.yaml | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 7a3428c66..77b849b24 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -123,7 +123,8 @@ volumePermissions: resourcesPreset: "none" psqlImage: - tag: 15.6.1-debian-12-r2 + repository: betaboon/bitnami-postgresql-wal2json + tag: 15.7.0-debian-12-r19 kong: enabled: ###ZARF_VAR_ENABLE_KONG### @@ -188,7 +189,8 @@ kong: postgresql: enabled: ###ZARF_VAR_ENABLE_POSTGRES### image: - tag: 15.6.1-debian-12-r2 + repository: betaboon/bitnami-postgresql-wal2json + tag: 15.7.0-debian-12-r19 debug: true primary: resourcesPreset: "none" diff --git a/packages/supabase/zarf.yaml b/packages/supabase/zarf.yaml index 094219fcd..6a5a1d48e 100644 --- a/packages/supabase/zarf.yaml +++ b/packages/supabase/zarf.yaml @@ -96,6 +96,7 @@ components: - docker.io/bitnami/supabase-storage:1.8.2-debian-12-r2 - docker.io/bitnami/supabase-studio:1.24.5-debian-12-r4 - docker.io/bitnami/kong:3.7.1-debian-12-r5 + - betaboon/bitnami-postgresql-wal2json:15.7.0-debian-12-r19 - name: supabase-post-process description: "Perform necessary post processing here" required: true From 3cc1bc11d83fa0c88a59273bb752d201e99cd793 Mon Sep 17 00:00:00 2001 From: gharvey Date: Thu, 8 Aug 2024 15:35:02 -0700 Subject: [PATCH 41/45] Moves back to older postgres image --- packages/supabase/bitnami-values.yaml | 4 ++-- packages/supabase/zarf.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 77b849b24..05c843819 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -124,7 +124,7 @@ volumePermissions: psqlImage: repository: betaboon/bitnami-postgresql-wal2json - tag: 15.7.0-debian-12-r19 + tag: 15.6.0-debian-12-r20 kong: enabled: ###ZARF_VAR_ENABLE_KONG### @@ -190,7 +190,7 @@ postgresql: enabled: ###ZARF_VAR_ENABLE_POSTGRES### image: repository: betaboon/bitnami-postgresql-wal2json - tag: 15.7.0-debian-12-r19 + tag: 15.6.0-debian-12-r20 debug: true primary: resourcesPreset: "none" diff --git a/packages/supabase/zarf.yaml b/packages/supabase/zarf.yaml index 6a5a1d48e..cfefd91d6 100644 --- a/packages/supabase/zarf.yaml +++ b/packages/supabase/zarf.yaml @@ -96,7 +96,7 @@ components: - docker.io/bitnami/supabase-storage:1.8.2-debian-12-r2 - docker.io/bitnami/supabase-studio:1.24.5-debian-12-r4 - docker.io/bitnami/kong:3.7.1-debian-12-r5 - - betaboon/bitnami-postgresql-wal2json:15.7.0-debian-12-r19 + - betaboon/bitnami-postgresql-wal2json:15.6.0-debian-12-r20 - name: supabase-post-process description: "Perform necessary post processing here" required: true From c57facf741d5d50ecc36b97127dcbcc8bf5ad0d9 Mon Sep 17 00:00:00 2001 From: gharvey Date: Thu, 8 Aug 2024 15:42:38 -0700 Subject: [PATCH 42/45] Switch to official supabase postgres image --- packages/supabase/bitnami-values.yaml | 8 ++++---- packages/supabase/zarf.yaml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 05c843819..d67ed97a1 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -123,8 +123,8 @@ volumePermissions: resourcesPreset: "none" psqlImage: - repository: betaboon/bitnami-postgresql-wal2json - tag: 15.6.0-debian-12-r20 + repository: supabase/postgres + tag: 15.6.1.106 kong: enabled: ###ZARF_VAR_ENABLE_KONG### @@ -189,8 +189,8 @@ kong: postgresql: enabled: ###ZARF_VAR_ENABLE_POSTGRES### image: - repository: betaboon/bitnami-postgresql-wal2json - tag: 15.6.0-debian-12-r20 + repository: supabase/postgres + tag: 15.6.1.106 debug: true primary: resourcesPreset: "none" diff --git a/packages/supabase/zarf.yaml b/packages/supabase/zarf.yaml index cfefd91d6..5439dbd39 100644 --- a/packages/supabase/zarf.yaml +++ b/packages/supabase/zarf.yaml @@ -96,7 +96,7 @@ components: - docker.io/bitnami/supabase-storage:1.8.2-debian-12-r2 - docker.io/bitnami/supabase-studio:1.24.5-debian-12-r4 - docker.io/bitnami/kong:3.7.1-debian-12-r5 - - betaboon/bitnami-postgresql-wal2json:15.6.0-debian-12-r20 + - supabase/postgres:15.6.1.106 - name: supabase-post-process description: "Perform necessary post processing here" required: true From 1c083e8446a74cd5edfb5b2f7bcdcc4c46f9ab3b Mon Sep 17 00:00:00 2001 From: gharvey Date: Thu, 8 Aug 2024 15:47:43 -0700 Subject: [PATCH 43/45] Returns to using a base postgres image --- packages/supabase/bitnami-values.yaml | 6 ++---- packages/supabase/zarf.yaml | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index d67ed97a1..7a3428c66 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -123,8 +123,7 @@ volumePermissions: resourcesPreset: "none" psqlImage: - repository: supabase/postgres - tag: 15.6.1.106 + tag: 15.6.1-debian-12-r2 kong: enabled: ###ZARF_VAR_ENABLE_KONG### @@ -189,8 +188,7 @@ kong: postgresql: enabled: ###ZARF_VAR_ENABLE_POSTGRES### image: - repository: supabase/postgres - tag: 15.6.1.106 + tag: 15.6.1-debian-12-r2 debug: true primary: resourcesPreset: "none" diff --git a/packages/supabase/zarf.yaml b/packages/supabase/zarf.yaml index 5439dbd39..094219fcd 100644 --- a/packages/supabase/zarf.yaml +++ b/packages/supabase/zarf.yaml @@ -96,7 +96,6 @@ components: - docker.io/bitnami/supabase-storage:1.8.2-debian-12-r2 - docker.io/bitnami/supabase-studio:1.24.5-debian-12-r4 - docker.io/bitnami/kong:3.7.1-debian-12-r5 - - supabase/postgres:15.6.1.106 - name: supabase-post-process description: "Perform necessary post processing here" required: true From 11888cbd7e4005210661e8b06df195954ab639d3 Mon Sep 17 00:00:00 2001 From: gharvey Date: Thu, 8 Aug 2024 16:18:43 -0700 Subject: [PATCH 44/45] Updates the config to set the wal_level to logical --- packages/supabase/bitnami-values.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/supabase/bitnami-values.yaml b/packages/supabase/bitnami-values.yaml index 7a3428c66..2ae319903 100644 --- a/packages/supabase/bitnami-values.yaml +++ b/packages/supabase/bitnami-values.yaml @@ -191,6 +191,8 @@ postgresql: tag: 15.6.1-debian-12-r2 debug: true primary: + extendedConfiguration: | + wal_level = logical resourcesPreset: "none" podLabels: sidecar.istio.io/inject: "false" From b3a47b001d65c9b6294927097078b1b1f33cffc2 Mon Sep 17 00:00:00 2001 From: gharvey Date: Wed, 21 Aug 2024 15:44:42 -0700 Subject: [PATCH 45/45] Fixes typo in manifests --- ...uapbase-realtime-secret.yaml => supabase-realtime-secret.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/supabase/chart/templates/{suapbase-realtime-secret.yaml => supabase-realtime-secret.yaml} (100%) diff --git a/packages/supabase/chart/templates/suapbase-realtime-secret.yaml b/packages/supabase/chart/templates/supabase-realtime-secret.yaml similarity index 100% rename from packages/supabase/chart/templates/suapbase-realtime-secret.yaml rename to packages/supabase/chart/templates/supabase-realtime-secret.yaml