diff --git a/docker/aodh/aodh-api/extend_start.sh b/docker/aodh/aodh-api/extend_start.sh index 708b12ed32..07d4ce760c 100644 --- a/docker/aodh/aodh-api/extend_start.sh +++ b/docker/aodh/aodh-api/extend_start.sh @@ -1,19 +1,10 @@ #!/bin/bash -# NOTE(pbourke): httpd will not clean up after itself in some cases which -# results in the container not being able to restart. (bug #1489676, 1557036) -if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* -else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* -fi - # Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases # of the KOLLA_BOOTSTRAP variable being set, including empty. if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then aodh-dbsync exit 0 fi + +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/barbican/barbican-api/extend_start.sh b/docker/barbican/barbican-api/extend_start.sh index 920b508041..317f7d7d65 100755 --- a/docker/barbican/barbican-api/extend_start.sh +++ b/docker/barbican/barbican-api/extend_start.sh @@ -7,16 +7,4 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then exit 0 fi -# Assume the service runs on top of Apache when user is root -if [[ "$(whoami)" == 'root' ]]; then - # NOTE(pbourke): httpd will not clean up after itself in some cases which - # results in the container not being able to restart. (bug #1489676, 1557036) - if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* - else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* - fi -fi +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2 index e75e441794..a1e0006817 100644 --- a/docker/base/Dockerfile.j2 +++ b/docker/base/Dockerfile.j2 @@ -441,9 +441,9 @@ COPY set_configs.py /usr/local/bin/kolla_set_configs {% if distro_python_version.startswith('3') %} RUN sed -i -e "s+#\!/usr/bin/env python+#\!/usr/bin/env python3+g" /usr/local/bin/kolla_set_configs {% endif %} - COPY start.sh /usr/local/bin/kolla_start COPY copy_cacerts.sh /usr/local/bin/kolla_copy_cacerts +COPY httpd_setup.sh /usr/local/bin/kolla_httpd_setup COPY sudoers /etc/sudoers COPY curlrc /root/.curlrc @@ -470,7 +470,7 @@ RUN chmod 755 /usr/local/bin/healthcheck_* {% endif %} RUN touch /usr/local/bin/kolla_extend_start \ - && chmod 755 /usr/local/bin/kolla_start /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_set_configs /usr/local/bin/kolla_copy_cacerts \ + && chmod 755 /usr/local/bin/kolla_start /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_set_configs /usr/local/bin/kolla_copy_cacerts /usr/local/bin/kolla_httpd_setup \ && chmod 440 /etc/sudoers \ && mkdir -p /var/log/kolla \ && chown :kolla /var/log/kolla \ diff --git a/docker/base/httpd_setup.sh b/docker/base/httpd_setup.sh new file mode 100644 index 0000000000..990062e6d8 --- /dev/null +++ b/docker/base/httpd_setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# This script performs setup necessary to run the Apache httpd web server. +# It should be sourced rather than executed as environment variables are set. + +# Assume the service runs on top of Apache httpd when user is root. +if [[ "$(whoami)" == 'root' ]]; then + # NOTE(pbourke): httpd will not clean up after itself in some cases which + # results in the container not being able to restart. (bug #1489676, 1557036) + if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then + # Loading Apache2 ENV variables + . /etc/apache2/envvars + install -d /var/run/apache2/ + rm -rf /var/run/apache2/* + else + rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* + fi +fi diff --git a/docker/cinder/cinder-api/extend_start.sh b/docker/cinder/cinder-api/extend_start.sh index 251b9d1059..cc0fd43f29 100644 --- a/docker/cinder/cinder-api/extend_start.sh +++ b/docker/cinder/cinder-api/extend_start.sh @@ -17,16 +17,4 @@ if [[ "${!KOLLA_OSM[@]}" ]]; then exit 0 fi -# Assume the service runs on top of Apache when user is root -if [[ "$(whoami)" == 'root' ]]; then - # NOTE(pbourke): httpd will not clean up after itself in some cases which - # results in the container not being able to restart. (bug #1489676, 1557036) - if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* - else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* - fi -fi +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/cloudkitty/cloudkitty-api/extend_start.sh b/docker/cloudkitty/cloudkitty-api/extend_start.sh index e1f41b5587..2b144fa3ff 100644 --- a/docker/cloudkitty/cloudkitty-api/extend_start.sh +++ b/docker/cloudkitty/cloudkitty-api/extend_start.sh @@ -1,16 +1,5 @@ #!/bin/bash -# NOTE(pbourke): httpd will not clean up after itself in some cases which -# results in the container not being able to restart. (bug #1489676, 1557036) -if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* -else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* -fi - # Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases # of the KOLLA_BOOTSTRAP variable being set, including empty. if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then @@ -18,3 +7,5 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then cloudkitty-storage-init exit 0 fi + +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/gnocchi/gnocchi-api/extend_start.sh b/docker/gnocchi/gnocchi-api/extend_start.sh index 5059551d2e..84f33e103f 100644 --- a/docker/gnocchi/gnocchi-api/extend_start.sh +++ b/docker/gnocchi/gnocchi-api/extend_start.sh @@ -1,19 +1,10 @@ #!/bin/bash -# NOTE(pbourke): httpd will not clean up after itself in some cases which -# results in the container not being able to restart. (bug #1489676, 1557036) -if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* -else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* -fi - # Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases # of the KOLLA_BOOTSTRAP variable being set, including empty. if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then sudo -H -u gnocchi gnocchi-upgrade --log-file /var/log/kolla/gnocchi/gnocchi-upgrade.log exit 0 fi + +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/heat/heat-api/extend_start.sh b/docker/heat/heat-api/extend_start.sh index be87c09235..8106cc51a6 100644 --- a/docker/heat/heat-api/extend_start.sh +++ b/docker/heat/heat-api/extend_start.sh @@ -13,3 +13,5 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then fi exit 0 fi + +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/heat/heat-base/extend_start.sh b/docker/heat/heat-base/extend_start.sh index 5af0ef36d4..a73f17345f 100644 --- a/docker/heat/heat-base/extend_start.sh +++ b/docker/heat/heat-base/extend_start.sh @@ -7,18 +7,4 @@ if [[ $(stat -c %a /var/log/kolla/heat) != "755" ]]; then chmod 755 /var/log/kolla/heat fi -# Assume the service runs on top of Apache when user is root -if [[ "$(whoami)" == 'root' ]]; then - # NOTE(pbourke): httpd will not clean up after itself in some cases which - # results in the container not being able to restart. (bug #1489676, 1557036) - if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* - else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* - fi -fi - . /usr/local/bin/kolla_heat_extend_start diff --git a/docker/horizon/extend_start.sh b/docker/horizon/extend_start.sh index a2bc79e134..a03ad58726 100644 --- a/docker/horizon/extend_start.sh +++ b/docker/horizon/extend_start.sh @@ -355,21 +355,6 @@ config_watcher_dashboard config_zaqar_dashboard config_zun_dashboard -# NOTE(pbourke): httpd will not clean up after itself in some cases which -# results in the container not being able to restart. (bug #1489676, 1557036) -if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - if [[ "${KOLLA_BASE_DISTRO}" == "debian" ]] && [[ ${KOLLA_INSTALL_TYPE} == "binary" ]]; then - APACHE_RUN_GROUP=horizon - APACHE_RUN_USER=horizon - fi - rm -rf /var/run/apache2/* -else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* -fi - if settings_changed; then ${MANAGE_PY} collectstatic --noinput --clear ${MANAGE_PY} compress --force @@ -389,3 +374,10 @@ fi if [[ -f ${SITE_PACKAGES}/openstack_dashboard/local/.secret_key_store ]] && [[ $(stat -c %U ${SITE_PACKAGES}/openstack_dashboard/local/.secret_key_store) != "horizon" ]]; then chown horizon ${SITE_PACKAGES}/openstack_dashboard/local/.secret_key_store fi + +. /usr/local/bin/kolla_httpd_setup + +if [[ "${KOLLA_BASE_DISTRO}" == "debian" ]] && [[ ${KOLLA_INSTALL_TYPE} == "binary" ]]; then + APACHE_RUN_GROUP=horizon + APACHE_RUN_USER=horizon +fi diff --git a/docker/ironic/ironic-api/extend_start.sh b/docker/ironic/ironic-api/extend_start.sh index 20811158c8..b03feb65d5 100644 --- a/docker/ironic/ironic-api/extend_start.sh +++ b/docker/ironic/ironic-api/extend_start.sh @@ -18,16 +18,4 @@ if [[ "${!KOLLA_OSM[@]}" ]]; then exit 0 fi -# Assume the service runs on top of Apache when user is root -if [[ "$(whoami)" == 'root' ]]; then - # NOTE(pbourke): httpd will not clean up after itself in some cases which - # results in the container not being able to restart. (bug #1489676, 1557036) - if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* - else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* - fi -fi +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/ironic/ironic-pxe/extend_start.sh b/docker/ironic/ironic-pxe/extend_start.sh index db61fe0a27..ec7e2a7f33 100644 --- a/docker/ironic/ironic-pxe/extend_start.sh +++ b/docker/ironic/ironic-pxe/extend_start.sh @@ -40,13 +40,4 @@ if [[ "${ironic_arch}" =~ aarch64 ]]; then fi fi -# NOTE(pbourke): httpd will not clean up after itself in some cases which -# results in the container not being able to restart. (bug #1489676, 1557036) -if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* -else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* -fi +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/keystone/keystone/extend_start.sh b/docker/keystone/keystone/extend_start.sh index be6a0e1def..e428fc95e7 100644 --- a/docker/keystone/keystone/extend_start.sh +++ b/docker/keystone/keystone/extend_start.sh @@ -1,16 +1,5 @@ #!/bin/bash -# NOTE(pbourke): httpd will not clean up after itself in some cases which -# results in the container not being able to restart. (bug #1489676, 1557036) -if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* -else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* -fi - # Create log dir for Keystone logs KEYSTONE_LOG_DIR="/var/log/kolla/keystone" if [[ ! -d "${KEYSTONE_LOG_DIR}" ]]; then @@ -56,4 +45,6 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then exit 0 fi +. /usr/local/bin/kolla_httpd_setup + ARGS="-DFOREGROUND" diff --git a/docker/manila/manila-api/extend_start.sh b/docker/manila/manila-api/extend_start.sh index ea4a64f5f3..925d5bf604 100644 --- a/docker/manila/manila-api/extend_start.sh +++ b/docker/manila/manila-api/extend_start.sh @@ -8,16 +8,4 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then exit 0 fi -# Assume the service runs on top of Apache when user is root -if [[ "$(whoami)" == 'root' ]]; then - # NOTE(pbourke): httpd will not clean up after itself in some cases which - # results in the container not being able to restart. (bug #1489676, 1557036) - if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* - else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* - fi -fi +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/masakari/masakari-api/extend_start.sh b/docker/masakari/masakari-api/extend_start.sh index 1c372881dd..0e0d917a2d 100755 --- a/docker/masakari/masakari-api/extend_start.sh +++ b/docker/masakari/masakari-api/extend_start.sh @@ -1,19 +1,10 @@ #!/bin/bash -# NOTE(pbourke): httpd will not clean up after itself in some cases which -# results in the container not being able to restart. (bug #1489676, 1557036) -if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* -else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* -fi - # Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases # of the KOLLA_BOOTSTRAP variable being set, including empty. if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then masakari-manage db sync exit 0 fi + +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/mistral/mistral-api/extend_start.sh b/docker/mistral/mistral-api/extend_start.sh index 65e9db22cd..1495541910 100644 --- a/docker/mistral/mistral-api/extend_start.sh +++ b/docker/mistral/mistral-api/extend_start.sh @@ -8,16 +8,4 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then exit 0 fi -# Assume the service runs on top of Apache when user is root -if [[ "$(whoami)" == 'root' ]]; then - # NOTE(pbourke): httpd will not clean up after itself in some cases which - # results in the container not being able to restart. (bug #1489676, 1557036) - if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* - else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* - fi -fi +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/monasca/monasca-api/extend_start.sh b/docker/monasca/monasca-api/extend_start.sh index f52868035c..7f5802f158 100644 --- a/docker/monasca/monasca-api/extend_start.sh +++ b/docker/monasca/monasca-api/extend_start.sh @@ -9,17 +9,6 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then exit 0 fi -# NOTE(pbourke): httpd will not clean up after itself in some cases which -# results in the container not being able to restart. (bug #1489676, 1557036) -if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* -else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* -fi - # When Apache first starts it writes out the custom log files with root # ownership. This later prevents the Monasca API (which runs under the # 'monasca' user) from updating them. To avoid this we create the log @@ -33,3 +22,5 @@ for LOG_TYPE in error access; do chown monasca:kolla ${MONASCA_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log fi done + +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/monasca/monasca-log-api/extend_start.sh b/docker/monasca/monasca-log-api/extend_start.sh index d343ab26a1..088ce5de19 100644 --- a/docker/monasca/monasca-log-api/extend_start.sh +++ b/docker/monasca/monasca-log-api/extend_start.sh @@ -2,17 +2,6 @@ SERVICE="monasca-log-api" -# NOTE(pbourke): httpd will not clean up after itself in some cases which -# results in the container not being able to restart. (bug #1489676, 1557036) -if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* -else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* -fi - # When Apache first starts it writes out the custom log files with root # ownership. This later prevents the Monasca Log API (which runs under the # 'monasca' user) from updating them. To avoid this we create the log @@ -26,3 +15,5 @@ for LOG_TYPE in error access; do chown monasca:kolla ${MONASCA_LOG_API_LOG_DIR}/${SERVICE}-${LOG_TYPE}.log fi done + +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/nova/nova-api/extend_start.sh b/docker/nova/nova-api/extend_start.sh index 815b622556..aec89f6215 100644 --- a/docker/nova/nova-api/extend_start.sh +++ b/docker/nova/nova-api/extend_start.sh @@ -24,16 +24,4 @@ if [[ "${!KOLLA_OSM[@]}" ]]; then exit 0 fi -# Assume the service runs on top of Apache when user is root -if [[ "$(whoami)" == 'root' ]]; then - # NOTE(pbourke): httpd will not clean up after itself in some cases which - # results in the container not being able to restart. (bug #1489676, 1557036) - if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* - else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* - fi -fi +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/octavia/octavia-api/extend_start.sh b/docker/octavia/octavia-api/extend_start.sh index d6cacba528..72bfe57757 100644 --- a/docker/octavia/octavia-api/extend_start.sh +++ b/docker/octavia/octavia-api/extend_start.sh @@ -7,16 +7,4 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then exit 0 fi -# Assume the service runs on top of Apache when user is root -if [[ "$(whoami)" == 'root' ]]; then - # NOTE(pbourke): httpd will not clean up after itself in some cases which - # results in the container not being able to restart. (bug #1489676, 1557036) - if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* - else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* - fi -fi +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/panko/panko-api/extend_start.sh b/docker/panko/panko-api/extend_start.sh index 6cfb322eb1..b7902e8541 100644 --- a/docker/panko/panko-api/extend_start.sh +++ b/docker/panko/panko-api/extend_start.sh @@ -1,19 +1,10 @@ #!/bin/bash -# NOTE(pbourke): httpd will not clean up after itself in some cases which -# results in the container not being able to restart. (bug #1489676, 1557036) -if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* -else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* -fi - # Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases # of the KOLLA_BOOTSTRAP variable being set, including empty. if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then panko-dbsync exit 0 fi + +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/placement/placement-api/extend_start.sh b/docker/placement/placement-api/extend_start.sh index d91b8265c5..0dd48948f6 100644 --- a/docker/placement/placement-api/extend_start.sh +++ b/docker/placement/placement-api/extend_start.sh @@ -20,13 +20,4 @@ if [[ "${!KOLLA_OSM[@]}" ]]; then exit 0 fi -# NOTE(pbourke): httpd will not clean up after itself in some cases which -# results in the container not being able to restart. (bug #1489676, 1557036) -if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* -else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* -fi +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/qinling/qinling-api/extend_start.sh b/docker/qinling/qinling-api/extend_start.sh index 2da76f0d66..3a7964c729 100644 --- a/docker/qinling/qinling-api/extend_start.sh +++ b/docker/qinling/qinling-api/extend_start.sh @@ -1,19 +1,10 @@ #!/bin/bash -# NOTE(pbourke): httpd will not clean up after itself in some cases which -# results in the container not being able to restart. (bug #1489676, 1557036) -if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* -else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* -fi - # Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases # of the KOLLA_BOOTSTRAP variable being set, including empty. if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then qinling-db-manage upgrade head exit 0 fi + +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/vitrage/vitrage-api/extend_start.sh b/docker/vitrage/vitrage-api/extend_start.sh index 0a6204ea55..7f1af9b46d 100644 --- a/docker/vitrage/vitrage-api/extend_start.sh +++ b/docker/vitrage/vitrage-api/extend_start.sh @@ -1,17 +1,8 @@ #!/bin/bash -# NOTE(pbourke): httpd will not clean up after itself in some cases which -# results in the container not being able to restart. (bug #1489676, 1557036) -if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* -else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* -fi - if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then vitrage-dbsync exit 0 fi + +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/zaqar/zaqar-wsgi/extend_start.sh b/docker/zaqar/zaqar-wsgi/extend_start.sh index 1277bea352..c55f0b1995 100755 --- a/docker/zaqar/zaqar-wsgi/extend_start.sh +++ b/docker/zaqar/zaqar-wsgi/extend_start.sh @@ -1,15 +1,3 @@ #!/bin/bash -# Assume the service runs on top of Apache when user is root -if [[ "$(whoami)" == 'root' ]]; then - # NOTE(pbourke): httpd will not clean up after itself in some cases which - # results in the container not being able to restart. (bug #1489676, 1557036) - if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* - else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* - fi -fi +. /usr/local/bin/kolla_httpd_setup diff --git a/docker/zun/zun-api/extend_start.sh b/docker/zun/zun-api/extend_start.sh index 6136e6b24a..f21cc1bd32 100644 --- a/docker/zun/zun-api/extend_start.sh +++ b/docker/zun/zun-api/extend_start.sh @@ -1,19 +1,10 @@ #!/bin/bash -# NOTE(pbourke): httpd will not clean up after itself in some cases which -# results in the container not being able to restart. (bug #1489676, 1557036) -if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - # Loading Apache2 ENV variables - . /etc/apache2/envvars - install -d /var/run/apache2/ - rm -rf /var/run/apache2/* -else - rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd* -fi - # Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases # of the KOLLA_BOOTSTRAP variable being set, including empty. if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then zun-db-manage upgrade exit 0 fi + +. /usr/local/bin/kolla_httpd_setup