Cloudfoundry in 1 box introduction: Lattice

Source: Internet
Author: User

Pivotal Web Service Supervisor Engineer Product Manager Wu Jian


This is the last of the Cloudfoundry in 1 box Introduction series, and in two previous articles, we introduced the architecture and deployment of Bosh-lite and Pcf-dev. In this article, we will describe in detail another cloudfoundry in 1 box solution lattice.


1. Lattice Introduction


Lattice is an interesting project designed to provide the developer of Cloud Foundry with a minimal app runtime environment, so it only selects the components associated with the app run in Cloud Foundry, which makes up the most streamlined development test cloud The Foundry app environment.

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7F/71/wKiom1ce0-OghM03AAzQuwBRpM0849.png "title=" screen Shot 2016-04-20 at 21.19.44.png "alt=" Wkiom1ce0-oghm03aazquwbrpm0849.png "/>


As shown, the lattice contains only the following components


    • Router: Routing that is responsible for accessing app requests

    • Diego:cloud Foundry App Run-time environment

    • Blob Store:app Staging storage space

    • Loggregator:log Server for app developers to view app runtime logs


Let's build a lattice environment in one step.


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--versionvagrant 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# # Linux kernel source code is required to install VirtualBox, set KERN_DIR environment variable to indicate kernel source code path # export Kern_dir=/usr/src/kernels/<your kernel DIR ># RPM-UVH virtualbox-5.0-5.0.16_105871_el7-1.x86_64.rpm


Verify that the VirtualBox is installed successfully


# Vboxmanage--version5.0.16r105871


3. Deploying lattice


3.1 Downloading the latest lattice release from GitHub


# wget Https://github.com/cloudfoundry-incubator/lattice-release/releases/latest


3.2 Decompression Lattice


# Gunzip Lattice-bundle-<version>.zip


3.3 Start lattice


# cd <lattice>/vagrant# vagrant up--provider=virtualbox


3.4 Views Pcf-dev Component


# cd <lattice>/vagrant# vagrant ssh # #登陆pcf-dev virtual machine Pcf-dev virtual machine $  after login #  sudo -i# monit summary[email protected]:~# monit summarythe monit  daemon 5.2.4 uptime: 17mprocess  ' Auctioneer '                  runningProcess  ' receptor '                    runningProcess  ' BBS '                         runningProcess  ' Converger '                   runningProcess  ' File_server '                 runningProcess  ' Route_emitter '              runningprocess  ' Ssh_proxy '                   runningProcess  ' rep '                          runningProcess  ' rootfses '                    runningProcess  ' Garden '                      runningFile  ' Haproxy_config '                 accessibleprocess  ' Haproxy '                     runningProcess  ' Router_configurer '           runningprocess  ' Tcp_emitter '                 runningProcess  ' Routing-api '                 runningProcess  ' Consul_agent '                runningProcess  ' Doppler '                     runningProcess  ' Gorouter '                     runningprocess  ' Loggregator_trafficcontroller '  runningProcess  ' metron_agent '                runningProcess  ' Nats '                         runningProcess  ' Route_regisTrar '            runningProcess  ' Etcd '                         runningSystem  ' system_lattice-colocated-0 '  running


The lattice virtual machine is configured with two NICs, one for connecting the Cloudfoundry network, using 10.0.2.15/24, and one for communicating with the host, using IP 192.168.11.11. Lattice the default domain name is LOCAL.LATTICE.CF

If you have a HTTP/HTTPS proxy, you need to perform the following steps


Export NO_PROXY=192.168.11.11,LOCAL.LATTICE.CF


At this point, lattice environment is ready to complete.


4. Deploy app to lattice


4.1 Installing the Lattice CLI


# Curl-o http://receptor.local.lattice.cf/v1/sync/linux/ltc# chmod +x LTC


4.2 Lattice Target


Lattice the default domain name is LOCAL.LATTICE.CF, *.LOCAL.LATTICE.CF will be parsed to 192.168.11.11


