Skip to content

Commit

Permalink
Add health-check to containers
Browse files Browse the repository at this point in the history
podman 4.9 allow healthcheck to conditionnaly
mark the service ready. This will allow for
smoother dependencies between the services

Taken from immich-app/immich#6320 (comment)
  • Loading branch information
jbtrystram committed May 21, 2024
1 parent d709355 commit aac2782
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
6 changes: 6 additions & 0 deletions immich-database.container
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ ContainerName=immich_postgres
EnvironmentFile=immich.env
Image=docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
Volume=pgdata:/var/lib/postgresql/data
HealthCmd=["/usr/bin/pg_isready"]
HealthStartPeriod=30s
HealthInterval=10s
HealthTimeout=5s
HealthRetries=5
Notify=healthy

[Service]
Restart=always
6 changes: 6 additions & 0 deletions immich-machine-learning.container
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ ContainerName=immich_machine_learning
EnvironmentFile=immich.env
Image=ghcr.io/immich-app/immich-machine-learning:v1.101.0
Volume=model-cache:/cache
HealthCmd='["/bin/bash", "-c", "exec 5<>/dev/tcp/127.0.0.1/3003"]'
HealthStartPeriod=30s
HealthInterval=10s
HealthTimeout=5s
HealthRetries=5
Notify=healthy

[Service]
Restart=always
9 changes: 8 additions & 1 deletion immich-microservices.container
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ Exec=start.sh microservices
Image=immich-server.image
Volume=/home/raid/immich:/usr/src/app/upload:z
Volume=/etc/localtime:/etc/localtime:ro
HealthCmd='["/bin/bash", "-c", "exec 5<>/dev/tcp/127.0.0.1/3002"]'
HealthStartPeriod=30s
HealthInterval=10s
HealthTimeout=5s
HealthRetries=5
Notify=healthy

[Service]
Restart=always
Restart=always

9 changes: 8 additions & 1 deletion immich-redis.container
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
Pod=immich.pod
ContainerName=immich_redis
Image=docker.io/redis:6.2-alpine@sha256:51d6c56749a4243096327e3fb964a48ed92254357108449cb6e23999c37773c5
HealthCmd='["/usr/local/bin/redis-cli", "ping"]'
HealthStartPeriod=30s
HealthInterval=10s
HealthTimeout=5s
HealthRetries=5
Notify=healthy

[Service]
Restart=always
Restart=always

6 changes: 6 additions & 0 deletions immich-server.container
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Exec=start.sh immich
Image=immich-server.image
Volume=/home/raid/immich:/usr/src/app/upload:z
Volume=/etc/localtime:/etc/localtime:ro
HealthCmd='["/bin/bash", "-c", "exec 5<>/dev/tcp/127.0.0.1/3001"]'
HealthStartPeriod=30s
HealthInterval=10s
HealthTimeout=30s
HealthRetries=10
Notify=healthy

[Service]
Restart=always
Expand Down

0 comments on commit aac2782

Please sign in to comment.