split db and app into two deployments
This commit is contained in:
42
clusters/default/monitoring/jellystat/jellystat-db.yml
Normal file
42
clusters/default/monitoring/jellystat/jellystat-db.yml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: jellystat-db
|
||||||
|
namespace: monitoring
|
||||||
|
spec:
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: jellystat-db
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: jellystat-db
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: jellystat-db
|
||||||
|
image: postgres:alpine
|
||||||
|
ports:
|
||||||
|
- containerPort: 5432
|
||||||
|
env:
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: jellystat-secret
|
||||||
|
key: password
|
||||||
|
- name: POSTGRES_DB
|
||||||
|
value: "jfstat"
|
||||||
|
- name: POSTGRES_USER
|
||||||
|
value: "postgres"
|
||||||
|
- name: PGDATA
|
||||||
|
value: /mnt/postgres/data
|
||||||
|
volumeMounts:
|
||||||
|
- name: postgres-data
|
||||||
|
mountPath: /mnt/postgres
|
||||||
|
volumes:
|
||||||
|
- name: postgres-data
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: jellystat-longhorn
|
||||||
@@ -15,3 +15,16 @@ spec:
|
|||||||
- port: 3001
|
- port: 3001
|
||||||
targetPort: 3000
|
targetPort: 3000
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: jellystat-db-service
|
||||||
|
namespace: monitoring
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: jellystat-db
|
||||||
|
ports:
|
||||||
|
- port: 5432
|
||||||
|
targetPort: 5432
|
||||||
|
|||||||
@@ -17,55 +17,35 @@ spec:
|
|||||||
app: jellystat
|
app: jellystat
|
||||||
spec:
|
spec:
|
||||||
initContainers:
|
initContainers:
|
||||||
- name: jellystat-db
|
- name: wait-for-db
|
||||||
image: postgres:alpine
|
image: busybox
|
||||||
restartPolicy: Always
|
command: ['sh', '-c', 'until nc -z -v -w30 jellystat-db-service 5432; do echo "Waiting for database..."; sleep 5; done;']
|
||||||
ports:
|
|
||||||
- containerPort: 5432
|
|
||||||
env:
|
|
||||||
- name: POSTGRES_DB
|
|
||||||
value: "jfstat"
|
|
||||||
- name: POSTGRES_USER
|
|
||||||
value: "postgres"
|
|
||||||
- name: POSTGRES_PASSWORD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: jellystat-secret
|
|
||||||
key: password
|
|
||||||
- name: PGDATA
|
|
||||||
value: /mnt/postgres/data
|
|
||||||
volumeMounts:
|
|
||||||
- name: postgres-data
|
|
||||||
mountPath: /mnt/postgres
|
|
||||||
containers:
|
containers:
|
||||||
- name: jellystat
|
- name: jellystat
|
||||||
image: cyfershepard/jellystat:1.1.6
|
image: cyfershepard/jellystat:1.1.6
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 3000
|
- containerPort: 3000
|
||||||
env:
|
env:
|
||||||
- name: POSTGRES_USER
|
- name: JWT_SECRET
|
||||||
value: "postgres"
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: jellystat-secret
|
||||||
|
key: jwt
|
||||||
- name: POSTGRES_PASSWORD
|
- name: POSTGRES_PASSWORD
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: jellystat-secret
|
name: jellystat-secret
|
||||||
key: password
|
key: password
|
||||||
- name: POSTGRES_IP
|
- name: POSTGRES_IP
|
||||||
value: "localhost"
|
value: "jellystat-db-service"
|
||||||
- name: POSTGRES_PORT
|
- name: POSTGRES_PORT
|
||||||
value: "5432"
|
value: "5432"
|
||||||
- name: JWT_SECRET
|
- name: POSTGRES_USER
|
||||||
valueFrom:
|
value: "postgres"
|
||||||
secretKeyRef:
|
|
||||||
name: jellystat-secret
|
|
||||||
key: jwt
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: backups
|
- name: backups
|
||||||
mountPath: /app/backend/backup-data
|
mountPath: /app/backend/backup-data
|
||||||
volumes:
|
volumes:
|
||||||
- name: postgres-data
|
|
||||||
persistentVolumeClaim:
|
|
||||||
claimName: jellystat-longhorn
|
|
||||||
- name: backups
|
- name: backups
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: jellystat-backups-longhorn
|
claimName: jellystat-backups-longhorn
|
||||||
|
|||||||
Reference in New Issue
Block a user