1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-07 23:03:36 +02:00

feat(server): add Bash healthcheck script (#14704)

* feat(server): add Bash healthcheck script

* fix(server): add 2 second timeout for healthcheck.js parity

* chore(server): delete old healthcheck Node script

* fix(server): feedback

---------

Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
000yesnt
2024-12-16 12:19:18 -03:00
committed by GitHub
parent 4edeed9739
commit f180ae70f9
2 changed files with 20 additions and 36 deletions

View File

@ -1,3 +1,22 @@
#!/usr/bin/env bash
node /usr/src/app/dist/bin/healthcheck.js
if [[ ( $IMMICH_WORKERS_INCLUDE != '' && $IMMICH_WORKERS_INCLUDE != *api* ) || $IMMICH_WORKERS_EXCLUDE == *api* ]]; then
echo "API worker excluded, skipping";
exit 0;
fi
IMMICH_HOST="${IMMICH_HOST:-localhost}"
IMMICH_PORT="${IMMICH_PORT:-2283}"
result=$(curl -fsS -m 2 http://"$IMMICH_HOST":"$IMMICH_PORT"/api/server/ping)
result_exit=$?
if [ $result_exit != 0 ]; then
echo "Fail: exit code is $result_exit";
exit 1;
fi
if [ "$result" != "{\"res\":\"pong\"}" ]; then
echo "Fail: didn't reply with pong";
exit 1;
fi