From 51eb3d71a225c99df9570fe0931b7ce66548acc8 Mon Sep 17 00:00:00 2001
From: Pinghao Wu <xdavidwuph@gmail.com>
Date: Mon, 3 Mar 2025 14:42:44 +0800
Subject: [PATCH] sourcehut: containerize meta

---
 applications/sourcehut/deployment-meta.yaml | 79 +++++++++++++++++++++
 applications/sourcehut/kustomization.yaml   |  2 +
 applications/sourcehut/service-meta.yaml    | 14 ++++
 3 files changed, 95 insertions(+)
 create mode 100644 applications/sourcehut/deployment-meta.yaml
 create mode 100644 applications/sourcehut/service-meta.yaml

diff --git a/applications/sourcehut/deployment-meta.yaml b/applications/sourcehut/deployment-meta.yaml
new file mode 100644
index 0000000..fd7839f
--- /dev/null
+++ b/applications/sourcehut/deployment-meta.yaml
@@ -0,0 +1,79 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: meta
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      component: meta
+  template:
+    metadata:
+      labels:
+        component: meta
+    spec:
+      containers:
+        - name: main
+          image: ghcr.io/xdavidwu/c/metasrht:3554
+          volumeMounts:
+            - name: secrets
+              mountPath: /etc/sr.ht/config.ini
+              subPath: config.ini
+            - name: passwd
+              mountPath: /etc/passwd
+              readOnly: true
+            - name: shadow
+              mountPath: /etc/shadow
+              readOnly: true
+            - name: group
+              mountPath: /etc/group
+              readOnly: true
+          readinessProbe:
+            httpGet:
+              port: 5000
+          securityContext:
+            runAsGroup: 0
+        - name: api
+          image: ghcr.io/xdavidwu/c/metasrht:3554
+          command:
+            - /usr/bin/meta.sr.ht-api
+            - metasrht.app:app
+          volumeMounts:
+            - name: secrets
+              mountPath: /etc/sr.ht/config.ini
+              subPath: config.ini
+          readinessProbe:
+            httpGet:
+              port: 5100
+              path: /query/api-meta.json
+        - name: webhooks
+          image: ghcr.io/xdavidwu/c/metasrht:3554
+          command:
+            - /usr/bin/celery
+            - -A
+            - metasrht.webhooks
+            - worker
+            - --loglevel=info
+            - --concurrency=2
+          volumeMounts:
+            - name: secrets
+              mountPath: /etc/sr.ht/config.ini
+              subPath: config.ini
+      nodeSelector:
+        kubernetes.io/hostname: parto
+      volumes:
+        - name: secrets
+          secret:
+            secretName: secrets
+        - name: passwd
+          hostPath:
+            path: /etc/passwd
+            type: File
+        - name: shadow
+          hostPath:
+            path: /etc/shadow
+            type: File
+        - name: group
+          hostPath:
+            path: /etc/group
+            type: File
diff --git a/applications/sourcehut/kustomization.yaml b/applications/sourcehut/kustomization.yaml
index ce5ebdd..d70b42d 100644
--- a/applications/sourcehut/kustomization.yaml
+++ b/applications/sourcehut/kustomization.yaml
@@ -14,3 +14,5 @@ resources:
   - service-paste.yaml
   - deployment-todo.yaml
   - service-todo.yaml
+  - deployment-meta.yaml
+  - service-meta.yaml
diff --git a/applications/sourcehut/service-meta.yaml b/applications/sourcehut/service-meta.yaml
new file mode 100644
index 0000000..f3b3e17
--- /dev/null
+++ b/applications/sourcehut/service-meta.yaml
@@ -0,0 +1,14 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: meta
+spec:
+  selector:
+    component: meta
+  ports:
+    - name: http
+      protocol: TCP
+      port: 5000
+    - name: api
+      protocol: TCP
+      port: 5100
-- 
2.45.2