diff --git a/cluster/apps/jellystat/jellystat-db.yml b/cluster/apps/jellystat/jellystat-db.yml new file mode 100644 index 0000000..9968182 --- /dev/null +++ b/cluster/apps/jellystat/jellystat-db.yml @@ -0,0 +1,46 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: jellystat-db + namespace: default +spec: + replicas: 1 + selector: + matchLabels: + app: jellystat-db + template: + metadata: + labels: + app: jellystat-db + spec: + initContainers: + - name: init-cleanup + image: busybox + command: ["rm", "-rf", "/var/lib/postgresql/data/lost+found"] + volumeMounts: + - name: data + mountPath: /var/lib/postgresql/data + containers: + - name: jellystat-db + image: postgres:alpine + ports: + - containerPort: 5432 + env: + - name: POSTGRES_DB + value: "jfstat" + - name: POSTGRES_USER + value: "postgres" + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: jellystat-secret + key: password + volumeMounts: + - name: data + mountPath: /var/lib/postgresql/data + subPath: pgdata + volumes: + - name: data + persistentVolumeClaim: + claimName: longhorn-jellystat-data diff --git a/cluster/apps/jellystat/jellystat-pvc.yml b/cluster/apps/jellystat/jellystat-pvc.yml new file mode 100644 index 0000000..6666f02 --- /dev/null +++ b/cluster/apps/jellystat/jellystat-pvc.yml @@ -0,0 +1,13 @@ +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: longhorn-jellystat-data + namespace: default +spec: + accessModes: + - ReadWriteMany + storageClassName: longhorn + resources: + requests: + storage: 1Gi diff --git a/cluster/apps/jellystat/jellystat-svc.yml b/cluster/apps/jellystat/jellystat-svc.yml new file mode 100644 index 0000000..04f8948 --- /dev/null +++ b/cluster/apps/jellystat/jellystat-svc.yml @@ -0,0 +1,29 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: jellystat-service + namespace: default +spec: + type: NodePort + selector: + app: jellystat + ports: + - port: 3000 + targetPort: 3000 + nodePort: 3001 + protocol: TCP + +--- +apiVersion: v1 +kind: Service +metadata: + name: jellystat-db-service + namespace: default +spec: + selector: + app: jellystat-db + ports: + - protocol: TCP + port: 5432 + targetPort: 5432 diff --git a/cluster/apps/jellystat/jellystat.yml b/cluster/apps/jellystat/jellystat.yml new file mode 100644 index 0000000..3e894f9 --- /dev/null +++ b/cluster/apps/jellystat/jellystat.yml @@ -0,0 +1,57 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: jellystat + namespace: default +spec: + replicas: 1 + selector: + matchLabels: + app: jellystat + template: + metadata: + labels: + app: jellystat + spec: + initContainers: + - name: wait-for-db + image: busybox + command: + - sh + - -c + - | + until nc -z -v -w30 jellystat-db-service 5432; do + echo "Waiting for database to be ready..." + sleep 2 + done + containers: + - name: jellystat + image: cyfershepard/jellystat:1.1.5 + ports: + - containerPort: 3000 + env: + - name: POSTGRES_USER + value: "postgres" + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: jellystat-secret + key: password + - name: POSTGRES_IP + value: "jellystat-db-service" + - name: POSTGRES_PORT + value: "5432" + - name: JWT_SECRET + valueFrom: + secretKeyRef: + name: jellystat-secret + key: jwt + volumeMounts: + - name: backup + mountPath: /app/backend/backup-data + subPath: backup + volumes: + - name: backup + persistentVolumeClaim: + claimName: longhorn-jellystat-backup +