Skip to content

Commit

Permalink
add healtcheck to dabase and fix timezone for FCOS
Browse files Browse the repository at this point in the history
  • Loading branch information
jbtrystram committed Jul 15, 2024
1 parent 3f570e2 commit 2fae24b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
6 changes: 6 additions & 0 deletions immich-database-healthcheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1
Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"
echo "checksum failure count is $$Chksum"
[ "$$Chksum" = '0' ] || exit 1
10 changes: 6 additions & 4 deletions immich-database.container
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ Pod=immich.pod
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
Volume=/path/to/database/database:/var/lib/postgresql/data:z
Volume=./immich-database-healthcheck:/health.sh
Exec= postgres -c shared_preload_libraries=vectors.so -c 'search_path="$$user", public, vectors' -c logging_collector=on -c max_wal_size=2GB -c shared_buffers=512MB -c wal_compression=on
HealthCmd=["/bin/bash", "/health.sh"]
HealthStartPeriod=5m
HealthInterval=5m
HealthTimeout=5s
HealthRetries=2
Notify=healthy
Expand Down
6 changes: 5 additions & 1 deletion immich-server.container
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ ContainerName=immich_server
EnvironmentFile=immich.env
Exec=start.sh immich
Image=immich-server.image
Volume=/home/raid/immich:/usr/src/app/upload:z
Volume=/path/to/immich/library:/usr/src/app/upload:z

# If localtime is not set (e.g. Fedora CoreOS) :
# Volume=/usr/share/zoneinfo/Europe/Paris:/etc/localtime:ro
Volume=/etc/localtime:/etc/localtime:ro

HealthCmd=["/bin/bash", "-c", "exec 5<>/dev/tcp/127.0.0.1/3001"]
HealthStartPeriod=30s
HealthInterval=10s
Expand Down

0 comments on commit 2fae24b

Please sign in to comment.