From cb05ea448fcc0eff14cb2d72df6c073409dea0b1 Mon Sep 17 00:00:00 2001 From: aggarwalakshun Date: Tue, 27 May 2025 18:43:00 +0530 Subject: [PATCH] remove separate db and sig-helper deployments --- cluster/apps/invidious/invidious-config.yml | 4 +- cluster/apps/invidious/invidious-db.yml | 75 --------------------- cluster/apps/invidious/invidious-helper.yml | 30 --------- cluster/apps/invidious/invidious-svc.yml | 42 ------------ cluster/apps/invidious/invidious.yml | 67 ++++++++++++------ 5 files changed, 49 insertions(+), 169 deletions(-) delete mode 100644 cluster/apps/invidious/invidious-db.yml delete mode 100644 cluster/apps/invidious/invidious-helper.yml diff --git a/cluster/apps/invidious/invidious-config.yml b/cluster/apps/invidious/invidious-config.yml index 2ec04c7..ea5ec7d 100644 --- a/cluster/apps/invidious/invidious-config.yml +++ b/cluster/apps/invidious/invidious-config.yml @@ -10,10 +10,10 @@ data: dbname: invidious user: kemal password: ${INVIDIOUS_DB_PASSWORD} - host: invidious-db-service + host: localhost port: 5432 check_tables: true - signature_server: inv-sig-helper:12999 + signature_server: localhost:12999 visitor_data: ${VISITOR_DATA} po_token: ${PO_TOKEN} port: 3000 diff --git a/cluster/apps/invidious/invidious-db.yml b/cluster/apps/invidious/invidious-db.yml deleted file mode 100644 index 0dc7ed0..0000000 --- a/cluster/apps/invidious/invidious-db.yml +++ /dev/null @@ -1,75 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: invidious-db - namespace: default -spec: - replicas: 1 - selector: - matchLabels: - app: invidious-db - template: - metadata: - labels: - app: invidious-db - spec: - initContainers: - - name: clean-db-dir - image: busybox - command: - - sh - - -c - - | - rm -rf /var/lib/postgresql/data/lost+found - volumeMounts: - - name: postgres-data - mountPath: /var/lib/postgresql/data - containers: - - name: postgres - image: postgres:14 - env: - - name: POSTGRES_DB - valueFrom: - secretKeyRef: - name: invidious-db-secrets - key: postgres-db - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: invidious-db-secrets - key: postgres-user - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: invidious-db-secrets - key: postgres-password - ports: - - containerPort: 5432 - volumeMounts: - - name: postgres-data - mountPath: /var/lib/postgresql/data - livenessProbe: - exec: - command: - - pg_isready - - -U - - kemal - - -d - - invidious - initialDelaySeconds: 30 - periodSeconds: 10 - readinessProbe: - exec: - command: - - pg_isready - - -U - - kemal - - -d - - invidious - initialDelaySeconds: 5 - periodSeconds: 10 - volumes: - - name: postgres-data - persistentVolumeClaim: - claimName: longhorn-invidious-config diff --git a/cluster/apps/invidious/invidious-helper.yml b/cluster/apps/invidious/invidious-helper.yml deleted file mode 100644 index 7eefbec..0000000 --- a/cluster/apps/invidious/invidious-helper.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: inv-sig-helper - namespace: default -spec: - replicas: 1 - selector: - matchLabels: - app: inv-sig-helper - template: - metadata: - labels: - app: inv-sig-helper - spec: - containers: - - name: inv-sig-helper - image: quay.io/invidious/inv-sig-helper@sha256:b5466c9add729e82e4e3ee5515c30b69df02d78ebb2486dbc9c63e456f29083d - args: ["--tcp", "0.0.0.0:12999"] - env: - - name: RUST_LOG - value: "info" - ports: - - containerPort: 12999 - securityContext: - readOnlyRootFilesystem: true - capabilities: - drop: - - ALL diff --git a/cluster/apps/invidious/invidious-svc.yml b/cluster/apps/invidious/invidious-svc.yml index 1f91374..c8c62af 100644 --- a/cluster/apps/invidious/invidious-svc.yml +++ b/cluster/apps/invidious/invidious-svc.yml @@ -1,45 +1,3 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: invidious-db-service - namespace: default -spec: - selector: - app: invidious-db - ports: - - protocol: TCP - port: 5432 - targetPort: 5432 - ---- -apiVersion: v1 -kind: Service -metadata: - name: invidious - namespace: default -spec: - selector: - app: invidious - ports: - - protocol: TCP - port: 3000 - targetPort: 3000 - ---- -apiVersion: v1 -kind: Service -metadata: - name: inv-sig-helper - namespace: default -spec: - selector: - app: inv-sig-helper - ports: - - protocol: TCP - port: 12999 - targetPort: 12999 - --- apiVersion: v1 kind: Service diff --git a/cluster/apps/invidious/invidious.yml b/cluster/apps/invidious/invidious.yml index 7a07484..48b919b 100644 --- a/cluster/apps/invidious/invidious.yml +++ b/cluster/apps/invidious/invidious.yml @@ -15,26 +15,6 @@ spec: app: invidious spec: initContainers: - - name: wait-for-companion - image: busybox - command: - - sh - - -c - - | - until nc -z -v -w30 inv-sig-helper 12999; do - echo "Waiting for companion to be ready..." - sleep 2 - done - - name: wait-for-db - image: busybox - command: - - sh - - -c - - | - until nc -z -v -w30 invidious-db-service 5432; do - echo "Waiting for database to be ready..." - sleep 2 - done - name: substitute-config image: alpine envFrom: @@ -51,6 +31,50 @@ spec: - name: tmp mountPath: /mnt subPath: invidious.yml + - name: clean-db-dir + image: busybox + command: + - sh + - -c + - | + rm -rf /var/lib/postgresql/data/lost+found + volumeMounts: + - name: postgres-data + mountPath: /var/lib/postgresql/data + - name: postgres + image: postgres:14 + restartPolicy: Always + env: + - name: POSTGRES_DB + valueFrom: + secretKeyRef: + name: invidious-db-secrets + key: postgres-db + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: invidious-db-secrets + key: postgres-user + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: invidious-db-secrets + key: postgres-password + volumeMounts: + - name: postgres-data + mountPath: /var/lib/postgresql/data + - name: inv-sig-helper + image: quay.io/invidious/inv-sig-helper@sha256:b5466c9add729e82e4e3ee5515c30b69df02d78ebb2486dbc9c63e456f29083d + restartPolicy: Always + args: ["--tcp", "0.0.0.0:12999"] + env: + - name: RUST_LOG + value: "info" + securityContext: + readOnlyRootFilesystem: true + capabilities: + drop: + - ALL containers: - name: invidious image: quay.io/invidious/invidious@sha256:9ffa4f1ea5cf01abe3102777102bd7a13153c79f6ff6ac072b6a29dda6909a8b @@ -79,3 +103,6 @@ spec: - name: invidious-config configMap: name: invidious-config + - name: postgres-data + persistentVolumeClaim: + claimName: longhorn-invidious-config