use statefulSets and readinessProbes instead of initContainers
This commit is contained in:
@@ -1,30 +1,33 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: immich-db
|
||||
name: immich-psql
|
||||
namespace: media
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: immich-db
|
||||
app: immich-psql
|
||||
serviceName: immich-psql
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: immich-db
|
||||
app: immich-psql
|
||||
spec:
|
||||
initContainers:
|
||||
- name: cleanup
|
||||
image: busybox
|
||||
command: ['sh', '-c', 'rm -rf /var/lib/postgresql/data/lost+found']
|
||||
volumeMounts:
|
||||
- name: immich-db
|
||||
mountPath: /var/lib/postgresql/data
|
||||
containers:
|
||||
- name: redis
|
||||
image: docker.io/valkey/valkey:8-bookworm@sha256:fea8b3e67b15729d4bb70589eb03367bab9ad1ee89c876f54327fc7c6e618571
|
||||
env:
|
||||
- name: REDIS_HOSTNAME
|
||||
value: "localhost"
|
||||
ports:
|
||||
- containerPort: 6379
|
||||
- name: immich-psql
|
||||
image: ghcr.io/immich-app/postgres:14-vectorchord0.3.0-pgvectors0.2.0
|
||||
ports:
|
||||
- containerPort: 5432
|
||||
name: postgres
|
||||
env:
|
||||
- name: POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
@@ -39,9 +42,13 @@ spec:
|
||||
value: "--data-checksums"
|
||||
volumeMounts:
|
||||
- mountPath: /var/lib/postgresql/data
|
||||
name: immich
|
||||
volumes:
|
||||
- name: immich
|
||||
nfs:
|
||||
server: 10.0.0.10
|
||||
path: /home/akshun/immich-data
|
||||
name: immich-db
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: immich-db
|
||||
spec:
|
||||
accessModes: ["ReadWriteOnce"]
|
||||
resources:
|
||||
requests:
|
||||
storage: 5Gi
|
||||
storageClassName: longhorn
|
||||
|
||||
23
clusters/default/media/immich/immich-redis.yml
Normal file
23
clusters/default/media/immich/immich-redis.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: immich-redis
|
||||
namespace: media
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: immich-redis
|
||||
serviceName: immich-redis
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: immich-redis
|
||||
spec:
|
||||
containers:
|
||||
- name: redis
|
||||
image: docker.io/valkey/valkey:8-bookworm@sha256:fea8b3e67b15729d4bb70589eb03367bab9ad1ee89c876f54327fc7c6e618571
|
||||
ports:
|
||||
- containerPort: 6379
|
||||
name: redis
|
||||
@@ -36,26 +36,28 @@ spec:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: immich-psql-service
|
||||
name: immich-psql
|
||||
namespace: media
|
||||
spec:
|
||||
selector:
|
||||
app: immich-db
|
||||
app: immich-psql
|
||||
ports:
|
||||
- protocol: TCP
|
||||
- name: postgres
|
||||
port: 5432
|
||||
targetPort: 5432
|
||||
clusterIP: None
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: immich-redis-service
|
||||
name: immich-redis
|
||||
namespace: media
|
||||
spec:
|
||||
selector:
|
||||
app: immich-db
|
||||
app: immich-redis
|
||||
ports:
|
||||
- protocol: TCP
|
||||
- name: redis
|
||||
port: 6379
|
||||
targetPort: 6379
|
||||
clusterIP: None
|
||||
|
||||
@@ -16,48 +16,37 @@ spec:
|
||||
labels:
|
||||
app: immich-app
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-redis
|
||||
image: busybox
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
until nc -z -v -w30 immich-redis-service 6379; do
|
||||
echo "Waiting for redis database to be ready..."
|
||||
sleep 2
|
||||
done
|
||||
- name: wait-for-psql
|
||||
image: busybox
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
until nc -z -v -w30 immich-psql-service 5432; do
|
||||
echo "Waiting for psql database to be ready"
|
||||
sleep 2
|
||||
done
|
||||
containers:
|
||||
- name: immich-server
|
||||
image: ghcr.io/immich-app/immich-server:v2.3.1
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
pg_isready -h immich-psql.media.svc.cluster.local -U postgres -p 5432
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 5
|
||||
failureThreshold: 5
|
||||
ports:
|
||||
- containerPort: 2283
|
||||
env:
|
||||
- name: TZ
|
||||
value: "Asia/Kolkata"
|
||||
- name: REDIS_HOSTNAME
|
||||
value: "immich-redis-service"
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: immich-postgres-secret
|
||||
key: password
|
||||
value: "immich-redis.media.svc.cluster.local"
|
||||
- name: DB_USERNAME
|
||||
value: "postgres"
|
||||
- name: DB_DATABASE_NAME
|
||||
value: "immich"
|
||||
- name: DB_HOSTNAME
|
||||
value: "immich-psql-service"
|
||||
value: "immich-psql.media.svc.cluster.local"
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: immich-postgres-secret
|
||||
key: password
|
||||
volumeMounts:
|
||||
- mountPath: /usr/src/app/upload
|
||||
name: pictures
|
||||
|
||||
Reference in New Issue
Block a user