CloudFoundry in 1 Box简介:PCF-Dev篇
admin
2023-02-15 21:40:03
0

Pivotal Web Service主管工程师 产品经理 吴疆


在《CloudFoundry in 1 Box简介:Bosh-lite篇》我们介绍了Bosh-lite的架构和部署。在本篇中,我们将详细描述另一个CloudFoundry in 1 Box解决方案PCF-Dev。


1. PCF-dev简介

PCF是Pivotal发行的Cloud Foundry商业版,PCF-Dev原名MicroPCF,是Pivotal为PCF的应用开发人员准备的一款App单虚拟机版的CloudFoundry。但是,麻雀虽小,五脏俱全。PCF-Dev虽然可以在仅仅一台虚拟式上即可运行,但是却包含了cloud foundry完整的技术栈。下图展示了PCF-Dev的架构


CloudFoundry in 1 Box简介:PCF-Dev篇


在PCF-Dev中,除了包含了完整的Cloud Foundry,还包含了下列Cloud Foundry Service


  • MySQL

  • Redis

  • RabbitMQ


和一系列Buildpack


  • Java

  • Ruby

  • Python

  • Golang

  • Static file

  • Binary


PCF-Dev不仅功能强大,使用起来却是异常简便。下面我们就来一步一步搭建一个PCF-Dev环境。


2. 环境准备


笔者采用的事Cent OS 7.2作为宿主机的操作系统,VirtualBox为虚拟机平台


2.1 安装以来的软件包

# rpm -Uvh http://mirror.pnl.gov/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
# yum install -y vim git screen kernel* libX11 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 安装Ruby环境


笔者使用rbenv来安装和管理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安装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


验证vagrant

# vagrant --version
Vagrant 1.8.1


2.4 安装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/
# rpm -Uvh VirtualBox-5.0-5.0.16_105871_el7-1.x86_64.rpm


验证virtualbox是否安装成功

# VBoxManage --version
5.0.16r105871


3. 部署PCF-Dev


3.1 从pivotal network下载PcF-dev


CloudFoundry in 1 Box简介:PCF-Dev篇


Pivotal Network地址:http://network.pivotal.io


3.2 解压pcf-dev


3.3 启动pcf-dev

# cd 
# ./start-osx #在linux也可以正常工作


3.4 查看PCF-dev component

# cd 
# vagrant ssh ##登陆pcf-dev虚拟机

# 登陆之后的pcf-dev虚拟机
$ sudo -i
# monit summary
root@agent-id-pcfdev-0:~# monit summary
The Monit daemon 5.2.5 uptime: 14m

Process 'consul_agent'              running
Process 'cloud_controller_clock'    running
Process 'cloud_controller_ng'       running
Process 'cloud_controller_worker_local_1' running
Process 'cloud_controller_worker_local_2' running
Process 'nginx_cc'                  running
Process 'cloud_controller_migration' running
Process 'cloud_controller_worker_1' running
Process 'doppler'                   running
Process 'gorouter'                  running
Process 'loggregator_trafficcontroller' running
Process 'metron_agent'              running
Process 'nats'                      running
Process 'postgres'                  running
Process 'route_registrar'           running
Process 'routing-api'               running
Process 'uaa'                       running
Process 'etcd'                      running
Process 'garden'                    running
Process 'auctioneer'                running
Process 'bbs'                       running
Process 'cc_uploader'               running
Process 'converger'                 running
Process 'file_server'               running
Process 'nsync_listener'            running
Process 'nsync_bulker'              running
Process 'rep'                       running
Process 'route_emitter'             running
Process 'ssh_proxy'                 running
Process 'stager'                    running
Process 'tps_listener'              running
Process 'tps_watcher'               running
Process 'syslog-configurator'       running
Process 'process-watcher'           running
Process 'cf-redis-broker'           running
Process 'broker-nginx'              running
Process 'cf-redis-route-registrar'  running
Process 'cf-mysql-broker'           running
Process 'cf-mysql-route-registrar'  running
Process 'quota-enforcer'            running
Process 'mariadb_ctrl'              running
Process 'galera-healthcheck'        running
Process 'gra-log-purger-executable' running
Process 'rabbitmq-broker'           running
Process 'rabbitmq-broker-route-registrar' running
Process 'rabbitmq-management-route-registrar' running
Process 'rabbitmq-server'           running
System 'system_localhost'           running


