From 469a464c481e5b17e8fde5b5f627c6025cf1e0d4 Mon Sep 17 00:00:00 2001 From: Ivan Udovichenko Date: Wed, 30 Mar 2016 22:46:34 +0300 Subject: [PATCH] Sync Fuel 8.0 changes in Horizon build scripts. Rewritten-From: 3311068fd663e7ed3dd907f5dacf30726acd749f --- .../openstack-dashboard-alias-only.conf | 21 +++++------- .../openstack-dashboard-ssl.conf | 18 ++++------ .../openstack-dashboard.conf | 21 ++++-------- trusty/debian/changelog | 21 +++++++++++- trusty/debian/control | 10 +++--- .../openstack-dashboard-apache.postinst | 34 ++++++++++++++++--- trusty/debian/openstack-dashboard.links | 11 +----- trusty/debian/openstack-dashboard.postinst | 24 ++++++++----- trusty/debian/rules | 23 ++++--------- 9 files changed, 99 insertions(+), 84 deletions(-) diff --git a/trusty/debian/apache-sites-available/openstack-dashboard-alias-only.conf b/trusty/debian/apache-sites-available/openstack-dashboard-alias-only.conf index 20f7f34..0f095b2 100644 --- a/trusty/debian/apache-sites-available/openstack-dashboard-alias-only.conf +++ b/trusty/debian/apache-sites-available/openstack-dashboard-alias-only.conf @@ -1,18 +1,13 @@ WSGIScriptAlias /horizon /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi -WSGIDaemonProcess horizon user=www-data group=www-data -Alias /static /usr/share/openstack-dashboard/openstack_dashboard/static -Alias /horizon/static /usr/share/openstack-dashboard/openstack_dashboard/static +WSGIDaemonProcess horizon user=horizon group=horizon +Alias /static /var/lib/openstack-dashboard/static +Alias /horizon/static /var/lib/openstack-dashboard/static - - Order allow,deny - Allow from all + + Require all granted - - Order allow,deny - Allow from all - - - Order allow,deny - Allow from all + + + Require all granted diff --git a/trusty/debian/apache-sites-available/openstack-dashboard-ssl.conf b/trusty/debian/apache-sites-available/openstack-dashboard-ssl.conf index 3d13018..6ce9f44 100644 --- a/trusty/debian/apache-sites-available/openstack-dashboard-ssl.conf +++ b/trusty/debian/apache-sites-available/openstack-dashboard-ssl.conf @@ -9,9 +9,10 @@ BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown WSGIScriptAlias / /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi - WSGIDaemonProcess horizon user=www-data group=www-data + WSGIDaemonProcess horizon user=horizon group=horizon #WSGIProcessGroup openstack-dashboard - Alias /static /usr/share/openstack-dashboard/openstack_dashboard/static + Alias /static /var/lib/openstack-dashboard/static + Alias /horizon/static /var/lib/openstack-dashboard/static DocumentRoot /var/www @@ -20,18 +21,11 @@ - Order allow,deny - Allow from all + Require all granted - - Order allow,deny - Allow from all - - - - Order allow,deny - Allow from all + + Require all granted ErrorLog ${APACHE_LOG_DIR}/error.log diff --git a/trusty/debian/apache-sites-available/openstack-dashboard.conf b/trusty/debian/apache-sites-available/openstack-dashboard.conf index 39276f5..b841718 100644 --- a/trusty/debian/apache-sites-available/openstack-dashboard.conf +++ b/trusty/debian/apache-sites-available/openstack-dashboard.conf @@ -3,7 +3,8 @@ WSGIScriptAlias / /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi WSGIDaemonProcess horizon user=horizon group=horizon #WSGIProcessGroup openstack-dashboard - Alias /static /usr/share/openstack-dashboard/openstack_dashboard/static + Alias /static /var/lib/openstack-dashboard/static + Alias /horizon/static /var/lib/openstack-dashboard/static DocumentRoot /var/www @@ -11,23 +12,15 @@ AllowOverride None - - Order allow,deny - Allow from all + + Require all granted - Alias /static/horizon /usr/lib/python2.7/dist-packages/horizon/static/horizon - - - Order allow,deny - Allow from all + + Require all granted - - Order allow,deny - Allow from all - ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined - + diff --git a/trusty/debian/changelog b/trusty/debian/changelog index 7677a9d..e66aee0 100644 --- a/trusty/debian/changelog +++ b/trusty/debian/changelog @@ -1,9 +1,28 @@ horizon (2:9.0.0~rc1-2) UNRELEASED; urgency=medium + [ Thomas Goirand ] * Also copy openstack_dashboard/dashboards/project/static/dashboard/project which were not packaged. - -- Thomas Goirand Fri, 25 Mar 2016 15:21:06 +0100 + [ Ivan Udovichenko ] + * d/control: Add python-xstatic-magic-search dependency. + Move memcached and openstack-dashboard-apache to Suggests field. + * d/openstack-dashboard-apache.postinst: + - Remove /usr/share/openstack-dashboard/static directory and create a link + to /var/lib/openstack-dashboard/static directory to make it compatible with + Ubuntu OpenStack Puppet manifests. + - Delete the .secret_ket_store file if exists. + - Make www-data the owner of /var/lib/openstack-dashboard/secret-key and + /var/lib/openstack-dashboard/static directories. + - Set new alias to Horizon static files. + - Call collectstatic with --clear and --noinput options. + * d/rules: Do not copy/create additional files/links with/to static files. + * d/openstack-dashboard.links: Remove all links except a link to /usr/bin/lessc binary. + * d/debian/apache-sites-available/*.conf: + - Change/add alias path to static files. + - Update permissions according to Apache 2.4 improvements. + + -- Ivan Udovichenko Wed, 30 Mar 2016 22:23:48 +0300 horizon (2:9.0.0~rc1-1) experimental; urgency=medium diff --git a/trusty/debian/control b/trusty/debian/control index 378956c..915e07e 100644 --- a/trusty/debian/control +++ b/trusty/debian/control @@ -70,6 +70,7 @@ Build-Depends-Indep: gettext, python-xstatic-jquery.quicksearch, python-xstatic-jquery.tablesorter (>= 2.14.5.1), python-xstatic-jsencrypt, + python-xstatic-magic-search (>= 0.2.5.1), python-xstatic-mdi, python-xstatic-rickshaw, python-xstatic-roboto-fontface (>= 0.4.3.2), @@ -133,6 +134,7 @@ Depends: python-babel, python-xstatic-jquery.quicksearch, python-xstatic-jquery.tablesorter (>= 2.14.5.1), python-xstatic-jsencrypt, + python-xstatic-magic-search (>= 0.2.5.1), python-xstatic-mdi, python-xstatic-rickshaw, python-xstatic-roboto-fontface (>= 0.4.3.2), @@ -142,7 +144,7 @@ Depends: python-babel, python-yaml, ${misc:Depends}, ${python:Depends}, -Recommends: memcached, +Suggests: memcached, Description: Django module providing web interaction with OpenStack The OpenStack Dashboard is a web application to control an OpenStack cloud. It connects to OpenStack services such as Nova, Swift, or Keystone @@ -161,8 +163,8 @@ Depends: adduser, ${misc:Depends}, ${python:Depends}, ${shlibs:Depends}, -Recommends: memcached, - openstack-dashboard-apache, +Suggests: memcached, + openstack-dashboard-apache, Description: web application to control an OpenStack cloud The OpenStack Dashboard is a web application to control an OpenStack cloud. It connects to OpenStack services such as Nova, Swift, or Keystone @@ -171,7 +173,7 @@ Description: web application to control an OpenStack cloud Package: openstack-dashboard-apache Architecture: all -Depends: apache2, +Depends: apache2 (>= 2.4), debconf, libapache2-mod-wsgi (>= 2.3), openstack-dashboard, diff --git a/trusty/debian/openstack-dashboard-apache.postinst b/trusty/debian/openstack-dashboard-apache.postinst index 2a8b8c9..691e007 100644 --- a/trusty/debian/openstack-dashboard-apache.postinst +++ b/trusty/debian/openstack-dashboard-apache.postinst @@ -42,22 +42,46 @@ HORIZON_USE_SSL=yes" >/etc/default/openstack-dashboard-apache a2dissite openstack-dashboard-alias-only.conf a2ensite openstack-dashboard.conf fi + if [ -d '/usr/share/openstack-dashboard/static' ] ; then + rm -rf /usr/share/openstack-dashboard/static + fi + ln -s /var/lib/openstack-dashboard/static /usr/share/openstack-dashboard/static + /usr/share/openstack-dashboard/manage.py collectstatic --clear --noinput /usr/share/openstack-dashboard/manage.py compress --force - rm -f /var/lib/openstack-dashboard/secret-key/.secret_key_store - chown -R www-data /var/lib/openstack-dashboard/secret-key + if [ -f '/var/lib/openstack-dashboard/secret-key/.secret_key_store' ]; then + rm -f /var/lib/openstack-dashboard/secret-key/.secret_key_store + fi + chown -R www-data /var/lib/openstack-dashboard/secret-key /var/lib/openstack-dashboard/static invoke-rc.d --quiet apache2 reload else sed -i 's#[ \t]*HORIZON_ACTIVATE_VHOSTS=.*#HORIZON_ACTIVATE_VHOSTS=no#' /etc/default/openstack-dashboard-apache + site_configs='openstack-dashboard-ssl-redirect.conf + openstack-dashboard-ssl.conf + openstack-dashboard.conf + openstack-dashboard-alias-only.conf' + for site_config in $site_configs + do + if [ -f /etc/apache2/sites-available/$site_config ]; then + sed -i 's#WSGIScriptAlias / #WSGIScriptAlias /horizon #g' /etc/apache2/sites-available/$site_config + fi + done a2ensite 000-default.conf || true a2ensite default-ssl.conf || true sed -i "s|^[ \t]*WEBROOT[ \t]=.*|WEBROOT = '/horizon'|" /etc/openstack-dashboard/local_settings.py a2dissite openstack-dashboard.conf a2dissite openstack-dashboard-ssl-redirect.conf a2dissite openstack-dashboard-ssl.conf - a2ensite openstack-dashboard-alias-only.conf + a2dissite openstack-dashboard-alias-only.conf + if [ -d '/usr/share/openstack-dashboard/static' ] ; then + rm -rf /usr/share/openstack-dashboard/static + fi + ln -s /var/lib/openstack-dashboard/static /usr/share/openstack-dashboard/static + /usr/share/openstack-dashboard/manage.py collectstatic --clear --noinput /usr/share/openstack-dashboard/manage.py compress --force - rm -f /var/lib/openstack-dashboard/secret-key/.secret_key_store - chown -R www-data /var/lib/openstack-dashboard/secret-key + if [ -f /var/lib/openstack-dashboard/secret-key/.secret_key_store ]; then + rm -f /var/lib/openstack-dashboard/secret-key/.secret_key_store + fi + chown -R www-data /var/lib/openstack-dashboard/secret-key /var/lib/openstack-dashboard/static invoke-rc.d --quiet apache2 reload fi db_stop diff --git a/trusty/debian/openstack-dashboard.links b/trusty/debian/openstack-dashboard.links index 4f2b7d7..0dc73d1 100644 --- a/trusty/debian/openstack-dashboard.links +++ b/trusty/debian/openstack-dashboard.links @@ -1,10 +1 @@ -/usr/bin/lessc /usr/share/openstack-dashboard/bin/less/lessc - -/usr/share/openstack-dashboard/openstack_dashboard/static /usr/share/openstack-dashboard/static -/usr/lib/python2.7/dist-packages/horizon/static/horizon /usr/share/openstack-dashboard/openstack_dashboard/static/horizon -/var/lib/openstack-dashboard/static/scss /usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/scss -/var/lib/openstack-dashboard/static/js /usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/js - -/usr/share/fonts-font-awesome/fonts /usr/lib/python2.7/dist-packages/horizon/static/horizon/lib/font-awesome/fonts -/usr/share/fonts-roboto-fontface/fonts /usr/lib/python2.7/dist-packages/horizon/static/horizon/lib/roboto_fontface/fonts -/usr/share/fonts-materialdesignicons-webfont/fonts /usr/lib/python2.7/dist-packages/horizon/static/horizon/lib/mdi/fonts +/usr/bin/lessc /usr/share/openstack-dashboard/bin/less/lessc diff --git a/trusty/debian/openstack-dashboard.postinst b/trusty/debian/openstack-dashboard.postinst index db6f5d1..3bb4e8a 100644 --- a/trusty/debian/openstack-dashboard.postinst +++ b/trusty/debian/openstack-dashboard.postinst @@ -9,12 +9,7 @@ if [ "$1" = "configure" ] ; then --disabled-password \ --group horizon - mkdir -p /var/lib/openstack-dashboard/static/js - mkdir -p /var/lib/openstack-dashboard/static/css mkdir -p /var/lib/openstack-dashboard/secret-key - chown www-data:www-data /var/lib/openstack-dashboard/static - chown www-data:www-data /var/lib/openstack-dashboard/static/css - chown www-data:www-data /var/lib/openstack-dashboard/static/js chown www-data:www-data /var/lib/openstack-dashboard/secret-key mkdir -p /etc/openstack-dashboard @@ -22,16 +17,27 @@ if [ "$1" = "configure" ] ; then cp /usr/share/openstack-dashboard/local_settings.py /etc/openstack-dashboard/local_settings.py fi + if [ -d '/usr/share/openstack-dashboard/static' ] ; then + rm -rf /usr/share/openstack-dashboard/static + fi + ln -s /var/lib/openstack-dashboard/static /usr/share/openstack-dashboard/static + # Compress the JS and CSS with python-compressor and python-lesscpy + /usr/share/openstack-dashboard/manage.py collectstatic --clear --noinput /usr/share/openstack-dashboard/manage.py compress --force - rm /var/lib/openstack-dashboard/secret-key/.secret_key_store - chown -R www-data /var/lib/openstack-dashboard/secret-key + if [ -f /var/lib/openstack-dashboard/secret-key/.secret_key_store ]; then + rm /var/lib/openstack-dashboard/secret-key/.secret_key_store + fi + chown -R www-data /var/lib/openstack-dashboard/secret-key /var/lib/openstack-dashboard/static fi if [ "$1" = "triggered" ] ; then + /usr/share/openstack-dashboard/manage.py collectstatic --clear --noinput /usr/share/openstack-dashboard/manage.py compress --force - rm /var/lib/openstack-dashboard/secret-key/.secret_key_store - chown -R www-data /var/lib/openstack-dashboard/secret-key + if [ -f /var/lib/openstack-dashboard/secret-key/.secret_key_store ]; then + rm /var/lib/openstack-dashboard/secret-key/.secret_key_store + fi + chown -R www-data /var/lib/openstack-dashboard/secret-key /var/lib/openstack-dashboard/static fi #DEBHELPER# diff --git a/trusty/debian/rules b/trusty/debian/rules index 81cc4b7..562bff4 100755 --- a/trusty/debian/rules +++ b/trusty/debian/rules @@ -21,32 +21,22 @@ override_dh_auto_install: --no-compile -O0; \ done - install -d -m 755 $(CURDIR)/debian/tmp/usr/share/openstack-dashboard + install -d -m 755 $(CURDIR)/debian/tmp/usr/share/openstack-dashboard cp -a $(CURDIR)/openstack_dashboard/ $(CURDIR)/debian/tmp/usr/share/openstack-dashboard/ # Sets memcached by default in local_settings.py - cp $(CURDIR)/openstack_dashboard/local/local_settings.py.example $(CURDIR)/debian/openstack-dashboard/usr/share/openstack-dashboard/local_settings.py - sed -i -e 's/os.path.join(LOCAL_PATH,/os.path.join("\/","var","lib","openstack-dashboard","secret-key",/' $(CURDIR)/debian/openstack-dashboard/usr/share/openstack-dashboard/local_settings.py - echo "COMPRESS_OFFLINE=True" >> $(CURDIR)/debian/openstack-dashboard/usr/share/openstack-dashboard/local_settings.py + cp $(CURDIR)/openstack_dashboard/local/local_settings.py.example $(CURDIR)/debian/openstack-dashboard/usr/share/openstack-dashboard/local_settings.py + sed -i -e 's/os.path.join(LOCAL_PATH,/os.path.join("\/","var","lib","openstack-dashboard","secret-key",/' $(CURDIR)/debian/openstack-dashboard/usr/share/openstack-dashboard/local_settings.py + echo "COMPRESS_OFFLINE=True" >> $(CURDIR)/debian/openstack-dashboard/usr/share/openstack-dashboard/local_settings.py + install -d -m 755 $(CURDIR)/debian/openstack-dashboard/var/lib/openstack-dashboard/static + cp $(CURDIR)/manage.py \ $(CURDIR)/debian/tmp/usr/share/openstack-dashboard/ ln -fs /etc/openstack-dashboard/local_settings.py \ $(CURDIR)/debian/tmp/usr/share/openstack-dashboard/openstack_dashboard/local/local_settings.py - mkdir -p $(CURDIR)/debian/openstack-dashboard/usr/share/openstack-dashboard/openstack_dashboard/static/dashboard - cp -axuf $(CURDIR)/openstack_dashboard/dashboards/project/static/dashboard/project $(CURDIR)/debian/openstack-dashboard/usr/share/openstack-dashboard/openstack_dashboard/static/dashboard - -override_dh_link: - mkdir -p $(CURDIR)/debian/openstack-dashboard/var/lib/openstack-dashboard/static/scss - mv $(CURDIR)/debian/openstack-dashboard/usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/scss/* $(CURDIR)/debian/openstack-dashboard/var/lib/openstack-dashboard/static/scss - rmdir $(CURDIR)/debian/openstack-dashboard/usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/scss - dh_link - for i in auth framework horizon ; do \ - ln -s /usr/lib/python2.7/dist-packages/horizon/static/$$i $(CURDIR)/debian/openstack-dashboard/usr/share/openstack-dashboard/openstack_dashboard/static/$$i ; \ - done - override_dh_auto_clean: dh_auto_clean python setup.py clean @@ -70,3 +60,4 @@ override_dh_auto_test: # We should add --compilemessages when the .mo are removed. ./run_tests.sh --no-virtual-env --no-pep8 --verbosity=2 endif + -- 2.45.2