Rebuild the DT / custom horizon image - train notes
Jump to navigation
Jump to search
Rebuild horizon with template override
- Assumes as the custom css / images are uploaded in the correct location
# note: you can check how the standard container is build and see what sections are avaialble to inject in the template-overrides.j2 searching for the project Dockerfile.j2
# eg: locate horion | grep Dockerfile.j2
# /root/virtualenv-kolla-train/share/kolla/docker/horizon/Dockerfile.j2
[root@registry-dt ~]# cd define-cloud/dockerfiles/horizon/
dt-assets/ dt-assets.tgz template-override.j2
[root@registry-dt ~]# cd define-cloud/dockerfiles/horizon/
[root@registry-dt horizon]# cat template-override.j2
{% extends parent_template %}
# Horizon - ignore openstack kolla docs, use the horizon footer as its blank (or i think you could also use template-append.j2)
{% block horizon_footer %}
# Our custom horizon additions
RUN cd /tmp && curl -O https://www.define-technology.com/assets/dt-assets.tgz && tar zxvf dt-assets.tgz -C /tmp
RUN mkdir -p /usr/share/openstack-dashboard/openstack_dashboard/dt-assets \
&& cp -R /tmp/dt-assets/* /usr/share/openstack-dashboard/openstack_dashboard/dt-assets \
&& cp /tmp/dt-assets/favicon.ico /usr/share/openstack-dashboard/static/dashboard/img/ \
&& sed -i 's/DATA_UPLOAD_MAX_NUMBER_FIELDS = 1000/DATA_UPLOAD_MAX_NUMBER_FIELDS = 10000/' /usr/lib/python2.7/site-packages/django/conf/global_settings.py \
&& echo -e "<link href='/dt-assets/css/custom_dt.css' media='screen' rel='stylesheet' />\n<style>@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');</style>\n" >> /usr/share/openstack-dashboard/openstack_dashboard/templates/_stylesheets.html \
&& echo -e "Alias /dt-assets /usr/share/openstack-dashboard/openstack_dashboard/dt-assets\n\n<Directory /usr/share/openstack-dashboard/openstack_dashboard/dt-assets>\n Options All\n AllowOverride All\n Require all granted\n</Directory>\n" >> /etc/httpd/conf.d/openstack-dashboard.conf \
&& echo
{% endblock %}
Build the container
[root@registry-dt horizon]# kolla-build --template-override ./template-override.j2 --registry registry.define-technology.com:5000 horizon # just build plain horizon image kolla-build --registry registry.define-technology.com:5000 --push horizon docker tag registry.define-technology.com:5000/kolla/centos-binary-horizon:8.0.5 registry.define-technology.com:5000/kolla/centos-binary-horizon:stein docker push registry.define-technology.com:5000/kolla/centos-binary-horizon:stein
Set the flag in globals.yml
# another one in globals.yml - then use push / tag stein-definetech horizon_tag: "stein-definetech"
Redploy horizon with the updated container
# then to redeploy horizon - on the deploy node docker stop horizon docker rm horison docker exec -it kolla-deploy kolla-ansible -i /etc/kolla/all-in-one deploy -t horizon