目录
创建OpenStack镜像
配置Puppet Master
运行Stratos
Troubleshooting
以下所有软件的OS环境均为Ubuntu14.04
1. 创建OpenStack镜像
# vi /etc/apt/source.list1
删除所有官方的镜像源,添加阿里云的镜像源,并执行apt-get update。
deb http://cn.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse12345
# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime1
# cd ~# mkdir .pip# cd .pip# vim pip.conf1234
添加并保存如下内容:
[global] index-url = http://pypi.douban.com/simple [install] trusted-host = pypi.douban.com1234
sudo -iapt-get install zip unzip
mkdir -p /root/bin
cd /root/bin
wget "https://git-wip-us.apache.org/repos/asf?p=stratos.git;a=blob_plain;f=tools/config-scripts/ec2/config.sh;hb=HEAD" -O config.sh
chmod +x config.sh
wget "https://git-wip-us.apache.org/repos/asf?p=stratos.git;a=blob_plain;f=tools/init-scripts/ec2/ubuntu/init.sh;hb=HEAD" -O init.sh
chmod +x init.sh
mkdir -p /root/bin/puppetinstall
wget "https://git-wip-us.apache.org/repos/asf?p=stratos.git;a=blob_plain;f=tools/puppet3-agent/puppetinstall/puppetinstall;hb=HEAD" -O puppetinstall/puppetinstall
chmod +x puppetinstall/puppetinstall
wget "https://git-wip-us.apache.org/repos/asf?p=stratos.git;a=blob_plain;f=tools/puppet3-agent/stratos_sendinfo.rb;hb=HEAD" -O stratos_sendinfo.rb
chmod +x stratos_sendinfo.rb12345678910111213
此处需要注意最后一步,官网的步骤中没有对stratos_sendinfo.rb赋可执行权限的操作。
sed -i 's:^TIMEZONE=.*$:TIMEZONE=\"Asia/Shanghai\":g' /root/bin/puppetinstall/puppetinstall1
2. 配置Puppet Master
参考官网步骤:6. Setup Puppet Master
此处注意,需要将apache-stratos-python-cartridge-agent-4.1.5.zip文件解压后去掉4.1.5的版本号去掉后重新解压后拷贝到puppet的modules的相关目录下。
配置base.pp文件中的内容时,需要与nodes目录下的其他资源的定义相符合,比如在base.pp目录下定义
了$tomcat_version这个变量,则需要在/etc/puppet/manifests/nodes/tomcat.pp目录下的内容与之对
应,这样才能正确的文件推送。
node /tomcat/ inherits base { $tomcat_version = '8.0.36'
$docroot = "/mnt/apache-tomcat-${tomcat_version}/webapps/"
$samlalias="/mnt/apache-tomcat-${tomcat_version}/webapps/"
class {'tomcat':}
}1234567
3. 运行Stratos
{
"type": "java",
"category": "framework",
"provider": "oracle",
"host": "leaptocloud.com",
"displayName": "java",
"description": "java Cartridge",
"version": "7",
"multiTenant": true,
"portMapping": [
{
"name": "http-22",
"protocol": "http",
"port": 22,
"proxyPort": 8280
}
],
"iaasProvider": [
{
"type": "openstack",
"p_w_picpathId": "RegionOne/f8850fcb-a1a5-4288-a808-2c2a0b97adcb",
"property": [
{
"name": "instanceType",
"value": "RegionOne/2"
}
],
"networkInterfaces": [
{
"networkUuid": "84eeb7b2-82f4-478a-b768-e24d7d0544ee"
}
] }
]}1234567891011121314151617181920212223242526272829303132333435
portMapping配置需要填正确的port配置。配置错误时,会出现applicaiton无法启动的问题。
4. Troubleshooting
# nohup /mnt/apache-stratos-python-cartridge-agent-/agent.py &1
并查看nohup日志进行调试运行。