diff --git a/charts/supabase/.DS_Store b/charts/supabase/.DS_Store index bbda36e075f5f8e69e9d47208ff5a842264897ed..47a4d48b57cf0cd5d23c2b798c1f3e5004497a9d 100644 Binary files a/charts/supabase/.DS_Store and b/charts/supabase/.DS_Store differ diff --git a/charts/supabase/Chart.yaml b/charts/supabase/Chart.yaml index feb0faa7556849549a6a7853e5f7dc102df56bfb..caa158b25f3494b1627fe46594d6c238322cc542 100644 --- a/charts/supabase/Chart.yaml +++ b/charts/supabase/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.0.2 +version: 0.0.3 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/supabase/README.md b/charts/supabase/README.md index eb18eb77033d55627ec012a2be94fc99b386bea9..8d2f9f08a710354ddc167c83b002781ff970867d 100644 --- a/charts/supabase/README.md +++ b/charts/supabase/README.md @@ -61,6 +61,10 @@ demo-supabase-storage-6c878dcbd4-zzzcv 1/1 Running 0 47s When the installation will be complete you'll be able to create a tunnel using minikube: ```bash +# First, enable the ingress addon in Minikube +minikube addons enable ingress + +# Then enable the tunnel (will need sudo credentials because you are opening Port 80/443 on your local machine) minikube tunnel ``` diff --git a/charts/supabase/templates/auth/deployment.yaml b/charts/supabase/templates/auth/deployment.yaml index 3beed96133ab5a65fe9e468ffde27d82220dca50..947e78126a1361546f9766d943a0c0debd9c0da8 100644 --- a/charts/supabase/templates/auth/deployment.yaml +++ b/charts/supabase/templates/auth/deployment.yaml @@ -28,6 +28,28 @@ spec: serviceAccountName: {{ include "supabase.auth.serviceAccountName" . }} securityContext: {{- toYaml .Values.auth.podSecurityContext | nindent 8 }} + initContainers: + - name: init-db + image: postgres:15-alpine + imagePullPolicy: IfNotPresent + env: + - name: DB_HOST + value: {{ .Values.auth.environment.DB_HOST | quote }} + - name: DB_PORT + value: {{ .Values.auth.environment.DB_PORT | quote }} + - name: DB_USER + valueFrom: + secretKeyRef: + name: {{ .Values.db.secretName }} + key: username + command: ["/bin/sh", "-c"] + args: + - | + until pg_isready -h $(DB_HOST) -p $(DB_PORT) -U $(DB_USER); do + echo "Waiting for database to start..." + sleep 2 + done + - echo "Database is ready" containers: - name: {{ include "supabase.auth.name" $ }} securityContext: diff --git a/charts/supabase/templates/db/deployment.yaml b/charts/supabase/templates/db/deployment.yaml index 91555ab75464654f1131d3a136431e4b8d20bd21..c9c3c943c157a045abf987914041aad74b4110fe 100644 --- a/charts/supabase/templates/db/deployment.yaml +++ b/charts/supabase/templates/db/deployment.yaml @@ -62,6 +62,10 @@ spec: {{- with .Values.db.volumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} + {{- if .Values.db.persistence.enabled }} + - mountPath: {{ .Values.db.storage.mountPath }} + name: postgres-volume + {{- end }} {{- with .Values.db.resources }} resources: {{- toYaml . | nindent 12 }} @@ -73,6 +77,11 @@ spec: {{- with .Values.db.volumes }} {{- toYaml . | nindent 8 }} {{- end }} + {{- if .Values.db.persistence.enabled }} + - name: postgres-volume + persistentVolumeClaim: + claimName: {{ include "supabase.db.fullname" . }}-pvc + {{- end }} {{- with .Values.db.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/supabase/templates/db/storage.yaml b/charts/supabase/templates/db/storage.yaml new file mode 100644 index 0000000000000000000000000000000000000000..28ad48f0d003563e66441d67bec6d1e81d41425a --- /dev/null +++ b/charts/supabase/templates/db/storage.yaml @@ -0,0 +1,21 @@ +{{- if .Values.db.persistence.enabled -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "supabase.db.fullname" . }}-pvc + labels: + {{- include "supabase.labels" . | nindent 4 }} + {{- with .Values.db.storage.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + storageClassName: {{ .Values.db.storage.storageClass }} + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.db.storage.size }} +{{- end }} + + diff --git a/charts/supabase/templates/realtime/deployment.yaml b/charts/supabase/templates/realtime/deployment.yaml index dc9ee0def4ff0543b9f953dd1e3a35ff966dce0d..cf4b301a647aaa366e989ed5c2ba1b730a53b4a3 100644 --- a/charts/supabase/templates/realtime/deployment.yaml +++ b/charts/supabase/templates/realtime/deployment.yaml @@ -28,6 +28,28 @@ spec: serviceAccountName: {{ include "supabase.realtime.serviceAccountName" . }} securityContext: {{- toYaml .Values.realtime.podSecurityContext | nindent 8 }} + initContainers: + - name: init-db + image: postgres:15-alpine + imagePullPolicy: IfNotPresent + env: + - name: DB_HOST + value: {{ .Values.realtime.environment.DB_HOST | quote }} + - name: DB_PORT + value: {{ .Values.realtime.environment.DB_PORT | quote }} + - name: DB_USER + valueFrom: + secretKeyRef: + name: {{ .Values.db.secretName }} + key: username + command: ["/bin/sh", "-c"] + args: + - | + until pg_isready -h $(DB_HOST) -p $(DB_PORT) -U $(DB_USER); do + echo "Waiting for database to start..." + sleep 2 + done + - echo "Database is ready" containers: - name: {{ include "supabase.realtime.name" $ }} securityContext: diff --git a/charts/supabase/templates/storage/deployment.yaml b/charts/supabase/templates/storage/deployment.yaml index fc439339910fed245aa7836331118d52d6bc59bc..6fdea4df56bceba4e11c62f4d9de718e4eb943db 100644 --- a/charts/supabase/templates/storage/deployment.yaml +++ b/charts/supabase/templates/storage/deployment.yaml @@ -29,6 +29,28 @@ spec: serviceAccountName: {{ include "supabase.storage.serviceAccountName" . }} securityContext: {{- toYaml .Values.storage.podSecurityContext | nindent 8 }} + initContainers: + - name: init-db + image: postgres:15-alpine + imagePullPolicy: IfNotPresent + env: + - name: DB_HOST + value: {{ .Values.storage.environment.DB_HOST | quote }} + - name: DB_PORT + value: {{ .Values.storage.environment.DB_PORT | quote }} + - name: DB_USER + valueFrom: + secretKeyRef: + name: {{ .Values.db.secretName }} + key: username + command: ["/bin/sh", "-c"] + args: + - | + until pg_isready -h $(DB_HOST) -p $(DB_PORT) -U $(DB_USER); do + echo "Waiting for database to start..." + sleep 2 + done + - echo "Database is ready" containers: - name: {{ include "supabase.storage.name" $ }} securityContext: @@ -95,10 +117,10 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} volumes: - {{- if .Values.storage.persistence.enable }} + {{- if .Values.storage.persistence.enabled }} - name: storage-data persistentVolumeClaim: - claimName: {{ include "supabase.storage.fullname" . }} + claimName: {{ include "supabase.storage.fullname" . }}-pvc {{- end }} {{- with .Values.storage.volumes }} {{- toYaml . | nindent 8 }} diff --git a/charts/supabase/templates/storage/volume.yaml b/charts/supabase/templates/storage/volume.yaml index cf7719aff663a36cab293d4fecea25907882bb1b..6455767d9b7cad5bc7a58dffc62b4e95bc599128 100644 --- a/charts/supabase/templates/storage/volume.yaml +++ b/charts/supabase/templates/storage/volume.yaml @@ -3,7 +3,7 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: - name: {{ include "supabase.storage.fullname" . }} + name: {{ include "supabase.storage.fullname" . }}-pvc labels: {{- include "supabase.labels" . | nindent 4 }} {{- with .Values.storage.persistence.annotations }} diff --git a/charts/supabase/values.example.yaml b/charts/supabase/values.example.yaml index 26b76d5372ea9f756ee28a92236b7bf3c84c160a..f8b873fa53856a69c93715259dc7736452fb20ac 100644 --- a/charts/supabase/values.example.yaml +++ b/charts/supabase/values.example.yaml @@ -10,11 +10,14 @@ db: repository: supabase/postgres tag: 14.1.0.105 secretName: "demo-supabase-db" + persistence: + enabled: false storage: mountPath: /var/lib/postgresql/data size: 20Gi storageClass: standard - + annotations: + helm.sh/resource-policy: "keep" studio: image: @@ -138,6 +141,14 @@ storage: TENANT_ID: stub REGION: stub GLOBAL_S3_BUCKET: stub + persistence: + enabled: false + accessModes: + - ReadWriteOnce + size: 4Gi + storageClassName: standard + annotations: + helm.sh/resource-policy: "keep" kong: image: diff --git a/index.yaml b/index.yaml index bb10c0337dd8c95ec62c42a432040140338931a1..e3b8437fcf6fed7fecc711ac4313f2e148a0b6d4 100644 --- a/index.yaml +++ b/index.yaml @@ -2,7 +2,16 @@ apiVersion: v1 entries: supabase: - apiVersion: v2 - created: "2023-02-03T14:14:26.378801-05:00" + created: "2023-02-10T15:04:18.116554-05:00" + description: The open source Firebase alternative. + digest: 79a75d1ca844b0551a9d0a084131273c63925c19f32513ad18fdc23e6f5854bf + name: supabase + type: application + urls: + - https://supabase-community.github.io/supabase-kubernetes/build/supabase-0.0.3.tgz + version: 0.0.3 + - apiVersion: v2 + created: "2023-02-10T15:04:18.113431-05:00" description: The open source Firebase alternative. digest: a0d6c0627c049642f3a9a1d068ecc4601d87c26d0326b47422223a7660424e31 name: supabase @@ -11,7 +20,7 @@ entries: - https://supabase-community.github.io/supabase-kubernetes/build/supabase-0.0.2.tgz version: 0.0.2 - apiVersion: v2 - created: "2023-02-03T14:14:26.377362-05:00" + created: "2023-02-10T15:04:18.111993-05:00" description: The open source Firebase alternative. digest: 651547b54edc5cfbac1ed39cb42fc574ee766ff8c1c61aa6cedef84d2faa358f name: supabase @@ -19,4 +28,4 @@ entries: urls: - https://supabase-community.github.io/supabase-kubernetes/build/supabase-0.0.1.tgz version: 0.0.1 -generated: "2023-02-03T14:14:26.375497-05:00" +generated: "2023-02-10T15:04:18.110189-05:00"