diff --git a/docker/Dockerfile b/docker/Dockerfile index 1c87e5b..fd7ff03 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -86,4 +86,4 @@ CMD ["server"] # USER appuser HEALTHCHECK --interval=1m --timeout=12s --start-period=30s \ - CMD aprsd healthcheck --config /config/aprsd.conf --loglevel DEBUG + CMD uv run aprsd healthcheck --config /config/aprsd.conf --loglevel DEBUG diff --git a/docker/bin/healthcheck.sh b/docker/bin/healthcheck.sh new file mode 100755 index 0000000..fd4eed2 --- /dev/null +++ b/docker/bin/healthcheck.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# +# This is the docker container healthcheck script +# It's assumed to be running in a working aprsd container. +set -x + +source /app/.venv/bin/activate + +if [ -z "${LOG_LEVEL}" ] || [[ ! "${LOG_LEVEL}" =~ ^(CRITICAL|ERROR|WARNING|INFO)$ ]]; then + LOG_LEVEL="DEBUG" +fi + +echo "Log level is set to ${LOG_LEVEL}"; + +# check to see if there is a config file +APRSD_CONFIG="/config/aprsd.conf" +if [ ! -e "$APRSD_CONFIG" ]; then + echo "'$APRSD_CONFIG' File does not exist. Creating." + aprsd sample-config > $APRSD_CONFIG +fi + +uv run aprsd healthcheck --config $APRSD_CONFIG --loglevel ${LOG_LEVEL}