From e8c9f70004020877e53eb9c43c9b9adf6a6179e4 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Tue, 23 Oct 2018 16:53:34 +0200 Subject: [PATCH] new: [apache] will detect efficiently changes and elegantly reload on configuration files modification. --- apache/hooks/pre_deploy | 8 ++++++++ apache/lib/common | 12 ++++++++++++ 2 files changed, 20 insertions(+) create mode 100755 apache/hooks/pre_deploy diff --git a/apache/hooks/pre_deploy b/apache/hooks/pre_deploy new file mode 100755 index 00000000..e6c1a66b --- /dev/null +++ b/apache/hooks/pre_deploy @@ -0,0 +1,8 @@ +#!/bin/bash +## Should be executable N time in a row with same result. + +set -e + +. lib/common + +apache_config_hash || exit 1 diff --git a/apache/lib/common b/apache/lib/common index 755ffe63..dde615af 100644 --- a/apache/lib/common +++ b/apache/lib/common @@ -510,3 +510,15 @@ $(__vhost_creds_statement | prefix " ") EOF } + + +apache_config_hash() { + debug "Adding config hash to enable recreating upon config change." + config_hash=$(find "$SERVICE_CONFIGSTORE/etc/apache2/sites-enabled" \ + -name \*.conf -exec md5sum {} \; | md5_compat) || exit 1 + init-config-add " +$MASTER_BASE_SERVICE_NAME: + labels: + - compose.config_hash=$config_hash +" +}