diff --git a/cluster/apps/invidious/invidious-helper.yml b/cluster/apps/invidious/invidious-helper.yml index c788e15..16f8680 100644 --- a/cluster/apps/invidious/invidious-helper.yml +++ b/cluster/apps/invidious/invidious-helper.yml @@ -2,27 +2,24 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: companion + name: invidious-companion namespace: default spec: replicas: 1 selector: matchLabels: - app: companion + app: invidious-companion template: metadata: labels: - app: companion + app: invidious-companion spec: containers: - - name: companion + - name: invidious-companion image: quay.io/invidious/invidious-companion:latest env: - name: SERVER_SECRET_KEY - valueFrom: - secretKeyRef: - name: companion-secrets - key: server-secret-key + value: "mtRhvm9wMCJhdnGP" ports: - containerPort: 8282 securityContext: diff --git a/cluster/apps/invidious/invidious-svc.yml b/cluster/apps/invidious/invidious-svc.yml index da0f44d..07c1fb4 100644 --- a/cluster/apps/invidious/invidious-svc.yml +++ b/cluster/apps/invidious/invidious-svc.yml @@ -1,7 +1,7 @@ apiVersion: v1 kind: Service metadata: - name: invidious-db + name: invidious-db-service namespace: default spec: selector: @@ -15,11 +15,11 @@ spec: apiVersion: v1 kind: Service metadata: - name: companion + name: invidious-companion-service namespace: default spec: selector: - app: companion + app: invidious-companion ports: - protocol: TCP port: 8282 @@ -40,3 +40,19 @@ spec: targetPort: 3000 nodePort: 3111 protocol: TCP + +--- +apiVersion: v1 +kind: Service +metadata: + name: invidious-companion-external-service + namespace: default +spec: + type: NodePort + selector: + app: invidious-companion + ports: + - port: 8282 + targetPort: 8282 + nodePort: 8282 + protocol: TCP diff --git a/cluster/apps/invidious/invidious.yml b/cluster/apps/invidious/invidious.yml index e22f9b9..9acee6b 100644 --- a/cluster/apps/invidious/invidious.yml +++ b/cluster/apps/invidious/invidious.yml @@ -15,73 +15,46 @@ spec: app: invidious spec: initContainers: - - name: config-generator + - name: wait-for-companion image: busybox command: - sh - -c - | - sed -e "s/__POSTGRES_PASSWORD__/${POSTGRES_PASSWORD}/" \ - -e "s/__COMPANION_KEY__/${COMPANION_KEY}/" \ - -e "s/__HMAC_KEY__/${HMAC_KEY}/" \ - /config-template.yaml > /config/config.yaml - env: - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: invidious-db-secrets - key: postgres-password - - name: COMPANION_KEY - valueFrom: - secretKeyRef: - name: invidious-app-secrets - key: companion-key - - name: HMAC_KEY - valueFrom: - secretKeyRef: - name: invidious-app-secrets - key: hmac-key - volumeMounts: - - name: config-template - mountPath: /config-template.yaml - subPath: config-template.yaml - - name: config - mountPath: /config + until nc -z -v -w30 invidious-companion-service 8282; 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 containers: - name: invidious image: quay.io/invidious/invidious:master env: - name: INVIDIOUS_CONFIG - valueFrom: - configMapKeyRef: - name: invidious-config - key: config.yaml - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: invidious-db-secrets - key: postgres-password - - name: COMPANION_KEY - valueFrom: - secretKeyRef: - name: invidious-app-secrets - key: companion-key - - name: HMAC_KEY - valueFrom: - secretKeyRef: - name: invidious-app-secrets - key: hmac-key - envFrom: - - secretRef: - name: invidious-db-secrets - - secretRef: - name: invidious-app-secrets - volumeMounts: - - name: config - mountPath: /app/config.yaml - subPath: config.yaml - - name: logging - mountPath: /var/log/invidious + value: | + db: + dbname: invidious + user: kemal + password: akshun@9501 + host: invidious-db-service + port: 5432 + check_tables: true + invidious_companion: + - private_url: "http://invidious-companion-service:8282" + public_url: "http://192.168.1.120:8282" + invidious_companion_key: "mtRhvm9wMCJhdnGP" + hmac_key: "qp/GnTJs5KCB8Ma8" + - name: INVIDIOUS_PORT + value: "3000" ports: - containerPort: 3000 livenessProbe: @@ -92,11 +65,10 @@ spec: periodSeconds: 30 timeoutSeconds: 5 failureThreshold: 2 + volumeMounts: + - name: logging + mountPath: /var/log/invidious volumes: - name: logging emptyDir: {} - - name: config-template - configMap: - name: invidious-config-template - - name: config - emptyDir: {} +