# ping xyz.local.lattice.cfping xyz.local.pcfdev.io  ( 192.168.11.11)  56 (+)  bytes of data.64 bytes from 192.168.11.11: icmp_ Seq=1 ttl=64 time=0.818 ms64 bytes from 192.168.11.11: icmp_seq=2 ttl= 64 time=1.45 ms64 bytes from 192.168.11.11: icmp_seq=3 ttl=64 time= 1.33 ms64 bytes from 192.168.11.11: icmp_seq=4 ttl=64 time=1.69 ms64  bytes from 192.168.11.11: icmp_seq=5 ttl=64 time=1.25 ms^c---  xyz.local.pcfdev.io ping statistics ---5 packets transmitted, 5 received,  0% packet loss, time 4006msrtt min/avg/max/mdev = 0.818/1.311/1.696/ 0.292 ms 
# lattice target Local.pcfdev.ioAPI location set.


4.3 Deployment of Apps


Because the lattice environment contains only the smallest environment that runs the cloud Foundry app and does not contain any buildpack, it takes two steps to run the cloud Foundry app using lattice.


    1. Build Cloud Foundry droplet, in this step, you need to display the specified Buildpack, in the case of Ruby app


# ltc build-droplet helloruby https://github.com/cloudfoundry/ruby-buildpackuploading  application bits ... Uploaded.submitted build of helloruby04/20 22:30:00.57 [build|0] successfully  created container04/20 22:30:06.20 [droplet|0] deleted http://local.lattice.cf :8444/blobs/helloruby-bits.zip.04/20 22:30:06.22 [droplet|0] exit status 004/20  22:30:06.39 [build|0] exit status 004/20 22:30:27.50 [build|0] ------->  Buildpack version 1.6.1604/20 22:30:27.68 [BUILD|0]         downloaded [https://pivotal-buildpacks.s3.amazonaws.com/ruby/binaries/shared/ bundler-1.11.2.tgz]04/20 22:30:31.68 [build|0] -----&GT;&NBSP;COMPILING&NBSP;RUBY/RACK04/20  22:30:32.38 [build|0]        downloaded [https:// Pivotal-builDPACKS.S3.AMAZONAWS.COM/CONCOURSE-BINARIES/RUBY/RUBY-2.3.0-LINUX-X64.TGZ]04/20&NBSP;22:31:07.03&NBSP;[BUILD|0]  -----> using ruby version: ruby-2.3.004/20 22:31:07.48 [build|0] # ##### warning:04/20 22:31:07.48 [build|0]        remove  the  '. bundle/'  folder from your repo and add it to  your  '. Gitignore '  file.04/20 22:31:07.48 [BUILD|0]         You have the  '. Bundle/config '  file checked into your  repository04/20 22:31:07.48 [build|0]        https:// devcenter.heroku.com/articles/bundler-configuration04/20 22:31:07.48 [build|0]         it contains local state like the location of  the installed bundLe04/20 22:31:07.48 [build|0]        as well as  configured git local gems, and other settings that should04/20  22:31:07.48 [BUILD|0] -----> installing dependencies using bundler  1.11.204/20 22:31:07.48 [build|0]        not be  shared between multiple checkouts of a single repo. please04/20  22:31:08.27 [build|0]        downloaded [https:// pivotal-buildpacks.s3.amazonaws.com/ruby/binaries/cflinuxfs2/libyaml-0.1.6.tgz]04/20 22:31:11.03 [ build|0]        running: bundle install --without  development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 -- deployment04/20 22:31:14.33  [Build|0]        fetching gem metadata from https ://ruby.taobao.org/.... 04/20 22:31:14.63 [build|0]        fetching version  metadata from https://ruby.taobao.org/. 04/20 22:31:15.49 [build|0]        installing kgio  2.9.2 with native extensions04/20 22:31:15.63 [BUILD|0]         Installing rake 10.4.204/20 22:31:15.82 [BUILD|0]         Installing rack 1.6.004/20 22:31:17.23 [BUILD|0]         Installing raindrops 0.13.0 with native  Extensions04/20 22:31:17.40 [build|0]        installing  rdiscount 2.1.7.1 with native extensiOns04/20 22:31:54.47 [build|0]        installing tilt  1.4.104/20 22:31:54.77 [BUILD|0]        Using  bundler 1.11.204/20 22:31:55.19 [build|0]         installing rack-protection 1.5.304/20 22:31:56.16 [build|0]         Installing sinatra 1.4.504/20 22:32:38.00 [BUILD|0]         bundle complete! 7 gemfile dependencies, 10 gems  now installed.04/20 22:32:38.00 [BUILD|0]         Gems in the groups development and test were not installed.04/20  22:32:38.00 [build|0]        bundled gems are  installed into ./vendor/bundle.04/20 22:32:38.04 [build|0]        bundle  completed  (87.00s) 04/20 22:32:38.06 [build|0]         Cleaning up the bundler cache.04/20 22:32:40.00 [BUILD|0] ----->  writing config/database.yml to read from database_url04/20 22:32:41.31  [BUILD|0] ###### WARNING:04/20 22:32:41.31 [BUILD|0]         You have the  '. Bundle/config '  file checked into your  repository04/20 22:32:41.31 [BUILD|0]        It  contains local state like the location of the installed bundle04/ 20 22:32:41.31 [build|0]        as well as  Configured git local gems, and other settings that should04/20 22:32:41.31 [build|0]         not be shared between multiple checkouts  of a single repo. Please04/20 22:32:41.31 [BUILD|0]         remove the  '. bundle/'  folder from your repo  and add it to your  '. Gitignore '  file.04/20 22:32:41.31 [BUILD|0]         https://devcenter.heroku.com/articles/bundler-configuration04/20  22:32:58.50 [BUILD|0] Exit status 004/20 22:32:59.45 [DROPLET|0]  uploaded /tmp/droplet to http://local.lattice.cf:8444/blobs/helloruby-droplet.tgz.04/20  22:32:59.49 [droplet|0] exit status 0# tc list-dropletsdroplet         created at        sizehelloruby    04/20  14:32:59.00    20.3m


