Эх сурвалжийг харах

HUE-9020 [core] Improve Hue and Hue Load Balancer docker image generation.

(cherry picked from commit 50be3934476602df60c391bb6506585a32ed9bb7)
(cherry picked from commit 656beb0be41c864cb2fe68d3f9f3c4da405c4ea9)
Prakash Ranade 6 жил өмнө
parent
commit
9b0a260045

+ 67 - 0
tools/container/base/hue/Dockerfile

@@ -0,0 +1,67 @@
+FROM centos:7
+
+LABEL description="Hue Project https://github.com/cloudera/hue"
+
+# Set the environment variable
+ENV NAME="basehue"
+
+# Required for building Hue
+#RUN yum install -y \
+#      ant \
+#      curl \
+#      gcc \
+#      gcc-c++ \
+#      git \
+#      java-1.8.0-openjdk-devel \
+#      maven \
+#      make \
+#      mysql-devel \
+#      nc \
+#      sudo \
+#      tar \
+#      vim-enhanced
+#
+
+# Required libraries for running Hue
+RUN set -eux; \
+      yum install -y \
+        asciidoc \
+        bzip2-devel \
+        cyrus-sasl-devel \
+        cyrus-sasl-gssapi \
+        cyrus-sasl-plain \
+        gettext \
+        gmp-devel \
+        krb5-devel \
+        krb5-libs \
+        krb5-workstation \
+        libffi-devel \
+        libtidy \
+        libxml2-devel \
+        libxslt-devel \
+        nmap-ncat \
+        ncurses-devel \
+        openldap-devel \
+        openssl-devel \
+        python-devel \
+        python-setuptools \
+        readline-devel \
+        sqlite-devel \
+        sudo \
+        xmlsec1 \
+        zlib-devel
+
+RUN set -eux; easy_install supervisor pip
+
+RUN curl -s https://files.pythonhosted.org/packages/a1/92/a27986cb7b4bddc7d57781a0e1163d683110907edfca1db3fbce25536492/psycopg2_binary-2.8.3-cp27-cp27mu-manylinux1_x86_64.whl -o /tmp/psycopg2_binary-2.8.3-cp27-cp27mu-manylinux1_x86_64.whl
+
+RUN set -eux ; \
+      curl -sL https://rpm.nodesource.com/setup_10.x | bash - \
+        && yum install -y nodejs \
+        && yum clean all -y
+
+# kubernetes pod health check
+COPY healthz.sh /
+RUN chmod +x /healthz.sh
+
+CMD ["/bin/bash"]

+ 0 - 0
tools/container/hue/healthz.sh → tools/container/base/hue/healthz.sh


+ 21 - 0
tools/container/base/huelb/Dockerfile

@@ -0,0 +1,21 @@
+FROM centos:7
+
+LABEL description="Hue Project https://github.com/cloudera/hue"
+
+# Set the environment variable
+ENV NAME="basehue"
+
+RUN set -eux; \
+      yum install -y \
+        httpd \
+        httpd-tools \
+        gettext \
+        nmap-ncat
+
+# kubernetes pod health check
+COPY healthz.sh /
+RUN chmod +x /healthz.sh
+
+EXPOSE 80
+
+CMD ["/usr/sbin/apachectl"]

+ 0 - 0
tools/container/huelb/healthz.sh → tools/container/base/huelb/healthz.sh


+ 70 - 9
tools/container/build.sh

@@ -7,7 +7,10 @@ HUE_SRC=$(realpath $WORK_DIR/../..)
 BUILD_DIR=$(realpath $HUE_SRC/../containerbuild$GBN)
 HUE_DIR=$WORK_DIR/hue
 APACHE_DIR=$WORK_DIR/huelb
+BASEHUE_DIR=$WORK_DIR/base/hue
+BASEHUELB_DIR=$WORK_DIR/base/huelb
 REGISTRY=${REGISTRY:-"docker.io/hortonworks"}
