Skip to content

Commit

Permalink
feat(server): add Bash healthcheck script (#14704)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
000yesnt and alextran1502 authored Dec 16, 2024
1 parent 4edeed9 commit f180ae7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 36 deletions.
21 changes: 20 additions & 1 deletion server/bin/immich-healthcheck
Original file line number Diff line number Diff line change
@@ -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
35 changes: 0 additions & 35 deletions server/src/bin/healthcheck.ts

This file was deleted.

0 comments on commit f180ae7

Please sign in to comment.