@ -1,5 +1,6 @@
# -*- mode: shell-script -*-
# -*- mode: shell-script -*-
config_hash=
apache_proxy_dir () {
apache_proxy_dir () {
DOMAIN=$(relation-get domain) || {
DOMAIN=$(relation-get domain) || {
@ -150,6 +151,7 @@ ssl_fallback_prepare() {
if [ "$content" ]; then
if [ "$content" ]; then
location="$(eval echo "\$__vhost_cfg_SSL_${label^^}_LOCATION")"
location="$(eval echo "\$__vhost_cfg_SSL_${label^^}_LOCATION")"
echo "$content" | file_put "$dst$location"
echo "$content" | file_put "$dst$location"
config_hash=$(printf "%s\0" "$config_hash" "$label" "$content" | md5_compat)
volumes="$volumes
volumes="$volumes
- $dst$location:$location:ro"
- $dst$location:$location:ro"
fi
fi
@ -314,6 +316,7 @@ apache_core_rules_add() {
local conf="$1" dst="/etc/apache2/conf-enabled/$BASE_SERVICE_NAME.conf"
local conf="$1" dst="/etc/apache2/conf-enabled/$BASE_SERVICE_NAME.conf"
debug "Adding core rule."
debug "Adding core rule."
echo "$conf" | file_put "$CONFIGSTORE/$BASE_SERVICE_NAME$dst"
echo "$conf" | file_put "$CONFIGSTORE/$BASE_SERVICE_NAME$dst"
config_hash=$(printf "%s\0" "$config_hash" "$conf" | md5_compat)
config-add "
config-add "
$MASTER_BASE_SERVICE_NAME:
$MASTER_BASE_SERVICE_NAME:
volumes:
volumes:
@ -474,6 +477,8 @@ __vhost_full_vhost_statement() {
$(__vhost_head_statement "$protocol" | prefix " ")
$(__vhost_head_statement "$protocol" | prefix " ")
$(__vhost_custom_rules | prefix " ")
$(__vhost_content_statement "$protocol" | prefix " ")
$(__vhost_content_statement "$protocol" | prefix " ")
## Forbid any cache, this is only usefull on dev server.
## Forbid any cache, this is only usefull on dev server.
@ -482,7 +487,6 @@ $(__vhost_content_statement "$protocol" | prefix " ")
#Header set Access-Control-Allow-Methods "POST, GET, OPTIONS"
#Header set Access-Control-Allow-Methods "POST, GET, OPTIONS"
#Header set Access-Control-Allow-Headers "origin, content-type, accept"
#Header set Access-Control-Allow-Headers "origin, content-type, accept"
$([ "$protocol" == "https" ] && __vhost_ssl_statement | prefix " ")
$([ "$protocol" == "https" ] && __vhost_ssl_statement | prefix " ")
$(__vhost_custom_rules | prefix " ")
</VirtualHost>
</VirtualHost>
EOF
EOF
@ -509,3 +513,18 @@ $(__vhost_creds_statement | prefix " ")
EOF
EOF
}
}
apache_config_hash() {
debug "Adding config hash to enable recreating upon config change."
config_hash=$({
printf "%s\0" "$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
"
}