diff k8s/deploy.yaml @ 18:a527228aa353 default tip

prefect use postgres
author drewp@bigasterisk.com
date Fri, 19 Jul 2024 21:01:09 -0700
parents 7a87ba2f00d9
children
line wrap: on
line diff
--- a/k8s/deploy.yaml	Fri Jul 19 00:59:45 2024 -0700
+++ b/k8s/deploy.yaml	Fri Jul 19 21:01:09 2024 -0700
@@ -4,6 +4,7 @@
   name: sco-bot
 spec:
   replicas: 1
+  strategy: {type: Recreate}
   selector:
     matchLabels:
       app: sco-bot
@@ -49,6 +50,21 @@
             - name: sco-bot-data
               mountPath: /opt/data
 
+        - name: prefect-db
+          securityContext:
+            runAsUser: 70 # = postgres user, needed to write to /var/run in the container
+          image: postgres:16.3-alpine
+          env:
+            - { name: PGDATA, value: /opt/data/postgres/data }
+            - { name: POSTGRES_USER, value: postgres }
+            - { name: POSTGRES_PASSWORD, value: admin }
+            - { name: POSTGRES_DB, value: prefect }
+          ports:
+            - containerPort: 5432
+          volumeMounts:
+            - name: sco-bot-data
+              mountPath: /opt/data
+
         - name: prefect
           image: reg:5000/sco_bot_server
           securityContext: { runAsUser: 1020 }
@@ -56,6 +72,8 @@
           env:
             - name: PREFECT_API_URL
               value: https://sco-bot-prefect.bigasterisk.com/api
+            - name: PREFECT_API_DATABASE_CONNECTION_URL
+              value: "postgresql+asyncpg://postgres:admin@localhost:5432/prefect"
           command:
             - pdm
             - run_prefect_server
@@ -73,6 +91,8 @@
           env:
             - name: PREFECT_API_URL
               value: http://localhost:4200/api
+            - name: PREFECT_API_DATABASE_CONNECTION_URL
+              value: "postgresql+asyncpg://postgres:admin@localhost:5432/prefect"
           command:
             - pdm
             - run_build_flow