feat: warn when incorrect interface/port in use for web processes

Users that misconfigure their process's listening interface or port will now see an additional healthcheck warning for web deploys. While only a single port is checked, this ensures that users at least have some context as to why their app isn't responding as expected.

Closes #4798
This commit is contained in:
Jose Diaz-Gonzalez
2023-10-15 03:01:14 -04:00
parent ab8a957786
commit f33d7f129b
7 changed files with 37 additions and 28 deletions

View File

@@ -148,7 +148,12 @@ trigger-scheduler-docker-local-check-deploy() {
ARG_ARRAY+=("$DOKKU_APP_LISTEN_PORT")
fi
docker-container-healthchecker check "$DOKKU_APP_CONTAINER_ID" "${ARG_ARRAY[@]}" || FAILEDCHECKS="$?"
if [[ "$DOKKU_APP_CONTAINER_TYPE" == "web" ]]; then
content="$(docker-container-healthchecker add "$DOKKU_APP_CONTAINER_TYPE" --app-json "$TMP_APP_JSON_OUTPUT" --listening-check --name "port listening check" --port "$DOKKU_APP_LISTEN_PORT" --pretty --warn-only)"
echo "$content" >"$TMP_APP_JSON_OUTPUT"
fi
sudo /usr/bin/docker-container-healthchecker check "$DOKKU_APP_CONTAINER_ID" "${ARG_ARRAY[@]}" || FAILEDCHECKS="$?"
if [[ $FAILEDCHECKS -gt 0 ]]; then
"$DOCKER_BIN" container update --restart=no "$DOKKU_APP_CONTAINER_ID" &>/dev/null || true

View File

@@ -17,6 +17,9 @@ trigger-scheduler-docker-local-install() {
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/crontab" >"/etc/sudoers.d/dokku-cron"
chmod "0440" "/etc/sudoers.d/dokku-cron"
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/docker-container-healthchecker" >"/etc/sudoers.d/dokku-docker-container-healthchecker"
chmod "0440" "/etc/sudoers.d/dokku-docker-container-healthchecker"
DOKKU_PATH="$(command -v dokku)"
if [[ $(systemctl 2>/dev/null) =~ -\.mount ]]; then