了解

什么是bosh

系统需求

仅支持 Ubuntu 10.04 LTS 64-bit image (目前也有人用 centos6 实现)

部署过程

Inception VM –> micro-bosh –> bosh –> cloudfoundry

准备

  • Inception VM 1vm
  • micro-bosh 1vm
  • bosh 8vm
  • cloudfoundry 13+ vm

请确认 openstack 各项服务正常 特别是 meta-data 服务


1. 安装 Inception VM 部署 micro-bosh

用途 (转)

  • create a custom micro BOSH stemcell
  • create an OpenStack image from the custom micro BOSH stemcell
  • run a registry of OpenStack to track provisioned components in OpenStack
  • store a registry of deployed Micro BOSHes
  • store log files of BOSH CLI interactions with each Micro BOSH

安装

使用 “Ubuntu 10.04 LTS 64-bit image” 镜像在Openstack上创建一个vm,取名 Inception VM (此vm需要能上网,可能还需要能翻墙) (也可以使用 fog http://fog.io/ 创建一个vm)

登录到 Inception VM

export ORIGUSER=ubuntu
export UBUNTU_ISO=/root/ubuntu-10.04.4-LTS-amd64.iso

上传iso到 /root 目录,此步不是必做,但能提高效率,不然需要的包都从网络取

执行初始化环境脚本

curl -s https://github.com/leftleghu/cloudfoundry/blob/master/prepare_inception_openstack.sh | bash

此脚本包含了bosh命令所需环境,具体自己看脚本吧

source /etc/profile

脚本最后的 bosh help micro , 应该会输出 bosh micro 的帮助信息,不过没输出的话,说明bug还没修补,我们可以执行:

cd /var/vcap/bootstrap/bosh/deployer
gem install pkg/bosh_deployer-1.3.1.gem

然后执行 bosh help micro ,看看是否正常输出.

配置

现在可以开始准备部署 micro-bosh,配置文件是 micro_bosh.yml

关于 Manifest 的语法可以看这里: https://github.com/panlm/doc/blob/master/documentation.md

cd /var/vcap/deployments

转到deployments目录,此目录由之前 prepare_inception_openstack.sh 创建

curl -s https://github.com/leftleghu/cloudfoundry/blob/master/create_keypair > /tmp/create_keypair
chmod 755 /tmp/create_keypair

使用脚本创建一个 inception keypair,以后方便登录使用

/tmp/create_keypair openstack OS_USERNAME OS_PASSWORD OS_TENANT_NAME OS_AUTH_URL inception

使用脚本生成 micro_bosh.yml

curl -s https://github.com/leftleghu/cloudfoundry/blob/master/create_micro_bosh_yml > /tmp/create_micro_bosh_yml
chmod 755 /tmp/create_micro_bosh_yml
/tmp/create_micro_bosh_yml microbosh-openstack openstack OS_USERNAME OS_PASSWORD OS_TENANT_NAME OS_AUTH_URL inception IP_ADDRESS PASSWORD

自定义 stemcell

cd /var/vcap/releases/bosh-release  
bosh create release --with-tarball

创建 release,结果会输出:/var/vcap/releases/bosh-release/dev_releases/bosh-x.y-dev.tgz

cd /var/vcap/bootstrap/bosh/agent
rake stemcell2:micro["openstack",/var/vcap/releases/bosh-release/micro/openstack.yml,/var/vcap/releases/bosh-release/dev_releases/bosh-x.y-dev.tgz]

创建 stemcell 这样就得到了自定义的stemcell。一切正常的话会输出:
Generated stemcell: /var/tmp/bosh/agent-x.y.z-nnnnn/work/work/micro-bosh-stemcell-openstack-x.y.z.tgz

cd /var/vcap/stemcells
cp /var/tmp/bosh/agent-x.y.z-nnnnn/work/work/micro-bosh-stemcell-openstack-x.y.z.tgz .

拷贝 stemcell 到部署目录

部署 micro-bosh

cd /var/vcap/deployments
bosh micro deployment microbosh-openstack

一切正常的话部署完毕.

bosh target http://1.2.3.4
Target set to `microbosh-openstack (http://1.2.3.4:25555) Ver: 0.6 (release:ce0274ec bosh:0d9ac4d4)'
Your username: admin
Enter password: *****
Logged in as `admin'

可以 target 到 micro-bosh ,默认验证: admin:admin

bosh status

查看部署状态

bosh micro status

查看micro-bosh状态

cd /var/vcap/deployments
tail -f microbosh-openstack/bosh_micro_deploy.log

排错检查日志

bosh micro delete

如果遇到问题,需要重建,最好通过此命令删除 micro-bosh,不要手工删除虚拟机



blog comments powered by Disqus