summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2015-05-21 14:44:07 (GMT)
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2015-06-04 13:50:26 (GMT)
commitfe422c395e0819f11a0341ebba3250228e9f99b5 (patch)
tree4a7a61e66bea6c2b4c7247f06f81c6b4e021dad8
parent8672cc4fb9221d1bf7f849380d9c04368fb43c70 (diff)
downloaddefinitions-fe422c395e0819f11a0341ebba3250228e9f99b5.tar.gz
Horizon: Install the openstack_dashboard django project in /var/lib/horizon
With this patch we avoid some problems: - Horizon trying to write in /usr/lib/python2.7/site-packages/static - We won't have to maintain a copy of local_settings.py - The workaround of creating a symlink for django.wsgi is not needed now. This patch also changes apache-horizon.conf to - Change the path of django.wsgi file - Load the horizon server with the url 'http://<IP-of-OpenStack>' (the 'horizon/' suffix is removed) - Grant permissions to access to /var/lib/horizon/static Also changes 'tempest.conf' to change Horizon urls.
-rw-r--r--install-files/openstack/etc/horizon/apache-horizon.conf10
-rw-r--r--install-files/openstack/etc/tempest/tempest.conf4
-rw-r--r--install-files/openstack/manifest2
-rw-r--r--install-files/openstack/usr/share/openstack/horizon.yml7
-rw-r--r--strata/openstack-services/horizon.morph66
5 files changed, 46 insertions, 43 deletions
diff --git a/install-files/openstack/etc/horizon/apache-horizon.conf b/install-files/openstack/etc/horizon/apache-horizon.conf
index ea88897..ab3cf0c 100644
--- a/install-files/openstack/etc/horizon/apache-horizon.conf
+++ b/install-files/openstack/etc/horizon/apache-horizon.conf
@@ -1,16 +1,18 @@
<VirtualHost *:80>
- WSGIScriptAlias /horizon /var/lib/horizon/openstack_dashboard/django.wsgi
+ WSGIScriptAlias / /var/lib/horizon/openstack_dashboard/wsgi/django.wsgi
WSGIDaemonProcess horizon user=horizon group=horizon processes=3 threads=10 home=/var/lib/horizon display-name=horizon
WSGIApplicationGroup %{GLOBAL}
- RedirectMatch ^/$ /horizon/
-
SetEnv APACHE_RUN_USER apache
SetEnv APACHE_RUN_GROUP apache
WSGIProcessGroup horizon
DocumentRoot /var/lib/horizon/.blackhole
- Alias /static /var/lib/horizon/openstack_dashboard/static
+ Alias /static /var/lib/horizon/static
+
+ <Directory /var/lib/horizon/static>
+ Require all granted
+ </Directory>
<Directory /var/lib/horizon/openstack_dashboard >
Options Indexes FollowSymLinks MultiViews
diff --git a/install-files/openstack/etc/tempest/tempest.conf b/install-files/openstack/etc/tempest/tempest.conf
index 05f0eca..fc6b086 100644
--- a/install-files/openstack/etc/tempest/tempest.conf
+++ b/install-files/openstack/etc/tempest/tempest.conf
@@ -475,10 +475,10 @@ vnc_console = true
#
# Where the dashboard can be found (string value)
-dashboard_url = http://{{ CONTROLLER_HOST_ADDRESS }}/horizon
+dashboard_url = http://{{ CONTROLLER_HOST_ADDRESS }}
# Login page for the dashboard (string value)
-login_url = http://{{ CONTROLLER_HOST_ADDRESS }}/horizon/auth/login/
+login_url = http://{{ CONTROLLER_HOST_ADDRESS }}/auth/login/
[data_processing]
diff --git a/install-files/openstack/manifest b/install-files/openstack/manifest
index 8a609d7..521b04e 100644
--- a/install-files/openstack/manifest
+++ b/install-files/openstack/manifest
@@ -1,7 +1,5 @@
0040755 0 0 /etc/horizon
0100644 0 0 /etc/horizon/apache-horizon.conf
-0040755 0 0 /etc/horizon/openstack_dashboard
-0100644 0 0 /etc/horizon/openstack_dashboard/local_settings.py
template 0100644 0 0 /etc/tempest/tempest.conf
0040755 0 0 /usr/share/openstack
0100644 0 0 /usr/share/openstack/hosts
diff --git a/install-files/openstack/usr/share/openstack/horizon.yml b/install-files/openstack/usr/share/openstack/horizon.yml
index 14cea5c..1fec4ab 100644
--- a/install-files/openstack/usr/share/openstack/horizon.yml
+++ b/install-files/openstack/usr/share/openstack/horizon.yml
@@ -23,14 +23,13 @@
shell: /sbin/nologin
home: /var/lib/horizon
- - name: Create the /var folders for horizon
+ - name: Fix permissions in /var/lib/horizon
file:
- path: "{{ item }}"
+ path: /var/lib/horizon
state: directory
owner: horizon
group: horizon
- with_items:
- - /var/lib/horizon
+ recurse: yes
- name: Link horizon apache configuration
file:
diff --git a/strata/openstack-services/horizon.morph b/strata/openstack-services/horizon.morph
index ae6399b..74930a1 100644
--- a/strata/openstack-services/horizon.morph
+++ b/strata/openstack-services/horizon.morph
@@ -4,16 +4,12 @@ configure-commands:
# Remove unnecessary .mo files they will be generated
# later during package build.
- find . -name "django*.mo" -exec rm -f '{}' \;
-# Set COMPRESS_OFFLINE=True
-- |
- sed -i 's:COMPRESS_OFFLINE.=.False:COMPRESS_OFFLINE = True:' \
- openstack_dashboard/settings.py
build-commands:
# Compile message strings
-- cd horizon && django-admin.py compilemessages && cd ..
-- cd openstack_dashboard && django-admin.py compilemessages && cd ..
+- cd horizon && django-admin.py compilemessages
+- cd openstack_dashboard && django-admin.py compilemessages
- python setup.py build
-post-build-commands:
+
# Use the local_settings.py example to compile and compress the css, js, etc files.
# This is a hack to make SECRET_KEY work.
- |
@@ -23,37 +19,45 @@ post-build-commands:
- python manage.py collectstatic --noinput
- python manage.py compress --force
install-commands:
-# Undo hack
+# Install horizon in a temporary folder first, and then move things to the
+# right place in $DESTDIR
+- mkdir temproot
+- python setup.py install -O1 --skip-build --prefix "$PREFIX" --root temproot
+# Remove unnecessary .po files
+- find temproot -name django.po -exec rm '{}' \;
+- find temproot -name djangojs.po -exec rm '{}' \;
+
+# Move openstack_dashboard to /var/lib/horizon
+- mkdir -p "$DESTDIR"/var/lib/horizon/
+- |
+ mv temproot/"$PREFIX"/lib/python*/site-packages/openstack_dashboard \
+ "$DESTDIR"/var/lib/horizon/
+- cp manage.py "$DESTDIR"/var/lib/horizon/openstack_dashboard/
+
+# Copy the rest to $DESTDIR
+- cp -a temproot/* "$DESTDIR"
+
+# Copy local_settings to /etc/horizon/openstack_dashboard, so that they
+# can be modified, and link them where openstack_dashboard is installed.
+- mkdir -p "$DESTDIR"/etc/horizon/openstack_dashboard/
- |
cp openstack_dashboard/local/local_settings.py.example \
- openstack_dashboard/local/local_settings.py
-# Install horizon
-- python setup.py install -O1 --skip-build --prefix "$PREFIX" --root "$DESTDIR"
-post-install-commands:
-# Remove unnecessary .po files
-- find "$DESTDIR" -name django.po -exec rm '{}' \;
-- find "$DESTDIR" -name djangojs.po -exec rm '{}' \;
-# Link Openstack local_settings where openstack_dashboard is installed.
+ "$DESTDIR"/etc/horizon/openstack_dashboard/local_settings.py
+# Set COMPRESS_OFFLINE=True
+- |
+ echo "COMPRESS_OFFLINE=True" >> \
+ "$DESTDIR"/etc/horizon/openstack_dashboard/local_settings.py
+
- mkdir -p "$DESTDIR"/var/lib/horizon/openstack_dashboard/local
- |
ln -sf /etc/horizon/openstack_dashboard/local_settings.py \
- "$DESTDIR$PREFIX"/lib/python2.7/site-packages/openstack_dashboard/local/local_settings.py
+ "$DESTDIR"/var/lib/horizon/openstack_dashboard/local/local_settings.py
+
# Create the static directory (STATIC_ROOT) used in local_settings.py to keep
# the static objects like css files.
-- mkdir -p "$DESTDIR"/var/lib/horizon/openstack_dashboard/static
+- mkdir -p "$DESTDIR"/var/lib/horizon/static
# Copy the compressed static files to horizon.
-- cp -a openstack_dashboard/static/* "$DESTDIR"/var/lib/horizon/openstack_dashboard/static
-- cp -a horizon/static/* "$DESTDIR"/var/lib/horizon/openstack_dashboard/static
-- cp -a static/* "$DESTDIR"/var/lib/horizon/openstack_dashboard/static
-# Work around to make django.wsgi working with horizon
-# See: https://bugs.launchpad.net/osprofiler/+bug/1361235
-# and: https://git.openstack.org/cgit/openstack/tripleo-image-elements/commit/?id=41c9a1dfad23f8aee366afb6a0b20a6c57ec8f79
-- |
- sed -i "s|'../..'|os.path.realpath('../..')|" \
- "$DESTDIR$PREFIX"/lib/python2.7/site-packages/openstack_dashboard/wsgi/django.wsgi
-# And link this django.wsgi file to the horizon home directory
-- |
- ln -sf "$PREFIX"/lib/python2.7/site-packages/openstack_dashboard/wsgi/django.wsgi \
- "$DESTDIR"/var/lib/horizon/openstack_dashboard/django.wsgi
+- cp -a static/* "$DESTDIR"/var/lib/horizon/static
+
# Create the horizon document root for apache configuration
- mkdir -p "$DESTDIR"/var/lib/horizon/.blackhole