How to use Bosh to deploy applications
Updated: April 23, 2018
Install bosh environment
Download Bosh binary installer
click download
Install virtulbox
wget https://download.virtualbox.org/virtualbox/5.2.10/virtualbox-5.2_5.2.10-122088~Ubuntu~trusty_amd64.deb dpkg -i virtualbox-5.2_5.2.10-122088~Ubuntu~trusty_amd64.deb
Install some dependent packages
sudo apt-get install -y build-essential zlibc zlib1g-dev ruby ruby-dev openssl libxslt-dev libxml2-dev libssl-dev libreadline6 libreadline6-dev libyaml-dev libsqlite3-dev sqlite3
Bosh deployment is recommended to guide the Director
$ git clone https://github.com/cloudfoundry/bosh-deployment ~/workspace/bosh-deployment $ mkdir -p ~/deployments/vbox $ cd ~/deployments/vbox $ bosh create-env ~/workspace/bosh-deployment/bosh.yml \ --state ./state.json \ -o ~/workspace/bosh-deployment/virtualbox/cpi.yml \ -o ~/workspace/bosh-deployment/virtualbox/outbound-network.yml \ -o ~/workspace/bosh-deployment/bosh-lite.yml \ -o ~/workspace/bosh-deployment/bosh-lite-runc.yml \ -o ~/workspace/bosh-deployment/jumpbox-user.yml \ --vars-store ./creds.yml \ -v director_name="bosh-lite" \ -v internal_ip=192.168.50.6 \ -v internal_gw=192.168.50.1 \ -v internal_cidr=192.168.50.0/24 \ -v outbound_network_name=NatNetwork
Configuration environment
$ bosh alias-env vbox -e 192.168.50.6 --ca-cert <(bosh int ./creds.yml --path /director_ssl/ca) $ export BOSH_CLIENT=admin $ export BOSH_CLIENT_SECRET=`bosh int ./creds.yml --path /admin_password`
check env
$ bosh -e vbox env Using environment '192.168.50.6' as '?' Name: ... User: admin Succeeded
add route
sudo route add -net 10.244.0.0/16 gw 192.168.50.6
Enter the deployment phase of software
Deployment resource requirements configuration
- No matter what application is deployed, cloud config is a prerequisite. When deploying an application or service, you can update the configuration update of virtual machine specifications in cloud config according to specific scenarios
- Once the cloud config is updated, the previous one will be considered expired, and the Director will apply these configurations the next time bosh deploy is performed
- The configuration of cloud config is generally defined in every application gitrepo. We can update it in the following way
$ bosh -e vbox update-cloud-config /PATH/TO/cloud-config.yml
- For different types of CPI, There are different configuration properties
Upload the basic operating system image, Stemcell
- To deploy an application, you need to prepare the operating system to run in advance, such as window/centos/ubuntu, which is generally described in the deployed application document
- It is recommended to download the required Stemcell in advance. Network transmission may lead to failure. In addition, the version update is very fast. Pay attention to the version you use
This is a chestnut:
bosh -e vbox upload-stemcell https://bosh.io/d/stemcells/bosh-warden-boshlite-ubuntu-trusty-go_agent?v=3468.17 \ --sha1 1dad6d85d6e132810439daba7ca05694cec208ab
Verification test
git clone https://github.com/concourse/concourse-bosh-deployment.git bosh -e $BOSH_ENVIRONMENT deploy -d concourse concourse.yml \ -l ../versions.yml \ --vars-store cluster-creds.yml \ -o operations/static-web.yml \ -o operations/no-auth.yml \ --var web_ip=10.244.15.2 \ --var external_url=http://10.244.15.2:8080 \ --var network_name=concourse \ --var web_vm_type=concourse \ --var db_vm_type=concourse \ --var db_persistent_disk_type=db \ --var worker_vm_type=concourse \ --var deployment_name=concourse fly -t ci login -c http://10.244.15.2:8080