From 29e17347117ae906b28f80694c47ede0f963678c Mon Sep 17 00:00:00 2001 From: Garvin LeClaire Date: Mon, 24 Apr 2017 09:32:25 -0400 Subject: [PATCH] Replace notify file watching with simplywatch ( https://github.com/danielkalen/simplywatch ) to allow stable file reloads on file changes --- Dockerfile | 1 + docker-compose.yml | 1 + load-config.sh | 6 ++---- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7198427..9149e1c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ MAINTAINER Pierre Besson https://github.com/PierreBesson RUN apk --update add nodejs git openssh curl bash inotify-tools jq && \ rm -rf /var/cache/apk/* && \ + npm install -g simplywatch && \ npm install -g git2consul@0.12.12 && \ mkdir -p /etc/git2consul.d diff --git a/docker-compose.yml b/docker-compose.yml index 32f845d..6dee963 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,3 +16,4 @@ services: - CONFIG_MODE=filesystem #- CONFIG_MODE=git - INIT_SLEEP_SECONDS=5 + - CONSUL_URL=consul diff --git a/load-config.sh b/load-config.sh index db138bd..5bbc5a5 100755 --- a/load-config.sh +++ b/load-config.sh @@ -36,10 +36,8 @@ if [[ "$CONFIG_MODE" == "filesystem" ]]; then loadPropertiesFilesIntoConsul # Reload the files when there is a file change - inotifywait -q -m --format '%f' -e close_write $CONFIG_DIR/ | while read - do - loadPropertiesFilesIntoConsul - done + simplywatch -g "$CONFIG_DIR/**" -x "curl --output /dev/null -sX PUT --data-binary @{{path}} http://$CONSUL_URL:$CONSUL_PORT/v1/kv/config/{{name}}/data && echo ' Consul Config reloaded'" + fi if [[ "$CONFIG_MODE" == "git" ]]; then