本文共 2114 字,大约阅读时间需要 7 分钟。
Openstack Developer 应该都知道, 开发一个 Openstack 的新项目并不是一个从 0 到 1 的过程, 而是在一个 Project Template 的框架中, 为其填充 API/DB/Manager 等代码定义和实现. 一般来说, 搭建这个 Template 框架并不困难, 只是太过繁琐. 本篇推荐的开源小项目, 可以非常帮助我们完成这些繁琐的工作, 用法也很简单. 如果大家能帮忙提交 BUG 的话, 我会非常欢迎和感谢 .
git clone https://github.com/JmilkFan/openstack-project-generator.git
<new_manager_service_name> <new_project_name>
不能同名cd openstack-project-generator./generate.sh -m# EG:./generate.sh -m promanager proname /opt/stack
cp -pr /opt/stack/openstack-project-generator/.git /opt/stack/proname
sudo pip install -r /opt/stack/proname/requirements.txt -e .
mkdir /etc/pronamecd /opt/stack/proname/etc/proname/sudo cp proname.conf.sample /etc/proname/proname.confsudo cp api-httpd.conf api-paste.ini logging_sample.conf policy.json rootwrap.conf /etc/proname
[database]connection=mysql+pymysql://{username}:{password}@{mysql_ip}/pronname?charset=utf8[default]my_ip=127.0.0.1rabbit_port=5672rabbit_userid = stackrabbitrabbit_password = {rabbit_password}rabbit_hosts = {rabbit_hosts_ip}osapi_proname_listen=0.0.0.0osapi_proname_listen_port=8848auth_strategy=keystone debug = Trueverbose = True[keystone_authtoken]admin_password = {password}admin_user = novaadmin_tenant_name = serviceidentity_uri = http://{keystone_ip}:35357auth_protocol = httpauth_port = 35357auth_host = {keystone_host_ip}
cd /opt/stack/pronametox -e genconfig tox -e pep8 tox -e py27
# 保证 proname 数据库下的所有表的编码集都是 utf8CREATE DATABASE proname CHARACTER SET utf8;GRANT ALL ON proname.* TO 'proname'@'%' IDENTIFIED BY 'password';GRANT ALL ON proname.* TO 'proname'@'127.0.0.1' IDENTIFIED BY 'password';GRANT ALL ON proname.* TO 'proname'@'localhost' IDENTIFIED BY 'password';
proname-manage db_sync
proname-api --config-file /etc/proname/proname.conf
到此为止, 新项目的服务就部署完成了, 赶紧撸代码吧 : )
转载地址:http://qnkzl.baihongyu.com/