装dashobard时候总报错,收集如下文档参考,版权归原作者.参见http://blog.sina.com.cn/s/blog_4b8481f70100xnw9.html

本文目的在于swift+Keystone+dashboard 安装

对swift的安装本文就先行忽略,keystone安装在swift的proxy节点处,为实验简单性,所使用的环境的 ESXi上的一台 ubuntu 11.04 的32bit 虚拟机

 

一) 源码安装

Git clone ​​https://github.com/openstack/keystone.git​​  ~/keystone

 

主要安装步骤可以参考keystone源码包中的​​README.md​

依赖项

 

# Show dependencies
$ cat tools/pip-requires

 

# You may need to install development files before using 'pip install'
# For example:
# sudo apt-get install python-dev libxml2-dev libxslt1-dev libsasl2-dev libldap2-dev libsqlite3-dev libssl-dev

因此先要安装

apt-get install python-dev libxml2-dev libxslt1-dev libsasl2-dev libldap2-dev libsqlite3-dev libssl-dev

 

# Install dependencies (for production, testing, and development)
$ pip install -r tools/pip-requires

这个过程需要花一定的时间

 

# Optional: Install Memcache (if enabled as a backend)
Refer #(http://memcached.org/)

安装Memcache(可选)

 

运行 Keystone

配置文件在 etc/keystone.conf 包括各服务的绑定端口和ip修改,可将该文件拷贝到 /etc目录下

与swift集成,在proxy节点处

$ swift-init all stop
$ cd ~/keystone/bin && ./keystone
Starting the RAX-KEY extension
Starting the Legacy Authentication component
Service API listening on 0.0.0.0:5000
Admin API listening on 0.0.0.0:35357

 

开启另一个控制台终端

edit the ~/keystone/keystone/test/sampledata.py file,这个脚本是keystone-manage向keystone添加user,token及服务等,根据实际情况作相应修改

 In another window, edit the ​​~/keystone/keystone/test/sampledata.py​​​ file, find the ​​swift.publicinternets.com​​​ text and replace it with the URL to your Swift cluster using the following format (note that we're going to change Swift to run on port 8888 later):​​http://127.0.0.1:8888/v1/AUTH_%tenant_id%​

Create the sample data entries:
$ cd ~/keystone/bin && ./sampledata

 这一步是调用执行上面的sampledata.py文件,在keystone中进行注册。

$ 多次运行sampledata会报错,那是因为数据库已经有先运行保留的数据原因,你应该删除数据库的记录,默认是sqlite3的话,你可以直接删除keystone.db这个文件
如果是mysql,可以
mysql -uroot -p123456 -e 'DROP DATABASE IF EXISTS keystone;'
mysql -uroot -p123456 -e 'CREATE DATABASE keystone;'

Reconfigure Swift's proxy server to use Keystone instead of TempAuth. Here's an example ​​/etc/swift/proxy-server.conf​​:

[DEFAULT]
bind_port = 8888
user = root

[pipeline:main]
pipeline = catch_errors cache keystone proxy-server

[app:proxy-server]
use = egg:swift#proxy
account_autocreate = true

[filter:keystone]
use = egg:keystone#tokenauth
auth_protocol = http
auth_host = 127.0.0.1
auth_port = 35357
admin_token = 999888777666
delay_auth_decision = 0
service_protocol = http
service_host = 127.0.0.1
service_port = 5000
service_pass = dTpw

[filter:cache]
use = egg:swift#memcache
set log_name = cache

[filter:catch_errors]
use = egg:swift#catch_errors

 

$ swift-init main start

 

Joeuser用户已经在运行./sampledata 时生成
$ swift -A http://127.0.0.1:5000/v1.0 -U joeuser -K secrete post container
$ swift -A http://127.0.0.1:5000/v1.0 -U joeuser -K secrete stat -v
StorageURL: http://127.0.0.1:8888/v1/AUTH_1234
Auth Token: 74ce1b05-e839-43b7-bd76-85ef178726c3
Account: AUTH_1234
Containers: 1
Objects: 0
Bytes: 0
Accept-Ranges: bytes
X-Trans-Id: tx25c1a6969d8f4372b63912f411de3c3b

 

 想手动添加用户,可以使用keystone-manage命令,具体参考

​http://keystone.openstack.org/man/keystone-manage.html​

OpenStack Dashboard 安装

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

 

cd openstack-dashboard/openstack-dashboard
cp local/local_settings.py.example local/local_settings.py

 

vim local/local_settings.py
# FIXME: This needs to be changed to allow for multi-node setup.
OPENSTACK_KEYSTONE_URL = "http://localhost:5000/v2.0/"
OPENSTACK_KEYSTONE_ADMIN_URL = "http://localhost:35357/v2.0"
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "Member"

# NOTE(tres): Available services should come from the service
# catalog in Keystone.
SWIFT_ENABLED = True

 

Install Horizon

 

$ apt-get install -y python-setuptools 
$ sudo easy_install virtualenv
$ python tools/install_venv.py

Installing the virtual environment will take some time depending on download speeds.

 

Run Horizon

启动dashboard的web服务
tools/with_venv.sh dashboard/manage.py runserver 0.0.0.0:8000

 

成功后可以在浏览器输入:​​http://dashboardhost:8000/​​ 进入登入界面

 

可选如果出现dashboard登入不了的情况,则可以选择数据同步

tools/with_venv.sh dashboard/manage.py syncdb

 

赠人玫瑰
手留余香

我们曾如此渴望命运的波澜,到最后才发现:人生最曼妙的风景,竟是内心的淡定与从容……我们曾如此期盼外界的认可,到最后才知道:世界是自己的,与他人毫无关系!-杨绛先生