启动后的PCF-Dev虚拟机配置了两块网卡,一块用来连接CloudFoundry网络,使用10.0.2.15/24;一块用来和宿主机通信,使用IP 192.168.11.11

如果设有http https proxy,需要执行如下步骤

export no_proxy=192.168.11.11,local.pcfdev.io


至此,PCF-Dev环境准备完毕。


4. 部署app到PCF-Dev


4.1 安装CF CLI

#rpm -Uvh https://s3.amazonaws.com/go-cli/releases/v6.16.1/cf-cli-installer_6.16.1_x86-64.rpm


4.2 cf target


PCF-Dev默认的域名为local.pcfdev.io, *.local.pcfdev.io会被解析到192.168.11.11

# ping xyz.local.pcfdev.io
PING xyz.local.pcfdev.io (192.168.11.11) 56(84) bytes of data.
64 bytes from 192.168.11.11: icmp_seq=1 ttl=64 time=0.818 ms
64 bytes from 192.168.11.11: icmp_seq=2 ttl=64 time=1.45 ms
64 bytes from 192.168.11.11: icmp_seq=3 ttl=64 time=1.33 ms
64 bytes from 192.168.11.11: icmp_seq=4 ttl=64 time=1.69 ms
64 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 4006ms
rtt min/avg/max/mdev = 0.818/1.311/1.696/0.292 ms
# cf api https://api.local.pcfdev.io --skip-ssl-validation
Setting api endpoint to api.local.pcfdev.io...
OK


API endpoint:   https://api.local.pcfdev.io (API version: 2.51.0)
Not logged in. Use 'cf login' to log in.
# cf login  ##username/password are admin/admin
API endpoint: https://api.local.pcfdev.io

Email> admin

Password>
Authenticating...
OK

Targeted org pcfdev-org

Targeted space pcfdev-space

API endpoint:   https://api.local.pcfdev.io (API version: 2.51.0)
User:           admin
Org:            pcfdev-org
Space:          pcfdev-space


4.3 部署App

# cd 
# cf push



CloudFoundry in 1 Box简介:PCF-Dev篇

相关内容

热门资讯

神龙拜耳光伏有限公司生产支架 光伏支架,到底“支”起了什么? 提到光伏电站,很多人第一反应是那一块块深蓝色的电池板。但真正让这些电...
食品级制冰袋厂家选型指南:上海... 导语:在餐饮、物流、医药等行业中,制冰袋作为低温保鲜的核心耗材,其性能稳定性直接影响产品品质与运营效...
南通崇川发放首笔“算力券”补贴 购买、领券、付款……近日,随着在南通市公共算力服务平台算力超市完成中国移动算力服务的租用下单操作,江...
百万上下文之后,拼什么? 文 | 科技不许冷 过去几天,科技圈的视线全被DeepSeek吸走了。 满屏都是传闻中的估值溢价,...
成语之都 好玩邯郸丨邯山区AI... (来源:邯郸新闻网) 转自:邯郸新闻网 近日,在邯山区科技创新产业园内的邯郸人工智能教育基地,一拨拨...
量子计算机联手超级计算机,创下... 5 月 5 日消息,量子计算机最具前景的应用方向之一是模拟蛋白质,助力人类研发新药,但目前这类设备误...
我国新一代人工智能技术加速落地... 2026 年 5 月 5 日,工信部、科技部、国家网信办联合发布《人工智能产业高质量发展行动计划(2...
老黄可能开始焦虑了 文 | 象先志 2026年4月15日,黄仁勋在Dwarkesh Patel 的播客里经历了一场他很...
俄外长与美国务卿通话,讨论双边... △鲁比奥(左)与拉夫罗夫(右)当地时间5月5日,据俄罗斯外交部消息,俄罗斯外长拉夫罗夫与美国国务卿鲁...
即使中东冲突今天停止,欧盟在未... 新华社布鲁塞尔5月5日电(记者康逸)欧盟能源委员丹·约根森5日警告说,由于伊朗战事以及霍尔木兹海峡遭...