Pivotal Web Service Supervisor Engineer Product Manager Wu Jian
When it comes to cloud computing services, it's common to think that in a machine-roaring data center, each rack is arranged together, a server is working nervously, and it seems that building a cloud computing environment requires many powerful servers. But in fact, both OpenStack, which provides IAAS services, or cloudfoundry that provide PAAs services, can be installed on a single computer or even on a single virtual machine.
0. Why a stand-alone cloud platform is required
Whether IaaS or PAAs, the cloud Platform's primary design objective is to abstract and virtualize system resources to provide computing resources on demand for multiple customers. Therefore, in our impression, the cloud platform should be a powerful platform that contains many system resources. So why do we need a single-chip cloud platform?
First, the single version of the cloud platform installation simple deployment, easy to learn and research enthusiasts. In the process of learning and evaluating the cloud platform, we generally do not need a clustered version of OpenStack or cloud Foundry. We all want to be able to build a cloud platform with the fastest and least amount of resources, and then immediately start the test box verification function.
Second, a stand-alone cloud platform can be used for cloud application development and testing. In the process of developing the cloud application, if each modification should deploy the application to the remote cloud platform, one is slower and the other is inconvenient to debug. Therefore, a locally deployed cloud platform with minimal functionality is ideal for developing and debugging cloud applications during the development phase.
Therefore, as an open source PAAs platform, Cloud Foundry offers multiple stand-alone deployment scenarios, including Bosh-lite, Lattice, micropcf.
This article describes the use of the Bosh-lite project to build a standalone version of the Cloudfoundry learning environment
1. Bosh-lite Introduction
Bosh is a cloud Platform configuration management tool developed by the Cloud Foundry Foundation for deploying and Upgrading cloud foundry and cloud foundry, as described in Http://bosh.io. As the name implies, Bosh-lite is a lite version of Bosh, an open source project developed by the Cloudfoundry team that can deploy Bosh+cloudfoundry on a virtual machine, primarily to help developers build a cloudfoundry local development environment , can also help cloudfoundry enthusiasts to learn cloudfundry.
Bosh-lite currently supports only Mac OS X and Linux systems. Bosh-lite uses vagrant to manage virtual machines, so only VirtualBox and VMware Fusion (MAC OS X) virtual machine platforms are currently supported.
As shown, the Bosh client CLI runs on the host OS, and with the Bosh CLI, we can deploy the component of Bosh and cloud foundry on VirtualBox virtual machines. Each component of Bosh and Cloudfoundry, such as Uaa,router, is run in the Garden container (garden Container).
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7E/FE/wKioL1cPVkjDUSu7AAGZc53s8eI708.jpg "title=" Bosh-lite.jpg "alt=" Wkiol1cpvkjdusu7aagzc53s8ei708.jpg "/>
2. Environmental preparedness
I used the thing cent OS 7.2 as the host operating system, VirtualBox for the virtual machine platform
2.1 Packages since the installation
# RPM-UVH http://mirror.pnl.gov/epel/7/x86_64/e/epel-release-7-5.noarch.rpm# Yum install-y vim git screen kernel* libX1 1 qt SDL sdl-devel libxml2-devel libvpx libpng libxt libxmu libxslt libxslt-devel OpenSSL \ Openssl-devel libxcursor libxinerama qt qt-devel wget gcc unzip ntpdate net-tools
2.2 Installing the Ruby Environment
I use rbenv to install and manage Ruby
# git clone git://github.com/sstephenson/rbenv.git $HOME/.rbenv
# git clone https://github.com/sstephenson/ruby-build.git $HOME/.rbenv/plugins/ruby-build
# echo ‘export PATH="$HOME/.rbenv/bin:$PATH"‘ >> ~/.bash_profile
# echo ‘eval "$(rbenv init -)"‘ >> ~/.bash_profile
# source ~/.bash_profile
# rbenv install 2.3.0
rbenv global 2.1.3
# gem install bundle
# gem install nokogiri — --use-system-libraries
2.3 Installing vagrant
# wget https://releases.hashicorp.com/vagrant/1.8.1/vagrant_1.8.1_x86_64.rpm
# rpm -Uvh vagrant_1.8.1_x86_64.rpm
Verify vagrant
# vagrant --version
Vagrant 1.8.1
2.4 Installing VirtualBox
# wget http://download.virtualbox.org/virtualbox/5.0.16/VirtualBox-5.0-5.0.16_105871_el7-1.x86_64.rpm
# #安装virtualbox时需要linux kernel的源代码,设置KERN_DIR环境变量指示kernel源代码路径
# export KERN_DIR=/usr/src/kernels/<your kernel dir>
VirtualBox-5.0-5.0.16_105871_el7-1.x86_64.rpm
Verify that the VirtualBox is installed successfully
# VBoxManage --version
5.0.16r105871
3. Preparing the Bosh-lite Environment 3.1 installing the Bosh CLI
# Gem Install Bosh_cli
3.2 Installing the manifest Merge tool
Spiff is a tool developed by the Cloud Foundry Foundation to consolidate Bosh deployment files, as detailed in Https://github.com/cloudfoundry-incubator/spiff
# wget # unzip spiff_linux_amd64.zip-d/usr/bin
3.3 Checkout Bosh-lite and Cf-release
# #bosh-lite and cf-release These two code libraries must be placed in the same level directory # mkdir ~/workspace# git clone https://github.com/cloudfoundry/cf-release
3.4 Starting the VirtualBox virtual machine
# cd ~/workspace/bosh-lite# vagrant up --provider=virtualbox# # After successful startup, you can run the following command to view the status of the virtual machine # vagrant global-statusid name provider state Directory------------------------------------------------------------------------0e3f85a default virtualbox running /root/workspace/bosh-liteThe above shows information About all known vagrant environmentson this machine. this data is cached and may not be completelyup-to-date. to interact with any of the machines, you can go tothat directory and run vagrant, or you can use the id directlywith vagrant Commands from any directory. for example: "Vagrant destRoy 1a2b3c4d "
After booting the Bosh-lite virtual machine is configured with two network cards, a piece used to connect the Cloudfoundry network, using 10.244.0.0/19, a block to communicate with the host, using IP 192.168.50.4, So the host needs to add a route to access the Cloudfoundry network
# route add-net 10.244.0.0/19 GW 192.168.50.4# # If you have configured HTTP or HTTPS proxies, run the following command first
At this point, an ultra-miniature Bosh environment-bosh-lite environment is ready to complete.
4. Deploy CloudFoundry4.1 Build Cloudfoundry Deployment Profile
Deploy cloud Foundry first need to select a domain name, such as xyz.com, and need to *.xyz.com all to the same IP address, in order to facilitate the use of Bosh-lite, Cloud Foundry provides a default domain name, Bosh-lite.com, and unified resolution to 10.244.0.34
# ping Ping (10.244.0.34): Data bytesrequest timeout for icmp_seq 0Request timeout for icmp_seq 1^c---ping statistic s---3 packets transmitted, 0 packets received, 100.0% packet loss# ping xyz.bosh-lite.comping xyz.bosh-lite.com (10.244.0 ): Bytesrequest timeout for icmp_seq 0Request timeout for icmp_seq 1^c---xyz.bosh-lite.com ping statistics--- 3 packets transmitted, 0 packets received, 100.0% packet loss
Generate a deployment description file (deployment manifest)
# cd ~/workspace/cf-release# # Download all sub-modules (submodule) #./scripts/update# # Generate Deployment Profile #./scripts/ Generate-bosh-lite-dev-manifest
4.2 Upload Stemcell
Stemcell is a unique concept in Bosh, similar to virtual machine mirroring, where you need to use Bosh to upload Stemcell for the appropriate platform before deploying cloud foundry. All Stemcell can be found in http://bosh.io/stemcells.
# wget Bosh target 192.168.50.4 lite# Bosh upload Stemcell
4.3 Upload cloud Foundry Release
Release is also an important concept in Bosh, which is a collection of all the files that need to be deployed, including binaries and configuration files. The release file for Cloud foundry can also be downloaded from http://bosh.io/releases/github.com/cloudfoundry/cf-release?all=1
# wget # bosh upload release cf-release-234.tgz
4.4 Deployment of Cloud Foundry
# Bosh Deploy
5. Verifying Cloud Foundry Deployment
# bosh vms deployment ' Cf-warden ' director task 9 task 9 done +------------------------------------+--- ------+---------------+--------------+ | job/index | State | Resource Pool | IPs | +------------------------------------+---------+---------------+--- -----------+ | api_z1/0 | running | large_z1 | 10.244.0.134 | | etcd_z1/ 0 | running | medium_z1 | 10.244.0.42 | | ha_proxy_z1/0 | running | router_z1 | 10.244.0.34 | | hm9000_z1/0 | running | medium_z1 | 10.244.0.138 | | loggregator_trafficcontroller_z1/0 | running | small_z1 | 10.244.0.146 | | loggregator_z1/0 | running | medium_z1 | 10.244.0.142 | | nats_z1/0 | running | medium_z1 | 10.244.0.6 | | postgres_z1/0 | running | medium_z1 | 10.244.0.30 | | router_z1/0 | running | router_z1 | 10.244.0.22 | | runner_z1/0 | running | runner_z1 | 10.244.0.26 | | uaa_z1/0 | running | medium_z1 | 10.244.0.130 | +------ ------------------------------+---------+---------------+--------------+ vms total : 11
Cloudfoundry in 1 box introduction: Bosh-lite