9. Horizon

最後更新: 2014-10-31

Horizon - Dashboard

 

* Django application (Django 1.5)
* Horizon assumes a single end-point for OpenStack services

 

Install

 

By Package

yum install memcached python-memcached mod_wsgi openstack-dashboard

 

By Manual

yum install gcc git-core python-devel python-virtualenv openssl-devel libffi-devel

> git clone https://github.com/openstack/horizon.git
> cd horizon

# build a virtualenv (.venv)
# ./run_tests.sh --runserver localhost:9000
> ./run_tests.sh

cp openstack_dashboard/local/local_settings.py.example openstack_dashboard/local/local_settings.py

 


設定

 

/etc/openstack-dashboard/

  • cinder_policy.json  
  • glance_policy.json  
  • keystone_policy.json
  • nova_policy.json

/etc/openstack-dashboard/local_settings


local_settings  

# host/domain names that this Django site can serve.
ALLOWED_HOSTS = ['*', ]

#### OpenStack-related settings

OPENSTACK_HOST

# OPENSTACK_API_VERSIONS = {
#     "identity": 3
# }

# CONSOLE_TYPE = "AUTO"

SECRET_KEY = '????'

#### Horizon configuration options
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://openstack.redhat.com/Docs",
    'exceptions': {'recoverable': exceptions.RECOVERABLE,
                   'not_found': exceptions.NOT_FOUND,
                   'unauthorized': exceptions.UNAUTHORIZED},
}


HORIZON_CONFIG["simple_ip_management"] = False


CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': '127.0.0.1:11211',
    }
}


# Send email to the console by default
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# Configure these for your outgoing email host
# EMAIL_HOST = 'smtp.my-company.com'
# EMAIL_PORT = 25
# EMAIL_HOST_USER = 'djangomail'
# EMAIL_HOST_PASSWORD = 'top-secret!'



OPENSTACK_KEYSTONE_URL = "http://192.168.88.211:5000/v2.0"
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "_member_"
# OPENSTACK_SSL_NO_VERIFY = True
# OPENSTACK_SSL_CACERT = '/path/to/cacert.pem'


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_ENDPOINT_TYPE specifies the endpoint type to use for the endpoints
# in the Keystone service catalog. Use this setting when Horizon is running
# external to the OpenStack environment. The default is 'publicURL'.
#OPENSTACK_ENDPOINT_TYPE = "publicURL"


# The number of objects to display
API_RESULT_LIMIT = 1000
API_RESULT_PAGE_SIZE = 20

TIME_ZONE = "UTC"

# The Horizon Policy Enforcement engine
POLICY_FILES_PATH = '/etc/openstack-dashboard'


SECURITY_GROUP_RULES = {
    'all_tcp': {
        'name': 'ALL TCP',
        'ip_protocol': 'tcp',
        'from_port': '1',
        'to_port': '65535',
    },
}

LOGIN_URL = '/dashboard/auth/login/'
LOGOUT_URL = '/dashboard/auth/logout/'
LOGIN_REDIRECT_URL = '/dashboard'



# The Ubuntu package includes pre-compressed JS and compiled CSS to allow offline compression by default
COMPRESS_OFFLINE = True

# For Glance image upload (file upload support from Django)
FILE_UPLOAD_TEMP_DIR = '/tmp'

/etc/sysconfig/memcached

PORT="11211"
USER="memcached"
MAXCONN="8192"
CACHESIZE="2675"
OPTIONS="-l 0.0.0.0 -U 11211 -t 2"

# service httpd start
# service memcached start
# chkconfig httpd on
# chkconfig memcached on

 


Appache Configure

 

/etc/httpd/conf.d/

  • 15-horizon_vhost.conf
  • wsgi.conf

15-horizon_vhost.conf

<VirtualHost *:80>
  ServerName openstack

  ## Vhost docroot
  DocumentRoot "/var/www/"
  ## Alias declarations for resources outside the DocumentRoot
  Alias /static "/usr/share/openstack-dashboard/static"

  ## Directories, there should at least be a declaration for /var/www/

  <Directory "/var/www/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>

  ## Load additional static includes


  ## Logging
  ErrorLog "/var/log/httpd/horizon_error.log"
  ServerSignature Off
  CustomLog "/var/log/httpd/horizon_access.log" combined

  ## RedirectMatch rules
  RedirectMatch permanent  ^/$ /dashboard


  ## Server aliases
  ServerAlias *
  WSGIDaemonProcess dashboard group=apache processes=3 threads=10 user=apache
  WSGIProcessGroup dashboard
  WSGIScriptAlias /dashboard "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi"
</VirtualHost>

wsgi.conf

WSGISocketPrefix /var/run/wsgi

wsgi.load

LoadModule wsgi_module modules/mod_wsgi.so
  

 

 


Link:

http://controller/dashboard

 


Usage

protected image <- Prevents an image from being deleted


 

 

 

Creative Commons license icon Creative Commons license icon