Browse Source

new: dev: [apache] store a ``url`` argument instead of a ``protocol`` argument.

framadate
Valentin Lab 5 years ago
parent
commit
a444d16bd6
  1. 16
      apache/lib/common
  2. 34
      apache/test/vhost_files
  3. 7
      docker-registry-auth/hooks/web_proxy-relation-joined
  4. 8
      docker-registry/hooks/web_proxy-relation-joined
  5. 8
      drone/hooks/web_proxy-relation-joined
  6. 5
      gitea/hooks/web_proxy-relation-joined

16
apache/lib/common

@ -78,6 +78,10 @@ apache_vhost_create() {
}
if is_protocol_enabled https "$protocols"; then
[ "$RELATION_DATA_FILE" ] && {
relation-set url "https://$domain"
}
if [ -z "$domain" ]; then
err "You must specify a domain for ssl to work."
return 1
@ -109,17 +113,11 @@ $(if [ "$custom_rules" ]; then
echo "- |"$'\n'"$(echo "$custom_rules" | prefix " ")"
fi)")") || return 1
fi
[ "$RELATION_DATA_FILE" ] && \
relation-set protocol https
else
## Both services are available and different, don't do anything then ?
#[ "$RELATION_DATA_FILE" ] && \
# relation-set protocol https
:
fi
else
[ "$RELATION_DATA_FILE" ] && \
relation-set protocol http
[ "$RELATION_DATA_FILE" ] && {
relation-set url "http://$domain"
}
fi
vhost_statement=$(apache_vhost_statement "$type" "$protocols" "$cfg" "$domain") || {
err "Failed to get vhost statement for type $type on ${protocols:1:-1}"

34
apache/test/vhost_files

@ -145,8 +145,8 @@ domain: www.example.com
'"
is errlvl 0
is err part "\
relation-set protocol:
| http"
relation-set url:
| http://www.example.com"
is out reg '^file_put \$SERVICE_CONFIGSTORE/.*/www.example.com.conf'
try "
@ -172,8 +172,8 @@ apache_vhost_create publish_dir \"\$CFG\"
is errlvl 0
is err part "## Auto-redirection from http to https"
is err part "\
relation-set protocol:
| https"
relation-set url:
| https://www.example.com"
is out reg '^file_put \$SERVICE_CONFIGSTORE/.*/www.example.com.conf'
@ -207,8 +207,8 @@ apache_vhost_create publish_dir \"\$CFG\"
is errlvl 0
is err part "## Auto-redirection from http to https"
is err part "\
relation-set protocol:
| https"
relation-set url:
| https://www.example.com"
is out part 'file_put $CONFIGSTORE/$BASE_SERVICE_NAME/etc/ssl/certs/www.example.com.pem
| c'
is out part 'file_put $CONFIGSTORE/$BASE_SERVICE_NAME/etc/ssl/private/www.example.com.key
@ -234,19 +234,21 @@ apache_vhost_create publish_dir \"\$CFG\"
"
is errlvl 0
is err part "\
relation-set protocol:
| http"
relation-set url:
| http://www.example.com"
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'
## XXXvlab: we don't need this feature anymore it seems
# try "
# export SERVICE_CONFIGSTORE='\$SERVICE_CONFIGSTORE'
# apache_vhost_create publish_dir '' ',http,' '000-default'"
# is errlvl 0
# is err part "\
# relation-set url:
# | http://" ## XXXvlab: this isn't right, is it ?
# is out reg '^file_put \$SERVICE_CONFIGSTORE/.*/000-default.conf'

7
docker-registry-auth/hooks/web_proxy-relation-joined

@ -4,9 +4,6 @@ set -e
. lib/common
DOMAIN=$(relation-get domain) || exit 1
PROTO=$(relation-get protocol) || true
PROTO=${PROTO:-https}
URL=$(relation-get url) || return 1
echo "$PROTO://$DOMAIN" > $SERVICE_CONFIGSTORE/etc/docker-auth/realm
echo "$URL" > $SERVICE_CONFIGSTORE/etc/docker-auth/realm

8
docker-registry/hooks/web_proxy-relation-joined

@ -5,18 +5,18 @@ set -e
. lib/common
DOMAIN=$(relation-get domain) || exit 1
PROTO=$(relation-get protocol) || true
PROTO=${PROTO:-https}
## These are mainly to setup the correct web-hook
if [ "$MASTER_BASE_SERVICE_NAME" == "$DOMAIN" ]; then
## This is because the IP will be the docker container version
PROTO=http
URL="http://$DOMAIN"
else
URL="$(relation-get url)" || exit 1
fi
ini_merge <<EOF
http:
host: $PROTO://$DOMAIN
host: $URL
EOF

8
drone/hooks/web_proxy-relation-joined

@ -5,14 +5,14 @@ set -e
. lib/common
DOMAIN=$(relation-get domain) || exit 1
PROTO=$(relation-get protocol) || true
PROTO=${PROTO:-https}
## These are mainly to setup the correct web-hook
if [ "$MASTER_BASE_SERVICE_NAME" == "$DOMAIN" ]; then
## This is because the IP will be the docker container version
PROTO=http
PROTO="http"
else
URL="$(relation-get url)" || exit 1
PROTO="${URL%%://*}"
fi
config-add "\

5
gitea/hooks/web_proxy-relation-joined

@ -5,8 +5,7 @@ set -e
. lib/common
DOMAIN=$(relation-get domain) || exit 1
PROTO=$(relation-get protocol) || true
PROTO=${PROTO:-https}
URL=$(relation-get url) || exit 1
ini set server ROOT_URL "$PROTO://$DOMAIN/"
ini set server ROOT_URL "$URL/"
ini set server SSH_DOMAIN "$DOMAIN"
Loading…
Cancel
Save