{{- if .Values.deployment.realtime.enabled -}} apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "supabase.realtime.fullname" . }} labels: {{- include "supabase.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.realtime.enabled }} replicas: {{ .Values.deployment.realtime.replicaCount }} {{- end }} selector: matchLabels: {{- include "supabase.realtime.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.deployment.realtime.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "supabase.realtime.selectorLabels" . | nindent 8 }} spec: {{- with .Values.image.realtime.pullSecrets}} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "supabase.realtime.serviceAccountName" . }} securityContext: {{- toYaml .Values.deployment.realtime.podSecurityContext | nindent 8 }} initContainers: - name: init-db image: postgres:15-alpine imagePullPolicy: IfNotPresent env: - name: DB_HOST {{- if .Values.deployment.db.enabled }} value: {{ include "supabase.db.fullname" . | quote }} {{- else }} value: {{ .Values.environment.auth.DB_HOST | quote }} {{- end }} - name: DB_PORT value: {{ .Values.environment.analytics.DB_PORT | quote }} command: ["/bin/sh", "-c"] args: - | until pg_isready -h $(DB_HOST) -p $(DB_PORT) -U postgres; do echo "Waiting for database to start..." sleep 2 done - echo "Database is ready" containers: - name: {{ include "supabase.realtime.name" $ }} securityContext: {{- toYaml .Values.deployment.realtime.securityContext | nindent 12 }} image: "{{ .Values.image.realtime.repository }}:{{ .Values.image.realtime.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.realtime.pullPolicy }} command: ["/bin/sh"] args: ["-c", "/app/bin/migrate && /app/bin/realtime eval 'Realtime.Release.seeds(Realtime.Repo)' && /app/bin/server"] env: {{- range $key, $value := .Values.environment.realtime }} - name: {{ $key }} value: {{ $value | quote }} {{- end }} {{- if .Values.deployment.db.enabled }} - name: DB_HOST value: {{ include "supabase.db.fullname" . }} {{- end }} - name: SELF_HOST_TENANT_NAME value: {{ include "supabase.realtime.fullname" . }} - name: DB_PASSWORD valueFrom: secretKeyRef: {{- if .Values.secret.db.secretRef }} name: {{ .Values.secret.db.secretRef }} key: {{ .Values.secret.db.secretRefKey.password | default "password" }} {{- else }} name: {{ include "supabase.secret.db" . }} key: password {{- end }} - name: DB_NAME valueFrom: secretKeyRef: {{- if .Values.secret.db.secretRef }} name: {{ .Values.secret.db.secretRef }} key: {{ .Values.secret.db.secretRefKey.database | default "database" }} {{- else }} name: {{ include "supabase.secret.db" . }} key: database {{- end }} - name: JWT_SECRET valueFrom: secretKeyRef: {{- if .Values.secret.jwt.secretRef }} name: {{ .Values.secret.jwt.secretRef }} key: {{ .Values.secret.jwt.secretRefKey.secret | default "secret" }} {{- else }} name: {{ include "supabase.secret.jwt" . }} key: secret {{- end }} - name: API_JWT_SECRET valueFrom: secretKeyRef: {{- if .Values.secret.jwt.secretRef }} name: {{ .Values.secret.jwt.secretRef }} key: {{ .Values.secret.jwt.secretRefKey.secret | default "secret" }} {{- else }} name: {{ include "supabase.secret.jwt" . }} key: secret {{- end }} - name: SECRET_KEY_BASE valueFrom: secretKeyRef: {{- if .Values.secret.realtime.secretRef }} name: {{ .Values.secret.realtime.secretRef }} key: {{ .Values.secret.realtime.secretRefKey.secretKeyBase | default "secretKeyBase" }} {{- else }} name: {{ include "supabase.secret.realtime" . }} key: secretKeyBase {{- end }} {{- with .Values.deployment.realtime.livenessProbe }} livenessProbe: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.deployment.realtime.readinessProbe }} readinessProbe: {{- toYaml . | nindent 12 }} {{- end }} ports: - name: http containerPort: 4000 protocol: TCP {{- with .Values.deployment.realtime.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.deployment.realtime.volumeMounts }} volumeMounts: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.deployment.realtime.volumes }} volumes: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.deployment.realtime.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.deployment.realtime.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.deployment.realtime.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- end }}