split db, companion and app into three deployments
This commit is contained in:
28
clusters/default/media/invidious/invidious-companion.yml
Normal file
28
clusters/default/media/invidious/invidious-companion.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: invidious-companion
|
||||
namespace: media
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: invidious-companion
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: invidious-companion
|
||||
spec:
|
||||
containers:
|
||||
- name: inv-companion
|
||||
image: quay.io/invidious/invidious-companion@sha256:d68a312073920572e39b0d4ae486f22885819567fae5fac23220f7b750f8e295
|
||||
env:
|
||||
- name: SERVER_SECRET_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: invidious-secrets
|
||||
key: INVIDIOUS_COMPANION_KEY
|
||||
securityContext:
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
@@ -10,10 +10,10 @@ data:
|
||||
dbname: invidious
|
||||
user: kemal
|
||||
password: ${INVIDIOUS_DB_PASSWORD}
|
||||
host: localhost
|
||||
host: invidious-db-service
|
||||
port: 5432
|
||||
check_tables: true
|
||||
invidious_companion:
|
||||
- private_url: "http://localhost:8282/companion"
|
||||
- private_url: "http://invidious-companion-service:8282/companion"
|
||||
invidious_companion_key: ${INVIDIOUS_COMPANION_KEY}
|
||||
hmac_key: ${INVIDIOUS_HMAC_KEY}
|
||||
|
||||
55
clusters/default/media/invidious/invidious-db.yml
Normal file
55
clusters/default/media/invidious/invidious-db.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: invidious-db
|
||||
namespace: media
|
||||
spec:
|
||||
strategy:
|
||||
type: Recreate
|
||||
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/lost+found
|
||||
volumeMounts:
|
||||
- name: postgres-data
|
||||
mountPath: /var/lib/postgresql
|
||||
containers:
|
||||
- name: postgres
|
||||
image: postgres:18
|
||||
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
|
||||
volumes:
|
||||
- name: postgres-data
|
||||
persistentVolumeClaim:
|
||||
claimName: invidious-longhorn
|
||||
@@ -15,3 +15,29 @@ spec:
|
||||
- port: 3111
|
||||
targetPort: 3000
|
||||
protocol: TCP
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: invidious-companion-service
|
||||
namespace: media
|
||||
spec:
|
||||
selector:
|
||||
app: invidious-companion
|
||||
ports:
|
||||
- port: 8282
|
||||
targetPort: 8282
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: invidious-db-service
|
||||
namespace: media
|
||||
spec:
|
||||
selector:
|
||||
app: invidious-db
|
||||
ports:
|
||||
- port: 5432
|
||||
targetPort: 5432
|
||||
|
||||
@@ -33,51 +33,28 @@ spec:
|
||||
- name: tmp
|
||||
mountPath: /mnt
|
||||
subPath: invidious.yml
|
||||
- name: clean-db-dir
|
||||
- name: wait-for-db
|
||||
image: busybox
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
rm -rf /var/lib/postgresql/lost+found
|
||||
volumeMounts:
|
||||
- name: postgres-data
|
||||
mountPath: /var/lib/postgresql
|
||||
- name: postgres
|
||||
image: postgres:18
|
||||
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
|
||||
- name: inv-companion
|
||||
image: quay.io/invidious/invidious-companion@sha256:d68a312073920572e39b0d4ae486f22885819567fae5fac23220f7b750f8e295
|
||||
restartPolicy: Always
|
||||
env:
|
||||
- name: SERVER_SECRET_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: invidious-secrets
|
||||
key: INVIDIOUS_COMPANION_KEY
|
||||
securityContext:
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
until nc -z -v -w30 invidious-db-service 5432
|
||||
do
|
||||
echo "Waiting for database connection..."
|
||||
sleep 5
|
||||
done
|
||||
- name: wait-for-companion
|
||||
image: busybox
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
until nc -z -v -w30 invidious-companion-service 8282
|
||||
do
|
||||
echo "Waiting for invidious companion connection..."
|
||||
sleep 5
|
||||
done
|
||||
containers:
|
||||
- name: invidious
|
||||
image: quay.io/invidious/invidious@sha256:2836b5b8226a53a9cc2afdbd5f5fe6bccdd200f2e17cd92a828b4dc8d8b5cc06
|
||||
@@ -106,6 +83,3 @@ spec:
|
||||
- name: invidious-config
|
||||
configMap:
|
||||
name: invidious-config
|
||||
- name: postgres-data
|
||||
persistentVolumeClaim:
|
||||
claimName: invidious-longhorn
|
||||
|
||||
Reference in New Issue
Block a user