From f045416cb73982d6a8df4b014a46f3f724ab6341 Mon Sep 17 00:00:00 2001 From: Bitnami Bot Date: Tue, 19 Oct 2021 18:01:55 +0000 Subject: [PATCH] 8.9.19-debian-10-r32 release --- bitnami/drupal/8/debian-10/Dockerfile | 6 +- .../opt/bitnami/.bitnami_components.json | 4 +- .../prebuildfs/opt/bitnami/scripts/libnet.sh | 21 +++ .../opt/bitnami/scripts/libservice.sh | 7 +- .../opt/bitnami/scripts/libwebserver.sh | 43 ++++- .../app-generic-http-vhost.conf.tpl | 2 +- .../app-generic-https-vhost.conf.tpl | 2 +- .../bitnami-templates/app-http-vhost.conf.tpl | 2 +- .../app-https-vhost.conf.tpl | 2 +- .../app-proxy-http-vhost.conf.tpl | 2 +- .../app-proxy-https-vhost.conf.tpl | 2 +- .../app-ruby-passenger-http-vhost.conf.tpl | 4 +- .../app-ruby-passenger-https-vhost.conf.tpl | 4 +- .../rootfs/opt/bitnami/scripts/libapache.sh | 165 +++++++++++++----- bitnami/drupal/README.md | 2 +- 15 files changed, 195 insertions(+), 73 deletions(-) diff --git a/bitnami/drupal/8/debian-10/Dockerfile b/bitnami/drupal/8/debian-10/Dockerfile index 92c13008f6da..e44c910c500b 100644 --- a/bitnami/drupal/8/debian-10/Dockerfile +++ b/bitnami/drupal/8/debian-10/Dockerfile @@ -9,7 +9,7 @@ ENV HOME="/" \ COPY prebuildfs / # Install required system packages and dependencies RUN install_packages acl ca-certificates curl dirmngr gnupg gzip libaudit1 libbsd0 libbz2-1.0 libc6 libcap-ng0 libcom-err2 libcurl4 libexpat1 libffi6 libfftw3-double3 libfontconfig1 libfreetype6 libgcc1 libgcrypt20 libglib2.0-0 libgmp10 libgnutls30 libgomp1 libgpg-error0 libgssapi-krb5-2 libhogweed4 libicu63 libidn2-0 libjemalloc2 libjpeg62-turbo libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 liblcms2-2 libldap-2.4-2 liblqr-1-0 libltdl7 liblzma5 libmagickcore-6.q16-6 libmagickwand-6.q16-6 libmcrypt4 libmemcached11 libmemcachedutil2 libncurses6 libnettle6 libnghttp2-14 libonig5 libp11-kit0 libpam0g libpcre3 libpng16-16 libpq5 libpsl5 libreadline7 librtmp1 libsasl2-2 libsodium23 libsqlite3-0 libssh2-1 libssl1.1 libstdc++6 libsybdb5 libtasn1-6 libtidy5deb1 libtinfo6 libunistring2 libuuid1 libwebp6 libx11-6 libxau6 libxcb1 libxdmcp6 libxext6 libxml2 libxslt1.1 libzip4 procps tar unzip zlib1g -RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "php" "7.4.24-4" --checksum aea0d0d3db114c9eab576f591305b113fb6b2ceec23f5125d3dda3189bbd0f13 +RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "php" "7.4.24-5" --checksum e9c8baef629a858d404b0fe58725650c2f9c282da7735ee6477bd9633c00089c RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "apache" "2.4.51-0" --checksum 71010c86332e4ad0993bc875d103bb916184f1f42884a9098db65c969553c34a RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "mysql-client" "10.3.31-2" --checksum 15b394a022ca1d0b4b89bfee0487ee13f9e8cc697d0ca09ce62a0a3732536236 RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "libphp" "7.4.24-3" --checksum 534aa93850b658381e8ef85dd9cdb64c097eb7938d733640ac92f65263cb5dec @@ -19,8 +19,8 @@ RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "drupal" "8.9.19- RUN chmod g+rwX /opt/bitnami COPY rootfs / -RUN /opt/bitnami/scripts/php/postunpack.sh RUN /opt/bitnami/scripts/apache/postunpack.sh +RUN /opt/bitnami/scripts/php/postunpack.sh RUN /opt/bitnami/scripts/apache-modphp/postunpack.sh RUN /opt/bitnami/scripts/drupal/postunpack.sh RUN /opt/bitnami/scripts/mysql-client/postunpack.sh @@ -29,7 +29,7 @@ ENV ALLOW_EMPTY_PASSWORD="no" \ APACHE_HTTPS_PORT_NUMBER="" \ APACHE_HTTP_PORT_NUMBER="" \ BITNAMI_APP_NAME="drupal" \ - BITNAMI_IMAGE_VERSION="8.9.19-debian-10-r31" \ + BITNAMI_IMAGE_VERSION="8.9.19-debian-10-r32" \ MARIADB_HOST="mariadb" \ MARIADB_PORT_NUMBER="3306" \ MARIADB_ROOT_PASSWORD="" \ diff --git a/bitnami/drupal/8/debian-10/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/drupal/8/debian-10/prebuildfs/opt/bitnami/.bitnami_components.json index ebfd4261ab79..b1d1b2c082c8 100644 --- a/bitnami/drupal/8/debian-10/prebuildfs/opt/bitnami/.bitnami_components.json +++ b/bitnami/drupal/8/debian-10/prebuildfs/opt/bitnami/.bitnami_components.json @@ -36,10 +36,10 @@ }, "php": { "arch": "amd64", - "digest": "aea0d0d3db114c9eab576f591305b113fb6b2ceec23f5125d3dda3189bbd0f13", + "digest": "e9c8baef629a858d404b0fe58725650c2f9c282da7735ee6477bd9633c00089c", "distro": "debian-10", "type": "NAMI", - "version": "7.4.24-4" + "version": "7.4.24-5" }, "render-template": { "arch": "amd64", diff --git a/bitnami/drupal/8/debian-10/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/drupal/8/debian-10/prebuildfs/opt/bitnami/scripts/libnet.sh index 4391dacc7853..8bbf165e3e2a 100644 --- a/bitnami/drupal/8/debian-10/prebuildfs/opt/bitnami/scripts/libnet.sh +++ b/bitnami/drupal/8/debian-10/prebuildfs/opt/bitnami/scripts/libnet.sh @@ -140,3 +140,24 @@ parse_uri() { esac [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" } + +######################## +# Wait for a HTTP connection to succeed +# Globals: +# * +# Arguments: +# $1 - URL to wait for +# $2 - Maximum amount of retries (optional) +# $3 - Time between retries (optional) +# Returns: +# true if the HTTP connection succeeded, false otherwise +######################### +wait_for_http_connection() { + local url="${1:?missing url}" + local retries="${2:-}" + local sleep_time="${3:-}" + if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then + error "Could not connect to ${url}" + return 1 + fi +} diff --git a/bitnami/drupal/8/debian-10/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/drupal/8/debian-10/prebuildfs/opt/bitnami/scripts/libservice.sh index 0b96a0be09e0..a713bd108e15 100644 --- a/bitnami/drupal/8/debian-10/prebuildfs/opt/bitnami/scripts/libservice.sh +++ b/bitnami/drupal/8/debian-10/prebuildfs/opt/bitnami/scripts/libservice.sh @@ -158,7 +158,7 @@ remove_cron_conf() { # $3 - Start command # $4 - Stop command # Flags: -# --disabled - Whether to disable the monit configuration +# --disable - Whether to disable the monit configuration # Returns: # None ######################### @@ -174,9 +174,8 @@ generate_monit_conf() { shift 4 while [[ "$#" -gt 0 ]]; do case "$1" in - --disabled) - shift - disabled="$1" + --disable) + disabled="yes" ;; *) echo "Invalid command line flag ${1}" >&2 diff --git a/bitnami/drupal/8/debian-10/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/drupal/8/debian-10/prebuildfs/opt/bitnami/scripts/libwebserver.sh index dc322c377b1b..785d883f325e 100644 --- a/bitnami/drupal/8/debian-10/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ b/bitnami/drupal/8/debian-10/prebuildfs/opt/bitnami/scripts/libwebserver.sh @@ -164,11 +164,14 @@ web_server_reload() { # Arguments: # $1 - App name # Flags: -# --hosts - Hosts to enable # --type - Application type, which has an effect on which configuration template to use +# --hosts - Host listen addresses +# --server-name - Server name +# --server-aliases - Server aliases # --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disabled - Whether to render the file with a .disabled prefix -# --enable-https - Enable app configuration on HTTPS port +# --disable - Whether to render server configurations with a .disabled prefix +# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix +# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix # --http-port - HTTP port number # --https-port - HTTPS port number # --document-root - Path to document root directory @@ -198,11 +201,18 @@ ensure_web_server_app_configuration_exists() { while [[ "$#" -gt 0 ]]; do case "$1" in # Common flags + --disable \ + | --disable-http \ + | --disable-https \ + ) + apache_args+=("$1") + nginx_args+=("$1") + ;; --hosts \ + | --server-name \ + | --server-aliases \ | --type \ | --allow-remote-connections \ - | --disabled \ - | --enable-https \ | --http-port \ | --https-port \ | --document-root \ @@ -347,8 +357,13 @@ ensure_web_server_prefix_configuration_exists() { # Arguments: # $1 - App name # Flags: -# --hosts - Hosts to enable -# --enable-https - Update HTTPS app configuration +# --hosts - Host listen addresses +# --server-name - Server name +# --server-aliases - Server aliases +# --enable-http - Enable HTTP app configuration (if not enabled already) +# --enable-https - Enable HTTPS app configuration (if not enabled already) +# --disable-http - Disable HTTP app configuration (if not disabled already) +# --disable-https - Disable HTTPS app configuration (if not disabled already) # --http-port - HTTP port number # --https-port - HTTPS port number # Returns: @@ -363,8 +378,20 @@ web_server_update_app_configuration() { while [[ "$#" -gt 0 ]]; do case "$1" in # Common flags - --hosts \ + --enable-http \ | --enable-https \ + | --disable-http \ + | --disable-https \ + ) + args+=("$1") + ;; + --hosts \ + | --server-name \ + | --server-aliases \ + | --enable-http \ + | --enable-https \ + | --disable-http \ + | --disable-https \ | --http-port \ | --https-port \ ) diff --git a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-http-vhost.conf.tpl b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-http-vhost.conf.tpl index 2bf2ca2f414c..9c0eadc5b6ed 100644 --- a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-http-vhost.conf.tpl +++ b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-http-vhost.conf.tpl @@ -1,5 +1,5 @@ {{before_vhost_configuration}} - ServerAlias * + {{server_name_configuration}} {{additional_configuration}} diff --git a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-https-vhost.conf.tpl b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-https-vhost.conf.tpl index b7e33c754376..bf601e084738 100644 --- a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-https-vhost.conf.tpl +++ b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-https-vhost.conf.tpl @@ -1,6 +1,6 @@ {{before_vhost_configuration}} - ServerAlias * + {{server_name_configuration}} SSLEngine on SSLCertificateFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.crt" SSLCertificateKeyFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.key" diff --git a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-http-vhost.conf.tpl b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-http-vhost.conf.tpl index 97bc1927b542..ee67cd0d9c26 100644 --- a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-http-vhost.conf.tpl +++ b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-http-vhost.conf.tpl @@ -1,6 +1,6 @@ {{before_vhost_configuration}} - ServerAlias * + {{server_name_configuration}} DocumentRoot {{document_root}} Options -Indexes +FollowSymLinks -MultiViews diff --git a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-https-vhost.conf.tpl b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-https-vhost.conf.tpl index c6debd7f56d4..eb1e0e3d6485 100644 --- a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-https-vhost.conf.tpl +++ b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-https-vhost.conf.tpl @@ -1,6 +1,6 @@ {{before_vhost_configuration}} - ServerAlias * + {{server_name_configuration}} SSLEngine on SSLCertificateFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.crt" SSLCertificateKeyFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.key" diff --git a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-http-vhost.conf.tpl b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-http-vhost.conf.tpl index 23ba583683d2..939b06c897f4 100644 --- a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-http-vhost.conf.tpl +++ b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-http-vhost.conf.tpl @@ -1,6 +1,6 @@ {{before_vhost_configuration}} - ServerAlias * + {{server_name_configuration}} {{proxy_configuration}} {{proxy_http_configuration}} ProxyPass / {{proxy_address}} diff --git a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-https-vhost.conf.tpl b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-https-vhost.conf.tpl index cb18f5cf77e8..9b555e8acf8b 100644 --- a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-https-vhost.conf.tpl +++ b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-https-vhost.conf.tpl @@ -1,6 +1,6 @@ {{before_vhost_configuration}} - ServerAlias * + {{server_name_configuration}} SSLEngine on SSLCertificateFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.crt" SSLCertificateKeyFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.key" diff --git a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-http-vhost.conf.tpl b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-http-vhost.conf.tpl index e8a3788d8a62..51be5b20f59b 100644 --- a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-http-vhost.conf.tpl +++ b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-http-vhost.conf.tpl @@ -1,7 +1,7 @@ {{before_vhost_configuration}} -PassengerPreStart http://localhost:{{APACHE_DEFAULT_HTTP_PORT_NUMBER}}/ +PassengerPreStart http://localhost:{{http_port}}/ - ServerAlias * + {{server_name_configuration}} DocumentRoot {{document_root}} Options -Indexes +FollowSymLinks -MultiViews diff --git a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-https-vhost.conf.tpl b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-https-vhost.conf.tpl index 289a3b0959cd..965290090fb2 100644 --- a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-https-vhost.conf.tpl +++ b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-https-vhost.conf.tpl @@ -1,7 +1,7 @@ {{before_vhost_configuration}} -PassengerPreStart https://localhost:{{APACHE_DEFAULT_HTTPS_PORT_NUMBER}}/ +PassengerPreStart https://localhost:{{https_port}}/ - ServerAlias * + {{server_name_configuration}} SSLEngine on SSLCertificateFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.crt" SSLCertificateKeyFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.key" diff --git a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/libapache.sh b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/libapache.sh index 880c011f22df..a5bc9708b60c 100644 --- a/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/libapache.sh +++ b/bitnami/drupal/8/debian-10/rootfs/opt/bitnami/scripts/libapache.sh @@ -317,11 +317,14 @@ EOF # Arguments: # $1 - App name # Flags: -# --hosts - Hosts to enable # --type - Application type, which has an effect on what configuration template will be used, allowed values: php, (empty) +# --hosts - Host listen addresses +# --server-name - Server name +# --server-aliases - Server aliases (defaults to '*') # --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disabled - Whether to render the file with a .disabled prefix -# --enable-https - Enable app configuration on HTTPS port +# --disable - Whether to render the app's virtual hosts with a .disabled prefix +# --disable-http - Whether to render the app's HTTP virtual host with a .disabled prefix +# --disable-https - Whether to render the app's HTTPS virtual host with a .disabled prefix # --http-port - HTTP port number # --https-port - HTTPS port number # --move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup @@ -340,37 +343,48 @@ EOF ensure_apache_app_configuration_exists() { local -r app="${1:?missing app}" # Default options - local -a hosts=("127.0.0.1" "_default_") local type="" + local -a hosts=("127.0.0.1" "_default_") + local server_name + local -a server_aliases=("*") local allow_remote_connections="yes" - local disabled="no" - local enable_https="yes" - local http_port="${APACHE_HTTP_PORT_NUMBER:-"$APACHE_DEFAULT_HTTP_PORT_NUMBER"}" - local https_port="${APACHE_HTTPS_PORT_NUMBER:-"$APACHE_DEFAULT_HTTPS_PORT_NUMBER"}" + local disable="no" + local disable_http="no" + local disable_https="no" local move_htaccess="yes" - local var_name # Template variables defaults export additional_configuration="" export before_vhost_configuration="" export allow_override="All" export document_root="${BITNAMI_ROOT_DIR}/${app}" export extra_directory_configuration="" + export http_port="${APACHE_HTTP_PORT_NUMBER:-"$APACHE_DEFAULT_HTTP_PORT_NUMBER"}" + export https_port="${APACHE_HTTPS_PORT_NUMBER:-"$APACHE_DEFAULT_HTTPS_PORT_NUMBER"}" export proxy_address="" export proxy_configuration="" export proxy_http_configuration="" export proxy_https_configuration="" # Validate arguments + local var_name shift while [[ "$#" -gt 0 ]]; do case "$1" in - --hosts) + --hosts \ + | --server-aliases) + var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" shift - read -r -a hosts <<< "$1" + read -r -a "$var_name" <<< "$1" + ;; + --disable \ + | --disable-http \ + | --disable-https \ + ) + var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" + export "${var_name}=yes" ;; --type \ + | --server-name \ | --allow-remote-connections \ - | --disabled \ - | --enable-https \ | --http-port \ | --https-port \ | --move-htaccess \ @@ -386,7 +400,7 @@ ensure_apache_app_configuration_exists() { ) var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" shift - export "${var_name}"="$1" + export "${var_name}=${1}" ;; *) echo "Invalid command line flag $1" >&2 @@ -404,6 +418,14 @@ ensure_apache_app_configuration_exists() { [[ -z "${http_listen_addresses:-}" ]] && http_listen_addresses="$http_listen" || http_listen_addresses="${http_listen_addresses} ${http_listen}" [[ -z "${https_listen_addresses:-}" ]] && https_listen_addresses="$https_listen" || https_listen_addresses="${https_listen_addresses} ${https_listen}" done + # Construct ServerName/ServerAlias block + export server_name_configuration="" + if ! is_empty_value "${server_name:-}"; then + server_name_configuration="ServerName ${server_name}" + fi + if [[ "${#server_aliases[@]}" -gt 0 ]]; then + server_name_configuration+=$'\n'"ServerAlias ${server_aliases[*]}" + fi # App .htaccess support export htaccess_include is_boolean_yes "$move_htaccess" && apache_replace_htaccess_files "$app" --document-root "$document_root" @@ -430,6 +452,7 @@ EOF )" fi # Indent configurations + server_name_configuration="$(indent $'\n'"$server_name_configuration" 2)" additional_configuration="$(indent $'\n'"$additional_configuration" 2)" htaccess_include="$(indent $'\n'"$htaccess_include" 2)" extra_directory_configuration="$(indent $'\n'"$extra_directory_configuration" 4)" @@ -441,10 +464,11 @@ EOF local template_name="app" [[ -n "$type" && "$type" != "php" ]] && template_name="app-${type}" local -r template_dir="${BITNAMI_ROOT_DIR}/scripts/apache/bitnami-templates" - local vhost_suffix="" - is_boolean_yes "$disabled" && vhost_suffix=".disabled" - local -r http_vhost="${APACHE_VHOSTS_DIR}/${app}-vhost.conf${vhost_suffix}" - local -r https_vhost="${APACHE_VHOSTS_DIR}/${app}-https-vhost.conf${vhost_suffix}" + local http_vhost="${APACHE_VHOSTS_DIR}/${app}-vhost.conf" + local https_vhost="${APACHE_VHOSTS_DIR}/${app}-https-vhost.conf" + local -r disable_suffix=".disabled" + ( is_boolean_yes "$disable" || is_boolean_yes "$disable_http" ) && http_vhost+="$disable_suffix" + ( is_boolean_yes "$disable" || is_boolean_yes "$disable_https" ) && https_vhost+="$disable_suffix" if is_file_writable "$http_vhost"; then # Create file with root group write privileges, so it can be modified in non-root containers [[ ! -f "$http_vhost" ]] && touch "$http_vhost" && chmod g+rw "$http_vhost" @@ -455,17 +479,15 @@ EOF else warn "The ${app} virtual host file '${http_vhost}' is not writable. Configurations based on environment variables will not be applied for this file." fi - if is_boolean_yes "$enable_https"; then - if is_file_writable "$https_vhost"; then - # Create file with root group write privileges, so it can be modified in non-root containers - [[ ! -f "$https_vhost" ]] && touch "$https_vhost" && chmod g+rw "$https_vhost" - render-template "${template_dir}/${template_name}-https-vhost.conf.tpl" | sed '/^\s*$/d' > "$https_vhost" - elif [[ ! -f "$https_vhost" ]]; then - error "Could not create virtual host for ${app} at '${https_vhost}'. Check permissions and ownership for parent directories." - return 1 - else - warn "The ${app} virtual host file '${https_vhost}' is not writable. Configurations based on environment variables will not be applied for this file." - fi + if is_file_writable "$https_vhost"; then + # Create file with root group write privileges, so it can be modified in non-root containers + [[ ! -f "$https_vhost" ]] && touch "$https_vhost" && chmod g+rw "$https_vhost" + render-template "${template_dir}/${template_name}-https-vhost.conf.tpl" | sed '/^\s*$/d' > "$https_vhost" + elif [[ ! -f "$https_vhost" ]]; then + error "Could not create virtual host for ${app} at '${https_vhost}'. Check permissions and ownership for parent directories." + return 1 + else + warn "The ${app} virtual host file '${https_vhost}' is not writable. Configurations based on environment variables will not be applied for this file." fi } @@ -482,9 +504,10 @@ ensure_apache_app_configuration_not_exists() { local -r app="${1:?missing app}" local -r http_vhost="${APACHE_VHOSTS_DIR}/${app}-vhost.conf" local -r https_vhost="${APACHE_VHOSTS_DIR}/${app}-https-vhost.conf" + local -r disable_suffix=".disabled" # Note that 'rm -f' will not fail if the files don't exist # However if we lack permissions to remove the file, it will result in a non-zero exit code, as expected by this function - rm -f "$http_vhost" "$https_vhost" + rm -f "$http_vhost" "$https_vhost" "${http_vhost}${disable_suffix}" "${https_vhost}${disable_suffix}" } ######################## @@ -512,13 +535,13 @@ ensure_apache_prefix_configuration_exists() { local allow_remote_connections="yes" local move_htaccess="yes" local prefix="/${app}" - local var_name # Template variables defaults export additional_configuration="" export allow_override="All" export document_root="${BITNAMI_ROOT_DIR}/${app}" export extra_directory_configuration="" # Validate arguments + local var_name shift while [[ "$#" -gt 0 ]]; do case "$1" in @@ -533,7 +556,7 @@ ensure_apache_prefix_configuration_exists() { ) var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" shift - declare "${var_name}"="$1" + declare "${var_name}=${1}" ;; *) echo "Invalid command line flag $1" >&2 @@ -598,8 +621,13 @@ EOF # Arguments: # $1 - App name # Flags: -# --hosts - Hosts to enable -# --enable-https - Update HTTPS app configuration +# --hosts - Host listen addresses +# --server-name - Server name +# --server-aliases - Server aliases +# --enable-http - Enable HTTP app configuration (if not enabled already) +# --enable-https - Enable HTTPS app configuration (if not enabled already) +# --disable-http - Disable HTTP app configuration (if not disabled already) +# --disable-https - Disable HTTPS app configuration (if not disabled already) # --http-port - HTTP port number # --https-port - HTTPS port number # Returns: @@ -609,25 +637,38 @@ apache_update_app_configuration() { local -r app="${1:?missing app}" # Default options local -a hosts=("127.0.0.1" "_default_") - local enable_https="yes" + local server_name + local -a server_aliases=() + local enable_http="no" + local enable_https="no" + local disable_http="no" + local disable_https="no" local http_port="${APACHE_HTTP_PORT_NUMBER:-"$APACHE_DEFAULT_HTTP_PORT_NUMBER"}" local https_port="${APACHE_HTTPS_PORT_NUMBER:-"$APACHE_DEFAULT_HTTPS_PORT_NUMBER"}" + local var_name # Validate arguments + local var_name shift while [[ "$#" -gt 0 ]]; do case "$1" in - --hosts) + --hosts \ + | --server-aliases) + var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" shift - read -r -a hosts <<< "$1" + read -r -a "$var_name" <<< "$1" ;; - # Common flags - --enable-https \ + --server-name \ + | --enable-http \ + | --enable-https \ + | --disable-http \ + | --disable-https \ | --http-port \ | --https-port \ ) - args+=("$1" "$2") + var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" shift + declare "${var_name}=${1}" ;; *) @@ -649,13 +690,47 @@ apache_update_app_configuration() { # Update configuration local -r http_vhost="${APACHE_VHOSTS_DIR}/${app}-vhost.conf" local -r https_vhost="${APACHE_VHOSTS_DIR}/${app}-https-vhost.conf" - if is_file_writable "$http_vhost"; then - replace_in_file "$http_vhost" "^$" "" - else - warn "The ${app} virtual host file '${http_vhost}' is not writable. Configurations based on environment variables will not be applied for this file." + local -r disable_suffix=".disabled" + # Helper function to avoid duplicating code + update_common_vhost_config() { + local -r vhost_file="${1:?missing virtual host}" + # Update ServerName + if ! is_empty_value "${server_name:-}"; then + replace_in_file "$vhost_file" "^(\s*ServerName\s+).*" "\1${server_name}" + fi + # Update ServerAlias + if [[ "${#server_aliases[@]}" -gt 0 ]]; then + replace_in_file "$vhost_file" "^(\s*ServerAlias\s+).*" "\1${server_aliases[*]}" + fi + } + # Disable and enable configuration files + rename_conf_file() { + local -r origin="$1" + local -r destination="$2" + if is_file_writable "$origin" && is_file_writable "$destination"; then + warn "Could not rename virtual host file '${origin}' to '${destination}' due to lack of permissions." + else + mv "$origin" "$destination" + fi + } + is_boolean_yes "$disable_http" && [[ -e "$http_vhost" ]] && rename_conf_file "${http_vhost}${disable_suffix}" "$http_vhost" + is_boolean_yes "$disable_https" && [[ -e "$https_vhost" ]] && rename_conf_file "${https_vhost}${disable_suffix}" "$https_vhost" + is_boolean_yes "$enable_http" && [[ -e "${http_vhost}${disable_suffix}" ]] && rename_conf_file "${http_vhost}${disable_suffix}" "$http_vhost" + is_boolean_yes "$enable_https" && [[ -e "${https_vhost}${disable_suffix}" ]] && rename_conf_file "${https_vhost}${disable_suffix}" "$https_vhost" + # Update only configuration files without the '.disabled' suffix + if [[ -e "$http_vhost" ]]; then + if is_file_writable "$http_vhost"; then + update_common_vhost_config "$http_vhost" + # Update vhost-specific config (listen addresses) + replace_in_file "$http_vhost" "^$" "" + else + warn "The ${app} virtual host file '${http_vhost}' is not writable. Configurations based on environment variables will not be applied for this file." + fi fi - if is_boolean_yes "$enable_https"; then + if [[ -e "$https_vhost" ]]; then if is_file_writable "$https_vhost"; then + update_common_vhost_config "$https_vhost" + # Update vhost-specific config (listen addresses) replace_in_file "$https_vhost" "^$" "" else warn "The ${app} virtual host file '${https_vhost}' is not writable. Configurations based on environment variables will not be applied for this file." diff --git a/bitnami/drupal/README.md b/bitnami/drupal/README.md index 23060f96d6a0..8d69deff0d66 100644 --- a/bitnami/drupal/README.md +++ b/bitnami/drupal/README.md @@ -42,7 +42,7 @@ Learn more about the Bitnami tagging policy and the difference between rolling t * [`9`, `9-debian-10`, `9.2.7`, `9.2.7-debian-10-r11`, `latest` (9/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-drupal/blob/9.2.7-debian-10-r11/9/debian-10/Dockerfile) -* [`8`, `8-debian-10`, `8.9.19`, `8.9.19-debian-10-r31` (8/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-drupal/blob/8.9.19-debian-10-r31/8/debian-10/Dockerfile) +* [`8`, `8-debian-10`, `8.9.19`, `8.9.19-debian-10-r32` (8/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-drupal/blob/8.9.19-debian-10-r32/8/debian-10/Dockerfile) Subscribe to project updates by watching the [bitnami/drupal GitHub repo](https://github.com/bitnami/bitnami-docker-drupal).