Skip to content

Commit a95959b

Browse files
edomora97nickygerritsen
authored andcommitted
Add curl and honor WEBAPP_BASEURL in health check
1 parent b2957f0 commit a95959b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

docker/domserver/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ENV DEBIAN_FRONTEND=noninteractive \
5454
# Install required packages for running of domserver
5555
RUN apt-get update \
5656
&& apt-get install --no-install-recommends --no-install-suggests -y \
57-
acl zip unzip supervisor mariadb-client apache2-utils \
57+
acl curl zip unzip supervisor mariadb-client apache2-utils \
5858
nginx php-cli php-fpm php-zip \
5959
php-gd php-curl php-mysql php-json php-intl \
6060
php-gmp php-xml php-mbstring php-ldap \

docker/domserver/scripts/bin/healthcheck

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ for service in "${SERVICES[@]}"; do
1313
fi
1414
done
1515

16-
if php -r 'exit(@file_get_contents("http://localhost/api/") === false ? 1 : 0);'; then
16+
# This script has access to $WEBAPP_BASEURL, but not to the sanity checks done by 50-domejudge. So we fallback looking
17+
# at the configuration file where this path is stored.
18+
BASEURL=$(grep domjudge.baseurl /opt/domjudge/domserver/webapp/config/static.yaml | awk '{ print $2 }')
19+
if curl --silent --fail "$BASEURL/api" >/dev/null; then
1720
printf "http ok"
1821
else
1922
printf "http error"

0 commit comments

Comments
 (0)