Browse Source

new: dev: [apache] use only ``init-config-add``.

framadate
Valentin Lab 6 years ago
parent
commit
b17b4db0c7
  1. 30
      apache/lib/common
  2. 16
      apache/test/vhost_cert_provider
  3. 26
      apache/test/vhost_files

30
apache/lib/common

@ -328,8 +328,7 @@ ssl_fallback_prepare() {
done
if [ "$volumes" ]; then
config-add "\
services:
init-config-add "\
$MASTER_TARGET_SERVICE_NAME:
volumes:
$volumes
@ -365,9 +364,8 @@ ssl_plugin_cert-provider_prepare() {
err "Failed to launch letsencrypt for certificate creation."
return 1
}
config-add "\
services:
$MASTER_TARGET_SERVICE_NAME:
init-config-add "\
$SERVICE_NAME:
volumes:
- $DATASTORE/$service/etc/letsencrypt:/etc/letsencrypt:ro
" || return 1
@ -437,8 +435,8 @@ apache_code_dir() {
setfacl -R -m g:"$www_data_gid":rx "$host_path"
info "Set permission for read and traversal on '$host_path'."
config-add "
$MASTER_BASE_SERVICE_NAME:
init-config-add "
$SERVICE_NAME:
volumes:
- $host_path:$local_path
"
@ -475,8 +473,8 @@ apache_data_dirs() {
setfacl -R -m g:"$www_data_gid":rwx "${dirs[@]}"
setfacl -R -d -m g:"$www_data_gid":rwx "${dirs[@]}"
config-add "
$MASTER_BASE_SERVICE_NAME:
init-config-add "
$SERVICE_NAME:
volumes:
$(
for d in "${data[@]}"; do
@ -502,14 +500,14 @@ export -f deploy_files
apache_core_rules_add() {
local conf="$1" dst="/etc/apache2/conf-enabled/$BASE_SERVICE_NAME.conf"
local conf="$1" dst="/etc/apache2/conf-enabled/$SERVICE_NAME.conf"
debug "Adding core rule."
echo "$conf" | file_put "$CONFIGSTORE/$BASE_SERVICE_NAME$dst"
echo "$conf" | file_put "$CONFIGSTORE/$SERVICE_NAME$dst"
config_hash=$(printf "%s\0" "$config_hash" "$conf" | md5_compat)
config-add "
$MASTER_BASE_SERVICE_NAME:
init-config-add "
$SERVICE_NAME:
volumes:
- $CONFIGSTORE/$BASE_SERVICE_NAME$dst:$dst:ro
- $CONFIGSTORE/$SERVICE_NAME$dst:$dst:ro
"
}
@ -851,8 +849,10 @@ apache_config_hash() {
-name \*.conf -exec md5sum {} \;
} | md5_compat) || exit 1
init-config-add "
$MASTER_BASE_SERVICE_NAME:
$SERVICE_NAME:
labels:
- compose.config_hash=$config_hash
"
}

16
apache/test/vhost_cert_provider

@ -104,6 +104,12 @@ config-add() {
}
export -f config-add
init-config-add() {
echo "config-add"
echo "$1" | prefix " | "
}
export -f init-config-add
mkdir() {
echo "called: $FUNCNAME $@" >&2
}
@ -165,6 +171,7 @@ try "
export SERVICE_CONFIGSTORE='\$SERVICE_CONFIGSTORE'
export CONFIGSTORE='\$CONFIGSTORE'
export DATASTORE='\$DATASTORE'
export SERVICE_NAME='\$SERVICE_NAME'
export BASE_SERVICE_NAME='\$BASE_SERVICE_NAME'
export MASTER_TARGET_SERVICE_NAME='\$MASTER_TARGET_SERVICE_NAME'
CFG='
@ -198,8 +205,7 @@ relation-set apache-custom-rules:
|"
is out reg 'Calling: compose .*foo: options: <merge_yaml_str\(.a., .12., )>.*run --rm --service-ports foo.*'
is out part 'config-add
| services:
| $MASTER_TARGET_SERVICE_NAME:
| $SERVICE_NAME:
| volumes:
| - $DATASTORE/foo/etc/letsencrypt:/etc/letsencrypt:ro'
is out part '
@ -251,8 +257,7 @@ relation-set apache-custom-rules:
is out reg 'Calling: compose .*foo: options: <merge_yaml_str\(.a., .12., )>.*run --rm --service-ports foo crt create www.example.com\s*
' RTRIM
is out part 'config-add
| services:
| $MASTER_TARGET_SERVICE_NAME:
| $SERVICE_NAME:
| volumes:
| - $DATASTORE/foo/etc/letsencrypt:/etc/letsencrypt:ro'
is out part 'file_put $SERVICE_CONFIGSTORE/etc/apache2/sites-enabled/www.example.com.conf
@ -313,8 +318,7 @@ relation-set apache-custom-rules:
is out reg 'Calling: compose .*foo: options: <merge_yaml_str\(.a., .12., )>.*run --rm --service-ports foo crt create www.example.com example.fr example.de\s+
'
is out part 'config-add
| services:
| $MASTER_TARGET_SERVICE_NAME:
| $SERVICE_NAME:
| volumes:
| - $DATASTORE/foo/etc/letsencrypt:/etc/letsencrypt:ro'
is out part 'file_put $SERVICE_CONFIGSTORE/etc/apache2/sites-enabled/www.example.com.conf

26
apache/test/vhost_files

@ -60,6 +60,12 @@ config-add() {
}
export -f config-add
init-config-add() {
echo "init-config-add"
echo "$1" | prefix " | "
}
export -f init-config-add
mkdir() {
echo "called: $FUNCNAME $@" >&2
}
@ -208,7 +214,7 @@ is out part 'file_put $CONFIGSTORE/$BASE_SERVICE_NAME/etc/ssl/certs/www.example.
is out part 'file_put $CONFIGSTORE/$BASE_SERVICE_NAME/etc/ssl/private/www.example.com.key
| a
| b'
is out reg 'config-add'
is out reg 'init-config-add'
is out reg ' - \$CONFIGSTORE/\$BASE_SERVICE_NAME/etc/ssl/certs/www.example.com.pem:/etc/ssl/certs/www.example.com.pem:ro'
is out reg ' - \$CONFIGSTORE/\$BASE_SERVICE_NAME/etc/ssl/private/www.example.com.key:/etc/ssl/private/www.example.com.key:ro'
@ -233,6 +239,16 @@ relation-set protocol:
is out reg "htpasswd -bc '/etc/apache2/sites-enabled/www.example.com.passwd' 'toto' 'xxx'"
is out reg 'docker run -i --entrypoint /bin/bash .* docker/apache'
try "
export SERVICE_CONFIGSTORE='\$SERVICE_CONFIGSTORE'
apache_vhost_create publish_dir '' ',http,' '000-default'"
is errlvl 0
is err part "\
relation-set protocol:
| http"
is out reg '^file_put \$SERVICE_CONFIGSTORE/.*/000-default.conf'
##
## apache_publish_dir
@ -296,6 +312,7 @@ export DATASTORE='\$DATASTORE'
export DOCKER_BASE_IMAGE=docker/apache
export SERVICE_CONFIGSTORE='\$SERVICE_CONFIGSTORE'
export CONFIGSTORE='\$CONFIGSTORE'
export SERVICE_NAME='\$SERVICE_NAME'
export BASE_SERVICE_NAME='\$BASE_SERVICE_NAME'
export MASTER_BASE_SERVICE_NAME='\$MASTER_BASE_SERVICE_NAME'
export MASTER_TARGET_SERVICE_NAME='\$MASTER_TARGET_SERVICE_NAME'
@ -313,9 +330,12 @@ data-dirs:
is errlvl 0
is err reg 'mkdir -p /opt/apps/newlocation'
is err reg 'setfacl -R -m g:<GID>:rx /opt/apps/newlocation'
is out part ' | $MASTER_BASE_SERVICE_NAME:
is out part '
init-config-add
|
| $SERVICE_NAME:
| volumes:
| - /opt/apps/newlocation:/var/www/www.example.com'
| - /opt/apps/newlocation:/var/www/www.example.com' RTRIM

Loading…
Cancel
Save