mirror of
https://github.com/dredx/prole.git
synced 2026-09-24 19:44:33 +00:00
• install.py • etc/init_supabase.sh • k8s/prole/kustomization.yaml • k8s/prole/prole-db-postgres-service.yaml • k8s/prole/supabase-configmap.yaml • k8s/prole/supabase-deployment.yaml • k8s/prole/supabase-service.yaml • prole-db/supabase.md
97 lines
3.2 KiB
Markdown
97 lines
3.2 KiB
Markdown
# Supabase Integration for Prole-DB
|
|
|
|
This document explains how Supabase is deployed alongside the Prole CloudNative-PG (CNPG) cluster and how it connects to Postgres. It provides practical guidance for operating and troubleshooting the integration.
|
|
|
|
## What is deployed
|
|
|
|
Supabase is deployed in the same Kubernetes namespace as the Prole CNPG cluster using the following resources:
|
|
|
|
- Supabase Deployment: `k8s/prole/supabase-deployment.yaml`
|
|
- Supabase Service (HTTPS): `k8s/prole/supabase-service.yaml`
|
|
- Supabase ConfigMap: `k8s/prole/supabase-configmap.yaml`
|
|
- Postgres Service (CNPG primary): `k8s/prole/prole-db-postgres-service.yaml`
|
|
|
|
The Supabase Deployment uses environment variables from the ConfigMap and the `prole-db-user` Kubernetes Secret to connect to Postgres.
|
|
|
|
## Postgres connectivity
|
|
|
|
Supabase connects to the CNPG primary via the service `prole-db-postgres` on port 5432. The service selector targets the CNPG primary pod:
|
|
|
|
- `cnpg.io/cluster: prole-db`
|
|
- `role: primary`
|
|
|
|
The database credentials come from the existing secret:
|
|
|
|
- Secret name: `prole-db-user`
|
|
- Keys: `username`, `password`
|
|
|
|
## HTTPS endpoint
|
|
|
|
Supabase is exposed via a ClusterIP service on port 443. The deployment assumes the Supabase container listens on HTTPS at port 443.
|
|
|
|
If your Supabase image expects a different port, update both:
|
|
|
|
- `k8s/prole/supabase-deployment.yaml` (container port)
|
|
- `k8s/prole/supabase-service.yaml` (service port/targetPort)
|
|
|
|
## Optional feature toggle
|
|
|
|
Supabase is an optional feature in the installer UI. The user intent is saved in `prole.cfg` under the section `[Optional Features]` with the key:
|
|
|
|
- `SUPABASE_ENABLED = true|false`
|
|
|
|
This is for configuration tracking; it does not automatically add or remove Kubernetes resources. Deployment is controlled by the `k8s/prole/kustomization.yaml` resources list.
|
|
|
|
## How to use (quick start)
|
|
|
|
1) Ensure CNPG is deployed and healthy.
|
|
|
|
2) Ensure the `prole-db-user` secret exists (the init scripts or OpenBao flow should already create it).
|
|
|
|
3) Apply the Prole kustomization (includes Supabase resources):
|
|
|
|
```bash
|
|
kubectl apply -k k8s/prole
|
|
```
|
|
|
|
4) Verify Supabase and Postgres services:
|
|
|
|
```bash
|
|
kubectl get deploy supabase
|
|
kubectl get svc supabase
|
|
kubectl get svc prole-db-postgres
|
|
```
|
|
|
|
5) Check Supabase logs if needed:
|
|
|
|
```bash
|
|
kubectl logs deploy/supabase
|
|
```
|
|
|
|
## Updating the Postgres target
|
|
|
|
If you need Supabase to connect to a different CNPG cluster name or namespace, update the following values:
|
|
|
|
- `k8s/prole/supabase-configmap.yaml` (`POSTGRES_HOST`, `POSTGRES_PORT`, `POSTGRES_DB`)
|
|
- `k8s/prole/prole-db-postgres-service.yaml` (service name and selectors)
|
|
|
|
## Troubleshooting
|
|
|
|
- If Supabase cannot connect to Postgres, confirm:
|
|
- The `prole-db` cluster is healthy and a primary is elected.
|
|
- The `prole-db-postgres` service resolves to the primary pod.
|
|
- The `prole-db-user` secret exists and contains valid credentials.
|
|
|
|
- If HTTPS does not respond:
|
|
- Confirm the Supabase image listens on port 443.
|
|
- Check the container port and service port in the manifests.
|
|
|
|
## Files referenced
|
|
|
|
- `k8s/prole/supabase-configmap.yaml`
|
|
- `k8s/prole/supabase-deployment.yaml`
|
|
- `k8s/prole/supabase-service.yaml`
|
|
- `k8s/prole/prole-db-postgres-service.yaml`
|
|
- `k8s/prole/kustomization.yaml`
|
|
- `install.py` (optional feature toggle persistence)
|