Remove PostgREST (#41299)

Marshall Bowers created

This PR removes the PostgREST containers and deployments, as we're no
longer using it.

Release Notes:

- N/A

Change summary

Procfile.postgrest                       |   2 
Procfile.web                             |   1 
compose.yml                              |  26 ---
crates/collab/k8s/postgrest.template.yml | 175 --------------------------
crates/collab/postgrest_app.conf         |   4 
crates/collab/postgrest_llm.conf         |   4 
script/deploy-postgrest                  |  20 --
7 files changed, 232 deletions(-)

Detailed changes

Procfile.postgrest 🔗

@@ -1,2 +0,0 @@
-app: postgrest crates/collab/postgrest_app.conf
-llm: postgrest crates/collab/postgrest_llm.conf

Procfile.web 🔗

@@ -1,2 +1 @@
-postgrest_llm: postgrest crates/collab/postgrest_llm.conf
 website: cd ../zed.dev; npm run dev -- --port=3000

compose.yml 🔗

@@ -33,32 +33,6 @@ services:
     volumes:
       - ./livekit.yaml:/livekit.yaml
 
-  postgrest_app:
-    image: docker.io/postgrest/postgrest
-    container_name: postgrest_app
-    ports:
-      - 8081:8081
-    environment:
-      PGRST_DB_URI: postgres://postgres@postgres:5432/zed
-    volumes:
-      - ./crates/collab/postgrest_app.conf:/etc/postgrest.conf
-    command: postgrest /etc/postgrest.conf
-    depends_on:
-      - postgres
-
-  postgrest_llm:
-    image: docker.io/postgrest/postgrest
-    container_name: postgrest_llm
-    ports:
-      - 8082:8082
-    environment:
-      PGRST_DB_URI: postgres://postgres@postgres:5432/zed_llm
-    volumes:
-      - ./crates/collab/postgrest_llm.conf:/etc/postgrest.conf
-    command: postgrest /etc/postgrest.conf
-    depends_on:
-      - postgres
-
   stripe-mock:
     image: docker.io/stripe/stripe-mock:v0.178.0
     ports:

crates/collab/k8s/postgrest.template.yml 🔗

@@ -1,175 +0,0 @@
----
-kind: Service
-apiVersion: v1
-metadata:
-  namespace: ${ZED_KUBE_NAMESPACE}
-  name: postgrest
-  annotations:
-    service.beta.kubernetes.io/do-loadbalancer-name: "postgrest-${ZED_KUBE_NAMESPACE}"
-    service.beta.kubernetes.io/do-loadbalancer-tls-ports: "443"
-    service.beta.kubernetes.io/do-loadbalancer-certificate-id: ${ZED_DO_CERTIFICATE_ID}
-    service.beta.kubernetes.io/do-loadbalancer-disable-lets-encrypt-dns-records: "true"
-spec:
-  type: LoadBalancer
-  selector:
-    app: nginx
-  ports:
-    - name: web
-      protocol: TCP
-      port: 443
-      targetPort: 8080
-
----
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  namespace: ${ZED_KUBE_NAMESPACE}
-  name: nginx
-spec:
-  replicas: 1
-  selector:
-    matchLabels:
-      app: nginx
-  template:
-    metadata:
-      labels:
-        app: nginx
-    spec:
-      containers:
-        - name: nginx
-          image: nginx:latest
-          ports:
-            - containerPort: 8080
-              protocol: TCP
-          volumeMounts:
-            - name: nginx-config
-              mountPath: /etc/nginx/nginx.conf
-              subPath: nginx.conf
-      volumes:
-        - name: nginx-config
-          configMap:
-            name: nginx-config
-
----
-apiVersion: v1
-kind: ConfigMap
-metadata:
-  namespace: ${ZED_KUBE_NAMESPACE}
-  name: nginx-config
-data:
-  nginx.conf: |
-    events {}
-
-    http {
-      server {
-        listen 8080;
-
-        location /app/ {
-          proxy_pass http://postgrest-app:8080/;
-        }
-
-        location /llm/ {
-          proxy_pass http://postgrest-llm:8080/;
-        }
-      }
-    }
-
----
-apiVersion: v1
-kind: Service
-metadata:
-  namespace: ${ZED_KUBE_NAMESPACE}
-  name: postgrest-app
-spec:
-  selector:
-    app: postgrest-app
-  ports:
-    - protocol: TCP
-      port: 8080
-      targetPort: 8080
-
----
-apiVersion: v1
-kind: Service
-metadata:
-  namespace: ${ZED_KUBE_NAMESPACE}
-  name: postgrest-llm
-spec:
-  selector:
-    app: postgrest-llm
-  ports:
-    - protocol: TCP
-      port: 8080
-      targetPort: 8080
-
----
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  namespace: ${ZED_KUBE_NAMESPACE}
-  name: postgrest-app
-spec:
-  replicas: 1
-  selector:
-    matchLabels:
-      app: postgrest-app
-  template:
-    metadata:
-      labels:
-        app: postgrest-app
-    spec:
-      containers:
-        - name: postgrest
-          image: "postgrest/postgrest"
-          ports:
-            - containerPort: 8080
-              protocol: TCP
-          env:
-            - name: PGRST_SERVER_PORT
-              value: "8080"
-            - name: PGRST_DB_URI
-              valueFrom:
-                secretKeyRef:
-                  name: database
-                  key: url
-            - name: PGRST_JWT_SECRET
-              valueFrom:
-                secretKeyRef:
-                  name: postgrest
-                  key: jwt_secret
-
----
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  namespace: ${ZED_KUBE_NAMESPACE}
-  name: postgrest-llm
-spec:
-  replicas: 1
-  selector:
-    matchLabels:
-      app: postgrest-llm
-  template:
-    metadata:
-      labels:
-        app: postgrest-llm
-    spec:
-      containers:
-        - name: postgrest
-          image: "postgrest/postgrest"
-          ports:
-            - containerPort: 8080
-              protocol: TCP
-          env:
-            - name: PGRST_SERVER_PORT
-              value: "8080"
-            - name: PGRST_DB_URI
-              valueFrom:
-                secretKeyRef:
-                  name: llm-database
-                  key: url
-            - name: PGRST_JWT_SECRET
-              valueFrom:
-                secretKeyRef:
-                  name: postgrest
-                  key: jwt_secret

crates/collab/postgrest_app.conf 🔗

@@ -1,4 +0,0 @@
-db-uri = "postgres://postgres@localhost/zed"
-server-port = 8081
-jwt-secret = "the-postgrest-jwt-secret-for-authorization"
-log-level = "info"

crates/collab/postgrest_llm.conf 🔗

@@ -1,4 +0,0 @@
-db-uri = "postgres://postgres@localhost/zed_llm"
-server-port = 8082
-jwt-secret = "the-postgrest-jwt-secret-for-authorization"
-log-level = "info"

script/deploy-postgrest 🔗

@@ -1,20 +0,0 @@
-#!/usr/bin/env bash
-
-set -eu
-source script/lib/deploy-helpers.sh
-
-if [[ $# != 1 ]]; then
-  echo "Usage: $0 <production|staging> (postgrest not needed on preview or nightly)"
-  exit 1
-fi
-environment=$1
-
-export_vars_for_environment ${environment}
-
-export ZED_DO_CERTIFICATE_ID=$(doctl compute certificate list --format ID --no-header)
-export ZED_KUBE_NAMESPACE=${environment}
-
-target_zed_kube_cluster
-envsubst < crates/collab/k8s/postgrest.template.yml | kubectl apply -f -
-
-echo "deployed postgrest"