Simplify reloading the configuration with docker

Allow `docker kill -s HUP` and `docker-compose kill -s HUP` to reach the
node process.
This commit is contained in:
zstadler 2021-12-22 18:38:44 +02:00
parent 8680a8006a
commit 6027d89623
2 changed files with 11 additions and 5 deletions

View file

@ -10,6 +10,14 @@ handle() {
trap handle INT TERM trap handle INT TERM
refresh() {
SIGNAL=$(( $? - 128 ))
echo "Caught signal ${SIGNAL}, refreshing"
kill -s ${SIGNAL} $(pidof node) 2>/dev/null
}
trap refresh HUP
if ! which -- "${1}"; then if ! which -- "${1}"; then
# first arg is not an executable # first arg is not an executable
xvfb-run -a --server-args="-screen 0 1024x768x24" -- node /app/ "$@" & xvfb-run -a --server-args="-screen 0 1024x768x24" -- node /app/ "$@" &

View file

@ -29,12 +29,10 @@ Default preview style and configuration
- If no configuration file is specified, a default preview style (compatible with openmaptiles) is used. - If no configuration file is specified, a default preview style (compatible with openmaptiles) is used.
- If no mbtiles file is specified (and is not found in the current working directory), a sample file is downloaded (showing the Zurich area) - If no mbtiles file is specified (and is not found in the current working directory), a sample file is downloaded (showing the Zurich area)
Reloading configuration Reloading the configuration
====== ======
It is possible to reload the configuration file without restarting the whole process by sending a SIGHUP signal to the node process. It is possible to reload the configuration file without restarting the whole process by sending a SIGHUP signal to the node process.
When running the tileserver-gl docker container, the signal must be sent from within the container: - The `docker kill -s HUP tileserver-gl` command can be used when running the tileserver-gl docker container.
:: - The `docker-compose -s HUP tileserver-gl-service-name` can be used when tileserver-gl is run as a docker-compose service.
docker exec tileserver-gl bash -c 'kill -HUP $(ls -l /proc/*/exe | sed -n "/\/node$/s/.*proc\/\([0-9]\+\)\/exe .*/\1/p")'