2016-03-17 23:37:19
来 源
中存储
Openstack
本文介绍OpenStack的HORIZON管理面板配置,首先建立KEYSTONE服务数据库,然后配置Apache。

目录   上一篇   下一篇

3.18 HORIZON管理面板配置

****建立KEYSTONE服务数据库

mysql -uroot -popenstack -e 'create database dashboard'

·         配置apache

编辑/etc/httpd/conf.d/django.conf,更改成如下内容:

WSGISocketPrefix /tmp/horizon

<VirtualHost *:80>

    WSGIScriptAlias / /opt/horizon-2012.1/openstack_dashboard/wsgi/django.wsgi

    WSGIDaemonProcess horizon user=apache group=apache processes=3 threads=10

    SetEnv APACHE_RUN_USER apache

    SetEnv APACHE_RUN_GROUP apache

    WSGIProcessGroup horizon

 

    DocumentRoot /opt/horizon-2012.1/.blackhole/

    Alias /media /opt/horizon-2012.1/openstack_dashboard/static

 

    <Directory />

        Options FollowSymLinks

        AllowOverride None

    </Directory>

 

    <Directory /opt/horizon-2012.1/>

        Options Indexes FollowSymLinks MultiViews

        AllowOverride None

        Order allow,deny

        allow from all

    </Directory>

 

    ErrorLog /var/log/httpd/error.log

    LogLevel warn

    CustomLog /var/log/httpd/access.log combined

</VirtualHost>

mkdir /opt/horizon-2012.1/.blackhole

·         配置HORIZON

/opt/horizon-2012.1/openstackdashboard/local下建立localsettings.py文件,内容如下:

import os

 

DEBUG = False

TEMPLATE_DEBUG = DEBUG

PROD = False

USE_SSL = False

 

LOCAL_PATH = os.path.dirname(os.path.abspath(__file__))

 

# FIXME: We need to change this to mysql, instead of sqlite.

DATABASES = {

    'default': {

    'ENGINE': 'django.db.backends.mysql',

    'NAME': 'dashboard',

    'USER': 'root',

    'PASSWORD': 'openstack',

    'HOST': 'localhost',

    'PORT': '3306',

    },

}

 

# The default values for these two settings seem to cause issues with apache

CACHE_BACKEND = 'dummy://'

SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'

 

# Send email to the console by default

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

# Or send them to /dev/null

#EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'

 

# django-mailer uses a different settings attribute

MAILER_EMAIL_BACKEND = EMAIL_BACKEND

 

# 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!'

 

HORIZON_CONFIG = {

    'dashboards': ('nova', 'syspanel', 'settings',),

    'default_dashboard': 'nova',

    'user_home': 'openstack_dashboard.views.user_home',

}

 

# TODO(tres): Remove these once Keystone has an API to identify auth backend.

OPENSTACK_KEYSTONE_BACKEND = {

    'name': 'native',

    'can_edit_user': True

}

 

OPENSTACK_HOST = "60.12.206.105"

OPENSTACK_KEYSTONE_URL = "http://%s:5000/v2.0" % OPENSTACK_HOST

# FIXME: this is only needed until keystone fixes its GET /tenants call

# so that it doesn't return everything for admins

OPENSTACK_KEYSTONE_ADMIN_URL = "http://%s:35357/v2.0" % OPENSTACK_HOST

OPENSTACK_KEYSTONE_DEFAULT_ROLE = "Member"

 

SWIFT_PAGINATE_LIMIT = 100

 

# If you have external monitoring links, eg:

# EXTERNAL_MONITORING = [

#     ['Nagios','http://foo.com'],

#     ['Ganglia','http://bar.com'],

# ]

 

#LOGGING = {

#        'version': 1,

#        # When set to True this will disable all logging except

#        # for loggers specified in this configuration dictionary. Note that

#        # if nothing is specified here and disable_existing_loggers is True,

#        # django.db.backends will still log unless it is disabled explicitly.

#        'disable_existing_loggers': False,

#        'handlers': {

#            'null': {

#                'level': 'DEBUG',

#                'class': 'django.utils.log.NullHandler',

#                },

#            'console': {

#                # Set the level to "DEBUG" for verbose output logging.

#                'level': 'INFO',

#                'class': 'logging.StreamHandler',

#                },

#            },

#        'loggers': {

#            # Logging from django.db.backends is VERY verbose, send to null

#            # by default.

#            'django.db.backends': {

#                'handlers': ['null'],

#                'propagate': False,

#                },

#            'horizon': {

#                'handlers': ['console'],

#                'propagate': False,

#            },

#            'novaclient': {

#                'handlers': ['console'],

#                'propagate': False,

#            },

#            'keystoneclient': {

#                'handlers': ['console'],

#                'propagate': False,

#            },

#            'nose.plugins.manager': {

#                'handlers': ['console'],

#                'propagate': False,

#            }

#        }

#}

·         静态化django

编辑/opt/horizon-2012.1/openstack_dashboard/urls.py,在最下面添加如下内容:

if settings.DEBUG is False:

    urlpatterns += patterns('',

        url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {

            'document_root': settings.STATIC_ROOT,

        }),

   )

python /opt/horizon-2012.1/manage.py collectstatic,选择yes

·         建立HORIZON数据库结构

python /opt/horizon-2012.1/manage.py syncdb

·         重启apache服务

chown -R apache:apache /opt/horizon-2012.1

/etc/init.d/httpd restart

声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。