Merge "Customizations for Horizon"

This commit is contained in:
Jenkins 2016-08-05 11:32:48 +00:00 committed by Gerrit Code Review
commit 3071d32a3f

View File

@ -1,41 +1,50 @@
FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }} FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
MAINTAINER {{ maintainer }} MAINTAINER {{ maintainer }}
{% import "macros.j2" as macros with context %}
{% if install_type == 'binary' %} {% if install_type == 'binary' %}
{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
RUN yum -y install \ {% set horizon_packages = [
openstack-dashboard \ 'openstack-dashboard',
httpd \ 'httpd',
mod_wsgi \ 'mod_wsgi',
gettext \ 'gettext'
&& yum clean all \ ] %}
&& useradd --user-group horizon \
RUN {{ macros.install_packages(horizon_packages | customizable("packages")) }}
{% block horizon_redhat_binary_setup %}
RUN useradd --user-group horizon \
&& sed -i -r 's,^(Listen 80),#\1,' /etc/httpd/conf/httpd.conf \ && sed -i -r 's,^(Listen 80),#\1,' /etc/httpd/conf/httpd.conf \
&& ln -s /usr/share/openstack-dashboard/openstack_dashboard /usr/lib/python2.7/site-packages/openstack_dashboard \ && ln -s /usr/share/openstack-dashboard/openstack_dashboard /usr/lib/python2.7/site-packages/openstack_dashboard \
&& ln -s /usr/share/openstack-dashboard/static /usr/lib/python2.7/site-packages/static \ && ln -s /usr/share/openstack-dashboard/static /usr/lib/python2.7/site-packages/static \
&& chown -R horizon: /etc/openstack-dashboard /usr/share/openstack-dashboard \ && chown -R horizon: /etc/openstack-dashboard /usr/share/openstack-dashboard \
&& chown -R apache: /usr/share/openstack-dashboard/static && chown -R apache: /usr/share/openstack-dashboard/static \
&& sed -i "s|WEBROOT = '/dashboard/'|WEBROOT = '/'|" /etc/openstack-dashboard/local_settings \
RUN sed -i "s|WEBROOT = '/dashboard/'|WEBROOT = '/'|" /etc/openstack-dashboard/local_settings \
&& cp /usr/share/openstack-dashboard/manage.py /usr/bin/manage.py \ && cp /usr/share/openstack-dashboard/manage.py /usr/bin/manage.py \
&& /usr/bin/python /usr/bin/manage.py collectstatic --noinput --clear \ && /usr/bin/python /usr/bin/manage.py collectstatic --noinput --clear \
&& (cd /usr/lib/python2.7/site-packages/horizon && /usr/bin/python /usr/bin/manage.py compilemessages) \ && (cd /usr/lib/python2.7/site-packages/horizon && /usr/bin/python /usr/bin/manage.py compilemessages) \
&& (cd /usr/lib/python2.7/site-packages/openstack_dashboard && /usr/bin/python /usr/bin/manage.py compilemessages) && (cd /usr/lib/python2.7/site-packages/openstack_dashboard && /usr/bin/python /usr/bin/manage.py compilemessages)
{% endblock %}
{% elif base_distro in ['ubuntu'] %} {% elif base_distro in ['ubuntu'] %}
RUN apt-get -y install --no-install-recommends \ {% set horizon_packages = [
openstack-dashboard \ 'openstack-dashboard',
apache2 \ 'apache2',
libapache2-mod-wsgi \ 'libapache2-mod-wsgi',
gettext \ 'gettext'
&& echo > /etc/apache2/ports.conf \ ] %}
&& sed -i 's|\(ServerTokens \)OS|\1Prod|' /etc/apache2/conf-available/security.conf \
&& apt-get clean \
&& ln -s ../mods-available/headers.load /etc/apache2/mods-enabled/headers.load
RUN cp /usr/share/openstack-dashboard/openstack_dashboard/conf/*.json /etc/openstack-dashboard \ RUN {{ macros.install_packages(horizon_packages | customizable("packages")) }}
{% block horizon_ubuntu_binary_setup %}
RUN echo > /etc/apache2/ports.conf \
&& sed -i 's|\(ServerTokens \)OS|\1Prod|' /etc/apache2/conf-available/security.conf \
&& ln -s ../mods-available/headers.load /etc/apache2/mods-enabled/headers.load \
&& cp /usr/share/openstack-dashboard/openstack_dashboard/conf/*.json /etc/openstack-dashboard \
&& sed -i "s|WEBROOT='/horizon/'|WEBROOT = '/'|" /etc/openstack-dashboard/local_settings.py \ && sed -i "s|WEBROOT='/horizon/'|WEBROOT = '/'|" /etc/openstack-dashboard/local_settings.py \
&& sed -i "s|^POLICY_FILES_PATH|POLICY_FILES_PATH = '/etc/openstack-dashboard'|" /etc/openstack-dashboard/local_settings.py \ && sed -i "s|^POLICY_FILES_PATH|POLICY_FILES_PATH = '/etc/openstack-dashboard'|" /etc/openstack-dashboard/local_settings.py \
&& cp /usr/share/openstack-dashboard/manage.py /usr/bin/manage.py \ && cp /usr/share/openstack-dashboard/manage.py /usr/bin/manage.py \
@ -48,27 +57,38 @@ RUN cp /usr/share/openstack-dashboard/openstack_dashboard/conf/*.json /etc/opens
&& ln -s /usr/share/openstack-dashboard/static /usr/lib/python2.7/site-packages/static \ && ln -s /usr/share/openstack-dashboard/static /usr/lib/python2.7/site-packages/static \
&& (cd /usr/lib/python2.7/site-packages/horizon && /usr/bin/python /usr/bin/manage.py compilemessages) \ && (cd /usr/lib/python2.7/site-packages/horizon && /usr/bin/python /usr/bin/manage.py compilemessages) \
&& (cd /usr/lib/python2.7/site-packages/openstack_dashboard && /usr/bin/python /usr/bin/manage.py compilemessages) && (cd /usr/lib/python2.7/site-packages/openstack_dashboard && /usr/bin/python /usr/bin/manage.py compilemessages)
{% endblock %}
{% endif %} {% endif %}
{% elif install_type == 'source' %} {% elif install_type == 'source' %}
{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
RUN yum -y install \ {% set horizon_packages = [
httpd \ 'httpd',
mod_wsgi \ 'mod_wsgi',
gettext \ 'gettext'
&& yum clean all \ ] %}
&& sed -i -r 's,^(Listen 80),#\1,' /etc/httpd/conf/httpd.conf
RUN {{ macros.install_packages(horizon_packages | customizable("packages")) }}
{% block horizon_redhat_source_setup %}
RUN sed -i -r 's,^(Listen 80),#\1,' /etc/httpd/conf/httpd.conf
{% endblock %}
{% elif base_distro in ['ubuntu', 'debian'] %} {% elif base_distro in ['ubuntu', 'debian'] %}
RUN apt-get -y install --no-install-recommends \ {% set horizon_packages = [
apache2 \ 'apache2',
libapache2-mod-wsgi \ 'libapache2-mod-wsgi',
gettext \ 'gettext'
&& echo > /etc/apache2/ports.conf \ ] %}
&& apt-get clean \
RUN {{ macros.install_packages(horizon_packages | customizable("packages")) }}
{% block horizon_ubuntu_source_setup %}
RUN echo > /etc/apache2/ports.conf \
&& ln -s ../mods-available/headers.load /etc/apache2/mods-enabled/headers.load && ln -s ../mods-available/headers.load /etc/apache2/mods-enabled/headers.load
{% endblock %}
{% endif %} {% endif %}
@ -91,4 +111,6 @@ RUN ln -s horizon-source/* horizon \
COPY extend_start.sh /usr/local/bin/kolla_extend_start COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN chmod 755 /usr/local/bin/kolla_extend_start RUN chmod 755 /usr/local/bin/kolla_extend_start
{% block horizon_footer %}{% endblock %}
{% block footer %}{% endblock %}
{{ include_footer }} {{ include_footer }}