2. Start droplet


# ltc launch-droplet helloruby hellorubyno port specified. defaulting  to 8080.creating app: helloruby.04/20 22:37:00.15 [app|0] creating  Container.04/20 22:37:01.77 [app|0] successfully created container ........ 04/20&NBSP;22:37:16.10&NBSP;[HEALTH|0]&NBSP;HEALTHCHECK&NBSP;FAILED04/20&NBSP;22:37:16.14&NBSP;[HEALTH|0]  exit status 104/20 22:37:16.56 [ssh|0] {"timestamp": "1461163036.562246799", " SOURCE ":" sshd "," message ":" Sshd.started "," Log_level ": 1," Data ":{}}04/20 22:37:16.81 [health|0]  healthcheck failed04/20 22:37:16.83 [health|0] exit status 1.04/20  22:37:17.54 [health|0] healthcheck failed04/20 22:37:17.57 [health|0] exit  status 1.04/20 22:37:18.04 [app|0] i, [2016-04-20t14:37:18.041860  #10]   info -- : refreshing&nbsP gem list04/20 22:37:18.26 [app|0] i, [2016-04-20t14:37:18.253960  #10]   info -- : listening on addr=0.0.0.0:8080 fd=904/20 22:37:18.27 [ app|0] i, [2016-04-20t14:37:18.266758  #10]  info -- : master  process ready04/20 22:37:18.27 [health|0] healthcheck passed04/20 22:37:18.31  [APP|0] I, [2016-04-20T14:37:18.280764  #43]  info -- : worker=0  ready04/20 22:37:18.32 [APP|0] I, [2016-04-20T14:37:18.284959  #49]   info -- : worker=2 ready04/20 22:37:18.33 [app|0] i, [2016-04-20t14 :37:18.305195  #46]  info -- : worker=1 ready04/20 22:37:18.35 [ Health|0] exit status 0helloruby is now running. App is reachable at:http://helloruby.local.lAttice.cfhttp://helloruby-8080.local.lattice.cf 


Ruby app launches successfully with HTTP://HELLORUBY.LOCAL.LATTICE.CF access to apps


This article is from the "11152618" blog, please be sure to keep this source http://11162618.blog.51cto.com/11152618/1767884

Cloudfoundry in 1 box introduction: Lattice

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.