openstack essex版安装(5)——dashboard安装

horizon是openstack项目组做的dashboard管理界面,用户通过这个界面可以很方便的对openstack功能进行操作,比如说建虚拟机、上传文件等等。horizon采用的是django的web架构。

1、安装

   1)安装web服务

sudo apt-get install apache2

   2)安装horizon

sudo apt-get install memcached openstack-dashboard

    3)在/etc/openstack-dashboard/local_settings.py里配置horizon

     这里主要配置的,一个是将SWIFT_ENALBED置为true,一个是配置有关keystone的信息。

import os

from django.utils.translation import ugettext_lazy as _

#DEBUG = False
DEBUG=True
TEMPLATE_DEBUG = DEBUG
PROD = False
USE_SSL = False

# Ubuntu-specific: Enables an extra panel in the 'Settings' section
# that easily generates a Juju environments.yaml for download,
# preconfigured with endpoints and credentails required for bootstrap
# and service deployment.
#ENABLE_JUJU_PANEL = True
ENABLE_JUJU_PANEL = False

# Note: You should change this value
SECRET_KEY = 'elj1IWiLoWHgcyYxFVLj7cM5rGOOxWl0'

# Specify a regular expression to validate user passwords.
# HORIZON_CONFIG = {
#     "password_validator": {
#         "regex": '.*',
#         "help_text": _("Your password does not meet the requirements.")
#     }
# }

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

CACHE_BACKEND = 'memcached://127.0.0.1:11211/'

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

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

# For multiple regions uncomment this configuration, and add (endpoint, title).
# AVAILABLE_REGIONS = [
#     ('http://cluster1.example.com:5000/v2.0', 'cluster1'),
#     ('http://cluster2.example.com:5000/v2.0', 'cluster2'),
# ]

OPENSTACK_HOST = "192.168.0.106"
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v2.0" % OPENSTACK_HOST
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "admin"
OPENSTACK_ADMIN_TOKEN="ADMIN"
OPENSTACK_KEYSTONE_ADMIN_URL="http://192.168.0.106:35357/v2.0"


DATABASES={
	'default':{
		'ENGINE':'django.db.backends.mysql',
		'NAME':'dash',
		'USER':'dash',
		'PASSWORD':'dashpwd',
		'HOST':'192.168.0.106',
		'default-character-set':'utf8'
		},
	}

SWIFT_ENALBED=True

SESSION_ENGINE='django.contrib.sessions.backends.cached_db'
# The OPENSTACK_KEYSTONE_BACKEND settings can be used to identify the
# capabilities of the auth backend for Keystone.
# If Keystone has been configured to use LDAP as the auth backend then set
# can_edit_user to False and name to 'ldap'.
#
# TODO(tres): Remove these once Keystone has an API to identify auth backend.
OPENSTACK_KEYSTONE_BACKEND = {
    'name': 'native',
    'can_edit_user': 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 'internalURL'.
#OPENSTACK_ENDPOINT_TYPE = "publicURL"

# The number of Swift containers and objects to display on a single page before
# providing a paging element (a "more" link) to paginate results.
API_RESULT_LIMIT = 1000

# 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,
            }
        }
}

      然后重启apache和nova-api服务。

   

3、使用

1)注册keystone服务

      创建keystone服务    

 keystone service-create --name=Keystone --type=identity --description="Keystone Identity Serve"
      创建endpoint

keystone endpoint-create --service_id = <keystone-service-id>  --region RegionOne --publicurl http://192.168.0.106:5000/v2.0 --adminurl http://192.168.0.106:35357/v2.0 --internalurl http://192.168.0.106:5000/v2.0

2)访问

在浏览器输入dashboard的ip访问。

     根据之前的设置,用户名就是user的名字admin,密码是openstack。登录后界面:




你可能感兴趣的:(django,memcached,user,email,logging,containers)