Add Horizon element

Change-Id: Ic0dc4986b2f8f1d0bb66c74d17918581a591e9cd
This commit is contained in:
Tomas Sedovic 2013-10-25 11:06:15 +02:00 committed by Tomas Sedovic
parent dbf1a0895b
commit f1c764fd55
10 changed files with 159 additions and 0 deletions

View File

@ -29,6 +29,9 @@ if [[ "Fedora" = $DISTRO ]]; then
iptables -I INPUT -p tcp --dport 8004 -j ACCEPT
iptables -I INPUT -p tcp --dport 9696 -j ACCEPT
# Horizon
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
# AMQP
iptables -I INPUT -p tcp --dport 5672 -j ACCEPT

View File

@ -0,0 +1,10 @@
Installs OpenStack Dashboard (Horizon) from git.
Horizon runs on port 80 behind Apache using mod_wsgi.
Configuration
-------------
We use the `keystone.host` key to connect to Keystone and `horizon.secret_key`
as the Django secret key.

View File

@ -0,0 +1,5 @@
apache2
os-apply-config
os-refresh-config
os-svc-install
source-repositories

View File

@ -0,0 +1,10 @@
#!/bin/bash
set -eux
install-packages libapache2-mod-wsgi
os-svc-install -n horizon -u horizon -r /opt/stack/horizon
# Django won't start otherwise:
touch /etc/horizon/.secret_key_store
chmod 600 /etc/horizon/.secret_key_store
chown horizon:horizon /etc/horizon/.secret_key_store

View File

@ -0,0 +1 @@
{{horizon.secret_key}}

View File

@ -0,0 +1,40 @@
<VirtualHost *:80>
WSGIScriptAlias / /opt/stack/venvs/horizon/lib/python2.7/site-packages/openstack_dashboard/wsgi/django.wsgi
WSGIDaemonProcess horizon user=horizon group=horizon processes=3 threads=10 home=/opt/stack/venvs/horizon python-path=/opt/stack/venvs/horizon:/opt/stack/venvs/horizon/lib/python2.7/site-packages/
WSGIApplicationGroup %{GLOBAL}
SetEnv APACHE_RUN_USER horizon
SetEnv APACHE_RUN_GROUP horizon
WSGIProcessGroup horizon
DocumentRoot /opt/stack/venvs/horizon/lib/python2.7/site-packages/openstack_dashboard/static
Alias /static /opt/stack/venvs/horizon/lib/python2.7/site-packages/openstack_dashboard/static
Alias /media /opt/stack/venvs/horizon/lib/python2.7/site-packages/openstack_dashboard/static
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /opt/stack/venvs/horizon/lib/python2.7/site-packages/openstack_dashboard/static>
Options Indexes FollowSymLinks MultiViews
Require all granted
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Directory /opt/stack/venvs/horizon/lib/python2.7/site-packages/openstack_dashboard>
Options Indexes FollowSymLinks MultiViews
Require all granted
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/httpd/horizon_error.log
LogLevel debug
CustomLog /var/log/httpd/horizon_access.log combined
</VirtualHost>
WSGISocketPrefix /var/run/httpd

View File

@ -0,0 +1,74 @@
import os
from django.utils.translation import ugettext_lazy as _
from openstack_dashboard import exceptions
DEBUG = False
TEMPLATE_DEBUG = DEBUG
COMPRESS_OFFLINE = True
ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = os.path.abspath(os.path.join(ROOT_PATH, '..', 'static'))
ALLOWED_HOSTS = ['*']
with open('/etc/horizon/.secret_key_store', 'r') as f:
SECRET_KEY = f.read()
HORIZON_CONFIG = {
'dashboards': ('project', 'admin', 'settings',),
'default_dashboard': 'project',
'user_home': 'openstack_dashboard.views.get_user_home',
'ajax_queue_limit': 10,
'auto_fade_alerts': {
'delay': 3000,
'fade_duration': 1500,
'types': ['alert-success', 'alert-info']
},
'help_url': "http://docs.openstack.org",
'exceptions': {'recoverable': exceptions.RECOVERABLE,
'not_found': exceptions.NOT_FOUND,
'unauthorized': exceptions.UNAUTHORIZED},
}
CACHES = {
'default': {
'BACKEND' : 'django.core.cache.backends.locmem.LocMemCache'
}
}
# Send email to the console by default
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
OPENSTACK_HOST = "{{keystone.host}}"
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v2.0" % OPENSTACK_HOST
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "Member"
OPENSTACK_KEYSTONE_BACKEND = {
'name': 'native',
'can_edit_user': True,
'can_edit_group': True,
'can_edit_project': True,
'can_edit_domain': True,
'can_edit_role': True
}
OPENSTACK_HYPERVISOR_FEATURES = {
'can_set_mount_point': True,
# NOTE: as of Grizzly this is not yet supported in Nova so enabling this
# setting will not do anything useful
'can_encrypt_volumes': False
}
OPENSTACK_QUANTUM_NETWORK = {
'enable_lb': False
}
API_RESULT_LIMIT = 1000
API_RESULT_PAGE_SIZE = 20
TIME_ZONE = "UTC"

View File

@ -0,0 +1,12 @@
#!/bin/bash
set -e
# TODO(shadower) workaround for:
# https://bugs.launchpad.net/os-apply-config/+bug/1246266
chmod 600 /etc/horizon/.secret_key_store
chown horizon:horizon /etc/horizon/.secret_key_store
# Precompile the Horizon assets. Can't do it in install.d because it depends on
# the local_settings.py config file.
source /opt/stack/venvs/horizon/bin/activate
DJANGO_SETTINGS_MODULE=openstack_dashboard.settings django-admin.py compress

View File

@ -0,0 +1 @@
horizon git /opt/stack/horizon https://git.openstack.org/cgit/openstack/horizon

View File

@ -78,6 +78,9 @@
"admin_user": "heat",
"admin_password": "unset"
},
"horizon": {
"secret_key": "unset___________"
},
"swift": {
"store_user": "unset",
"store_key": "unset"