Skip to content

Commit

Permalink
fix healthcheck again
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoey2936 committed Jan 26, 2024
1 parent 235bdc2 commit 740d4c7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/update-and-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
jobs:
update-and-lint:
runs-on: ubuntu-latest
if: ${{ github.ref_name == 'develop' }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
25 changes: 20 additions & 5 deletions rootfs/usr/local/bin/healthcheck.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
#!/bin/sh

export HC_IP="localhost"
export HCNPM_IP="localhost"
export HCGOA_IP="localhost"

if [ "$NPM_LISTEN_LOCALHOST" = "true" ]; then
export NPM_IPV4_BINDING="127.0.0.1"
export NPM_IPV6_BINDING="[::1]"
fi

if [ "$NPM_IPV6_BINDING" != "[::]" ] && [ "$NPM_IPV4_BINDING" != "0.0.0.0" ]; then
if [ "$NPM_IPV6_BINDING" != "[::]" ] && [ "$DISABLE_IPV6" = "false" ]; then
export HC_IP="$NPM_IPV6_BINDING"
if [ "$NPM_IPV6_BINDING" != "[::]" ] && [ "$NPM_DISABLE_IPV6" = "false" ]; then
export HCNPM_IP="$NPM_IPV6_BINDING"
fi
if [ "$NPM_IPV4_BINDING" != "0.0.0.0" ]; then
export HC_IP="$NPM_IPV4_BINDING"
export HCNPM_IP="$NPM_IPV4_BINDING"
fi
fi

if (if [ "$GOA" = "true" ]; then [ -f /tmp/goa/index.html ]; fi && if [ "$PHP81" = true ]; then cgi-fcgi -bind -connect /var/php81.sock > /dev/null 2>&1; fi && if [ "$PHP82" = true ]; then cgi-fcgi -bind -connect /var/php82.sock > /dev/null 2>&1; fi && if [ "$PHP83" = true ]; then cgi-fcgi -bind -connect /var/php83.sock > /dev/null 2>&1; fi && [ "$(curl -sk https://"$HC_IP":"$NPM_PORT"/api/ | jq --raw-output .status)" = "OK" ]); then
if [ "$GOA_LISTEN_LOCALHOST" = "true" ]; then
export GOA_IPV4_BINDING="127.0.0.1"
export GOA_IPV6_BINDING="[::1]"
fi

if [ "$GOA_IPV6_BINDING" != "[::]" ] && [ "$GOA_IPV4_BINDING" != "0.0.0.0" ]; then
if [ "$GOA_IPV6_BINDING" != "[::]" ] && [ "$GOA_DISABLE_IPV6" = "false" ]; then
export HCGOA_IP="$GOA_IPV6_BINDING"
fi
if [ "$NPM_IPV4_BINDING" != "0.0.0.0" ]; then
export HCGOA_IP="$GOA_IPV4_BINDING"
fi
fi

if (if [ "$GOA" = "true" ]; then [ -f /tmp/goa/index.html ] && nc -z "$HCGOA_IP" "$GOA_PORT"; fi && if [ "$PHP81" = true ]; then cgi-fcgi -bind -connect /run/php81.sock > /dev/null 2>&1; fi && if [ "$PHP82" = true ]; then cgi-fcgi -bind -connect /run/php82.sock > /dev/null 2>&1; fi && if [ "$PHP83" = true ]; then cgi-fcgi -bind -connect /run/php83.sock > /dev/null 2>&1; fi && [ "$(curl -sk https://"$HCNPM_IP":"$NPM_PORT"/api/ | jq --raw-output .status)" = "OK" ]); then
echo "OK"
exit 0
else
Expand Down

0 comments on commit 740d4c7

Please sign in to comment.