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
|
dbname: invidious
|
||||||
user: kemal
|
user: kemal
|
||||||
password: ${INVIDIOUS_DB_PASSWORD}
|
password: ${INVIDIOUS_DB_PASSWORD}
|
||||||
host: localhost
|
host: invidious-db-service
|
||||||
port: 5432
|
port: 5432
|
||||||
check_tables: true
|
check_tables: true
|
||||||
invidious_companion:
|
invidious_companion:
|
||||||
- private_url: "http://localhost:8282/companion"
|
- private_url: "http://invidious-companion-service:8282/companion"
|
||||||
invidious_companion_key: ${INVIDIOUS_COMPANION_KEY}
|
invidious_companion_key: ${INVIDIOUS_COMPANION_KEY}
|
||||||
hmac_key: ${INVIDIOUS_HMAC_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
|
- port: 3111
|
||||||
targetPort: 3000
|
targetPort: 3000
|
||||||
protocol: TCP
|
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
|
- name: tmp
|
||||||
mountPath: /mnt
|
mountPath: /mnt
|
||||||
subPath: invidious.yml
|
subPath: invidious.yml
|
||||||
- name: clean-db-dir
|
- name: wait-for-db
|
||||||
image: busybox
|
image: busybox
|
||||||
command:
|
command:
|
||||||
- sh
|
- sh
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
rm -rf /var/lib/postgresql/lost+found
|
until nc -z -v -w30 invidious-db-service 5432
|
||||||
volumeMounts:
|
do
|
||||||
- name: postgres-data
|
echo "Waiting for database connection..."
|
||||||
mountPath: /var/lib/postgresql
|
sleep 5
|
||||||
- name: postgres
|
done
|
||||||
image: postgres:18
|
- name: wait-for-companion
|
||||||
restartPolicy: Always
|
image: busybox
|
||||||
env:
|
command:
|
||||||
- name: POSTGRES_DB
|
- sh
|
||||||
valueFrom:
|
- -c
|
||||||
secretKeyRef:
|
- |
|
||||||
name: invidious-db-secrets
|
until nc -z -v -w30 invidious-companion-service 8282
|
||||||
key: postgres-db
|
do
|
||||||
- name: POSTGRES_USER
|
echo "Waiting for invidious companion connection..."
|
||||||
valueFrom:
|
sleep 5
|
||||||
secretKeyRef:
|
done
|
||||||
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
|
|
||||||
containers:
|
containers:
|
||||||
- name: invidious
|
- name: invidious
|
||||||
image: quay.io/invidious/invidious@sha256:2836b5b8226a53a9cc2afdbd5f5fe6bccdd200f2e17cd92a828b4dc8d8b5cc06
|
image: quay.io/invidious/invidious@sha256:2836b5b8226a53a9cc2afdbd5f5fe6bccdd200f2e17cd92a828b4dc8d8b5cc06
|
||||||
@@ -106,6 +83,3 @@ spec:
|
|||||||
- name: invidious-config
|
- name: invidious-config
|
||||||
configMap:
|
configMap:
|
||||||
name: invidious-config
|
name: invidious-config
|
||||||
- name: postgres-data
|
|
||||||
persistentVolumeClaim:
|
|
||||||
claimName: invidious-longhorn
|
|
||||||
|
|||||||
Reference in New Issue
Block a user