+HUEUSER="hive"
 
 compile_hue() {
   mkdir -p $BUILD_DIR
@@ -26,41 +29,99 @@ find_git_state() {
   export VERSION=$(grep "VERSION=" VERSION | cut -d"=" -f2 | cut -d'"' -f2)
 }
 
-generate_random_string() {
-  cd $HUE_DIR
-  thisuser=$(uuidgen | cut -d"-" -f5)
-  thispass=$(uuidgen | cut -d"-" -f5)
-  sed -i -e "s|username=.*|username=${thisuser}|g" supervisor-files/etc/supervisord.conf
-  sed -i -e "s|password=.*|password=${thispass}|g" supervisor-files/etc/supervisord.conf
+subst_var() {
+  file_name=$1
+  if [[ -e $file_name ]]; then
+    if [[ "$file_name" == *"_template" ]]; then
+      out_name="${file_name::-9}.conf"
+    fi
+  fi
+
+  envsubst < $file_name > $out_name
 }
 
 docker_hue_build() {
+  export HUE_USER="hive"
+  export HUE_CONF="/etc/hue"
+  export HUE_HOME="/opt/${HUEUSER}"
+  export HUE_CONF_DIR="${HUE_CONF}/conf"
+  export HUE_LOG_DIR="/var/log/${HUEUSER}"
+  export UUID_GEN=$(uuidgen | cut -d"-" -f5)
+
   cd $HUE_DIR
-  generate_random_string
   cp -a $BUILD_DIR/hue $HUE_DIR
   rm -f $HUE_DIR/hue/desktop/conf/*
-  export HUEUSER="hive"
+
+  for f in $(find $HUE_DIR/supervisor-files -name "*_template"); do
+    subst_var $f
+  done
+
   docker build -f $HUE_DIR/Dockerfile -t ${REGISTRY}/hue:$GBN \
     --build-arg GBN=$GBN \
     --build-arg GSHA="$GSHA" \
     --build-arg GBRANCH=$GBRANCH \
     --build-arg VERSION=$VERSION \
-    --build-arg HUEUSER="hive" \
+    --build-arg HUEUSER=$HUEUSER \
     .
 }
 
 docker_huelb_build() {
+  export HUE_USER="hive"
+  export HUE_CONF="/etc/hue"
+  export HUE_HOME="/opt/${HUEUSER}"
+  export HUE_CONF_DIR="${HUE_CONF}/conf"
+  export HUE_LOG_DIR="/var/log/${HUEUSER}"
+
   cd $APACHE_DIR
   cp -a $BUILD_DIR/hue/build/static $APACHE_DIR
+
+  for f in $(find $APACHE_DIR -name "*_template"); do
+    subst_var $f
+  done
+
   docker build -f $APACHE_DIR/Dockerfile -t ${REGISTRY}/huelb:$GBN \
     --build-arg GBN=$GBN \
     --build-arg GSHA="$GSHA" \
     --build-arg GBRANCH=$GBRANCH \
     --build-arg VERSION=$VERSION \
+    --build-arg HUEUSER=$HUEUSER \
     .
 }
 
+build_huebase() {
+  cd $BASEHUE_DIR
+  docker build -f $BASEHUE_DIR/Dockerfile -t ${REGISTRY}/huebase_centos:7 .
+  docker tag ${REGISTRY}/huebase_centos:7 huebase_centos:7
+  docker push ${REGISTRY}/huebase_centos:7
+  docker pull ${REGISTRY}/huebase_centos:7
+}
+
+build_huelbbase() {
+  cd $BASEHUELB_DIR
+  docker build -f $BASEHUELB_DIR/Dockerfile -t ${REGISTRY}/huelb_httpd:2.4 .
+  docker tag ${REGISTRY}/huelb_httpd:2.4 huelb_httpd:2.4
+  docker push ${REGISTRY}/huelb_httpd:2.4
+  docker pull ${REGISTRY}/huelb_httpd:2.4
+}
+
+pull_base_images() {
+  set +e
+  docker pull ${REGISTRY}/huebase_centos:7
+  if [[ $? != 0 ]]; then
+    build_huebase
+  fi
+  docker tag ${REGISTRY}/huebase_centos:7 huebase_centos:7
+
+  docker pull ${REGISTRY}/huelb_httpd:2.4
+  if [[ $? != 0 ]]; then
+    build_huelbbase
+  fi
+  docker tag ${REGISTRY}/huelb_httpd:2.4 huelb_httpd:2.4
+  set -e
+}
+
 compile_hue
 find_git_state
+pull_base_images
 docker_hue_build
 docker_huelb_build

+ 21 - 70
tools/container/hue/Dockerfile

@@ -1,4 +1,4 @@
-FROM centos:7
+FROM huebase_centos:7
 
 LABEL description="Hue Project https://github.com/cloudera/hue"
 
@@ -10,97 +10,48 @@ ARG HUEUSER
 
 # Set the environment variable
 ENV NAME="hue" \
-    HUE_HOME="/opt/${HUEUSER}" \
+    HUE_USER=${HUEUSER} \
     HUE_CONF="/etc/hue" \
+    HUE_HOME="/opt/${HUEUSER}" \
+    HUE_CONF_DIR="${HUE_CONF}/conf" \
+    HUE_LOG_DIR="/var/log/${HUEUSER}" \
     HUE_BUILDNO=${GBN} \
     HUE_SHAURL=${GSHA} \
     HUE_BRANCHURL=${GBRANCH} \
     HUE_VERSION=${VERSION} \
     HUE_BIN="/opt/${HUEUSER}/build/env/bin" \
-    PATH=$PATH:$HUE_BIN \
-    SUPERVISOR_VERSION=4.0.2 \
-    HUE_USER=${HUEUSER}
+    PATH=$PATH:${HUE_BIN} \
+    SUPERVISOR_VERSION=4.0.2
 
-# Required for building Hue
-#RUN yum install -y \
-#      ant \
-#      curl \
-#      gcc \
-#      gcc-c++ \
-#      git \
-#      java-1.8.0-openjdk-devel \
-#      maven \
-#      make \
-#      mysql-devel \
-#      nc \
-#      sudo \
-#      tar \
-#      vim-enhanced
-#
-
-# Required libraries for running Hue
-RUN yum install -y \
-      asciidoc \
-      bzip2-devel \
-      cyrus-sasl-devel \
-      cyrus-sasl-gssapi \
-      cyrus-sasl-plain \
-      gmp-devel \
-      krb5-devel \
-      krb5-libs \
-      krb5-workstation \
-      libffi-devel \
-      libtidy \
-      libxml2-devel \
-      libxslt-devel \
-      nmap-ncat \
-      ncurses-devel \
-      openldap-devel \
-      openssl-devel \
-      python-devel \
-      python-setuptools \
-      readline-devel \
-      sqlite-devel \
-      sudo \
-      xmlsec1 \
-      zlib-devel
+# create hue user
+RUN groupadd -g 1123 ${HUE_USER} && useradd -g 1123 -d ${HUE_HOME} -s /bin/bash -u 1123 ${HUE_USER}
 
-RUN easy_install supervisor
+COPY --chown=${HUE_USER}:${HUE_USER} hue ${HUE_HOME}
+COPY --chown=${HUE_USER}:${HUE_USER} hue.sh ${HUE_HOME}/hue.sh
 
-RUN curl -sL https://rpm.nodesource.com/setup_10.x | bash - \
-      && yum install -y nodejs \
-      && yum clean all -y
+# Install psycopg2-binary
+RUN $HUE_BIN/pip install /tmp/psycopg2_binary-2.8.3-cp27-cp27mu-manylinux1_x86_64.whl
 
-# kubernetes health check
-COPY healthz.sh /
+# Setup directory structure
+RUN mkdir -p ${HUE_LOG_DIR} && chown -R ${HUE_USER}:${HUE_USER} ${HUE_LOG_DIR}
+RUN mkdir -p ${HUE_CONF} && chown -R ${HUE_USER}:${HUE_USER} ${HUE_CONF}
 
-# create hue user
-RUN groupadd -g 1123 ${HUE_USER} && useradd -g 1123 -d ${HUE_HOME} -s /bin/bash -u 1123 ${HUE_USER}
-WORKDIR /opt/${HUE_USER}
-COPY hue ${HUE_HOME}
-COPY hue.sh ${HUE_HOME}/hue.sh
-RUN $HUE_BIN/pip install psycopg2-binary
-RUN chown -R ${HUE_USER}:${HUE_USER} ${HUE_HOME} && \
-    mkdir -p /var/log/${HUE_USER} && \
-    chown -R ${HUE_USER}:${HUE_USER} /var/log/${HUE_USER} && \
-    mkdir -p ${HUE_CONF} && \
-    chown -R ${HUE_USER}:${HUE_USER} ${HUE_CONF} && \
-    echo "${HUE_USER} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${HUE_USER} && \
+# sudo privilege
+RUN echo "${HUE_USER} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${HUE_USER} && \
     chmod 0440 /etc/sudoers.d/${HUE_USER}
 
-ENV HUE_CONF_DIR ${HUE_CONF}/conf
-COPY hueconf ${HUE_CONF}/conf
+COPY --chown=${HUE_USER}:${HUE_USER} hueconf ${HUE_CONF_DIR}
 
 RUN ln -s ${HUE_CONF}/conf/log.conf ${HUE_HOME}/desktop/conf/log.conf; \
     ln -s ${HUE_CONF}/conf/log4j.properties ${HUE_HOME}/desktop/conf/log4j.properties
 
 # supervisor stuff
+RUN mkdir -p /etc/supervisor.d/ && chmod +w /etc/supervisor.d && mkdir -p /var/log/root
 ADD supervisor-files/etc/supervisord.conf /etc/supervisord.conf
-RUN mkdir -p /etc/supervisor.d/ && chmod +w /etc/supervisor.d
 ADD supervisor-files/hue_server.conf /etc/supervisor.d/
 ADD supervisor-files/hue_ktrenewer.conf /etc/supervisor.d/
 
 EXPOSE 8888 9111
 
-USER ${HUE_USER}
+WORKDIR ${HUE_HOME}
 CMD ["/usr/bin/supervisord","-c","/etc/supervisord.conf"]

+ 9 - 9
tools/container/hue/supervisor-files/etc/supervisord.conf → tools/container/hue/supervisor-files/etc/supervisord_template

@@ -1,31 +1,31 @@
 [unix_http_server]
-file=/var/log/hive/supervisord.sock
-username=57c4015687d4
-password=cf065b403d9c
+file=/var/log/${USER}/supervisord.sock
+username=${UUID_GEN}
+password=${UUID_GEN}
 
 [supervisord]
-pidfile=/var/log/hive/supervisord.pid
+pidfile=/var/log/${USER}/supervisord.pid
 stdout_logfile=/dev/stdout
 stdout_logfile_maxbytes=0
 stderr_logfile=/dev/stderr
 stderr_logfile_maxbytes=0
 loglevel=info
 nodaemon=true
-identifier=agent-57c4015687d4
+identifier=agent-${UUID_GEN}
 
 # These two (unix_http_server, rpcinterface) are needed for supervisorctl to work
 [inet_http_server]
 port=127.0.0.1:9111
-username=57c4015687d4
-password=cf065b403d9c
+username=${UUID_GEN}
+password=${UUID_GEN}
 
 [rpcinterface:supervisor]
 supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface
 
 [supervisorctl]
 serverurl=http://localhost:9111
-username=57c4015687d4
-password=cf065b403d9c
+username=${UUID_GEN}
+password=${UUID_GEN}
 
 [include]
 files = /etc/supervisor.d/*.conf

+ 5 - 5
tools/container/hue/supervisor-files/hue_ktrenewer.conf → tools/container/hue/supervisor-files/hue_ktrenewer_template

@@ -1,15 +1,15 @@
 [program:hue_ktrenewer]
-command=/opt/hive/hue.sh kt_renewer
-directory=/opt/hive
+command=${HUE_HOME}/hue.sh kt_renewer
+directory=${HUE_HOME}
 autostart=true
 startretries=3
 stdout_logfile=/dev/stdout
 stdout_logfile_maxbytes=0
 stderr_logfile=/dev/stderr
 stderr_logfile_maxbytes=0
-environment=DESKTOP_LOG_DIR="/var/log/hive",PYTHON_EGG_CACHE="$HUE_CONF_DIR/.python-eggs",SERVER_SOFTWARE="apache"
-user=hive
-group=hive
+environment=DESKTOP_LOG_DIR="/var/log/${HUE_USER}",PYTHON_EGG_CACHE="$HUE_CONF_DIR/.python-eggs"
+user=${HUE_USER}
+group=${HUE_USER}
 exitcodes=0,2
 autorestart=false
 startsecs=20

+ 5 - 5
tools/container/hue/supervisor-files/hue_server.conf → tools/container/hue/supervisor-files/hue_server_template

@@ -1,15 +1,15 @@
 [program:hue_server]
-command=/opt/hive/hue.sh runcpserver
-directory=/opt/hive
+directory=${HUE_HOME}
+command=${HUE_HOME}/hue.sh runcpserver
 autostart=true
 startretries=3
 stdout_logfile=/dev/stdout
 stdout_logfile_maxbytes=0
 stderr_logfile=/dev/stderr
 stderr_logfile_maxbytes=0
-environment=DESKTOP_LOG_DIR="/var/log/hive",PYTHON_EGG_CACHE="$HUE_CONF_DIR/.python-eggs",SERVER_SOFTWARE="apache"
-user=hive
-group=hive
+environment=DESKTOP_LOG_DIR="/var/log/${HUE_USER}",PYTHON_EGG_CACHE="${HUE_CONF_DIR}/.python-eggs",SERVER_SOFTWARE="apache"
+user=${HUE_USER}
+group=${HUE_USER}
 exitcodes=0,2
 autorestart=false
 startsecs=20

+ 21 - 20
tools/container/huelb/Dockerfile

@@ -1,4 +1,4 @@
-FROM httpd:2.4
+FROM huelb_httpd:2.4
 
 LABEL description="Hue Project https://github.com/cloudera/hue"
 
@@ -6,37 +6,38 @@ ARG GBN
 ARG GSHA
 ARG GBRANCH
 ARG VERSION
+ARG HUEUSER
 
 # Set the environment variable
 ENV NAME="hue" \
-    HUE_HOME="/opt/hue" \
+    HUE_USER=${HUEUSER} \
     HUE_CONF="/etc/hue" \
+    HUE_HOME="/opt/${HUEUSER}" \
+    HUE_CONF_DIR="${HUE_CONF}/conf" \
+    HUE_LOG_DIR="/var/log/${HUEUSER}" \
     HUE_BUILDNO=${GBN} \
     HUE_SHAURL=${GSHA} \
     HUE_BRANCHURL=${GBRANCH} \
     HUE_VERSION=${VERSION} \
-    HUE_BIN="/opt/hue/build/env/bin" \
-    PATH=$PATH:$HUE_BIN
+    HUE_BIN="/opt/${HUEUSER}/build/env/bin" \
+    PATH=$PATH:${HUE_BIN} \
+    SUPERVISOR_VERSION=4.0.2
 
-RUN apt-get update; \
-    apt-get install -y --no-install-recommends \
-      netcat \
-      ; \
-    rm -r /var/lib/apt/lists/*;
+# create hue user
+RUN groupadd -g 1123 ${HUE_USER} && useradd -g 1123 -d ${HUE_HOME} -s /bin/bash -u 1123 ${HUE_USER}
 
-RUN echo "Include /usr/local/apache2/conf/hue_httpd.conf" >> /usr/local/apache2/conf/httpd.conf
+RUN mkdir -p ${HUE_LOG_DIR} && chown -R ${HUE_USER}:${HUE_USER} ${HUE_LOG_DIR}
+RUN echo "Include /etc/httpd/conf.d/hue_httpd.conf" >> /etc/httpd/conf/httpd.conf
 
-RUN groupadd -g 1123 hue && useradd -g 1123 -d ${HUE_HOME} -s /bin/bash -u 1123 hue
-
-COPY static ${HUE_HOME}/build/static
-
-COPY run_httpd.sh ${HUE_HOME}
-COPY healthz.sh /
-
-WORKDIR ${HUE_HOME}
-
-COPY hue_httpd.conf /usr/local/apache2/conf/hue_httpd.conf
+COPY --chown=${HUE_USER}:${HUE_USER} static ${HUE_HOME}/build/static
+COPY --chown=${HUE_USER}:${HUE_USER} hue_httpd.conf /etc/httpd/conf.d/hue_httpd.conf
+COPY --chown=${HUE_USER}:${HUE_USER} hue.conf /etc/httpd/conf.d/hue.conf
+COPY --chown=${HUE_USER}:${HUE_USER} run_httpd.sh ${HUE_HOME}
+RUN chmod -v +x ${HUE_HOME}/run_httpd.sh
 
 EXPOSE 80
+# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
+STOPSIGNAL SIGINT
 
+WORKDIR ${HUE_HOME}
 CMD ["run_httpd.sh"]

+ 0 - 3
tools/container/huelb/hue.conf

@@ -1,3 +0,0 @@
-<Proxy balancer://hue>
-  BalancerMember http://172.17.0.2:8888 retry=10 route=HUE-1-HUE_SERVER-6027230c682c63383f2385581e636e54
-</Proxy>

+ 0 - 47
tools/container/huelb/hue_httpd.conf

@@ -1,47 +0,0 @@
-LoadModule proxy_module /usr/local/apache2/modules/mod_proxy.so
-LoadModule proxy_balancer_module /usr/local/apache2/modules/mod_proxy_balancer.so
-LoadModule proxy_http_module /usr/local/apache2/modules/mod_proxy_http.so
-LoadModule slotmem_shm_module /usr/local/apache2/modules/mod_slotmem_shm.so
-LoadModule unixd_module /usr/local/apache2/modules/mod_unixd.so
-LoadModule lbmethod_byrequests_module /usr/local/apache2/modules/mod_lbmethod_byrequests.so
-LoadModule authz_core_module /usr/local/apache2/modules/mod_authz_core.so
-LoadModule log_config_module /usr/local/apache2/modules/mod_log_config.so
-LoadModule mime_module /usr/local/apache2/modules/mod_mime.so
-
-ErrorLog "${HUE_LOG_DIR}/httpd_error_log"
-LogLevel warn
-
-<IfModule log_config_module>
-  LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
-  LogFormat "%h %l %u %t \"%r\" %>s %b" common
-  CustomLog "${HUE_LOG_DIR}/httpd_access_log" common
-</IfModule>
-
-<IfModule mime_module>
-  TypesConfig conf/mime.types
-  AddType application/x-compress .Z
-  AddType application/x-gzip .gz .tgz
-</IfModule>
-
-<Directory />
-  Options FollowSymlinks
-  AllowOverride none
-</Directory>
-
-<Directory /opt/hue/build/static>
-  Options -Indexes
-  Require all granted
-</Directory>
-
-Alias /static /opt/hue/build/static
-
-Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
-ProxyPreserveHost Off
-ProxyPass /static !
-ProxyPass / balancer://hue/ stickysession=ROUTEID
-
-SetEnv proxy-initial-not-pooled 1
-ProxyTimeout 900
-
-AllowEncodedSlashes NoDecode
-Include /usr/local/apache2/conf/hue.conf

+ 47 - 0
tools/container/huelb/hue_httpd_template

@@ -0,0 +1,47 @@
+LoadModule proxy_module /etc/httpd/modules/mod_proxy.so
+LoadModule proxy_balancer_module /etc/httpd/modules/mod_proxy_balancer.so
+LoadModule proxy_http_module /etc/httpd/modules/mod_proxy_http.so
+LoadModule slotmem_shm_module /etc/httpd/modules/mod_slotmem_shm.so
+LoadModule unixd_module /etc/httpd/modules/mod_unixd.so
+LoadModule lbmethod_byrequests_module /etc/httpd/modules/mod_lbmethod_byrequests.so
+LoadModule authz_core_module /etc/httpd/modules/mod_authz_core.so
+LoadModule log_config_module /etc/httpd/modules/mod_log_config.so
+LoadModule mime_module /etc/httpd/modules/mod_mime.so
+
+ErrorLog "${HUE_LOG_DIR}/httpd_error_log"
+LogLevel warn
+
+<IfModule log_config_module>
+  LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+  LogFormat "%h %l %u %t \"%r\" %>s %b" common
+  CustomLog "${HUE_LOG_DIR}/httpd_access_log" common
+</IfModule>
+
+<IfModule mime_module>
+  TypesConfig /etc/mime.types
+  AddType application/x-compress .Z
+  AddType application/x-gzip .gz .tgz
+</IfModule>
+
+<Directory />
+  Options FollowSymlinks
+  AllowOverride none
+</Directory>
+
+<Directory ${HUE_HOME}/build/static>
+  Options -Indexes
+  Require all granted
+</Directory>
+
+Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
+ProxyPreserveHost Off
+ProxyPass /static !
+ProxyPass / balancer://hue/ stickysession=ROUTEID
+
+SetEnv proxy-initial-not-pooled 1
+ProxyTimeout 900
+
+AllowEncodedSlashes NoDecode
+User ${HUE_USER}
+Group ${HUE_USER}
+Include /etc/httpd/conf.d/hue.conf

+ 3 - 8
tools/container/huelb/run_httpd.sh

@@ -1,11 +1,6 @@
 #!/bin/sh
-
-export HUE_LOG_DIR="/var/log/hue"
-mkdir -p ${HUE_LOG_DIR}
-
 set -e
+mkdir -p ${HUE_LOG_DIR}
+rm -rf /run/httpd/* /tmp/httpd*
 
-# Apache gets grumpy about PID files pre-existing
-rm -f /usr/local/apache2/logs/httpd.pid
-
-exec httpd -DFOREGROUND "$@"
+exec /usr/sbin/httpd -DFOREGROUND "$@"