Building you own robust cloud platform with CloudFoundry and OpenStack

PaaS 概念近年来在国内是越来越火了,随着OpenStack 的日渐成熟,无论是在企业级抑或是创业公司来说其普及率越来越高,似乎再考虑搭建云平台时不将OpenStack 考虑在那觉得有些out的感觉。Mesos on top of OpenStack、 K8S on top of OpenStack, 以及自研的产品 on top of OpenStack,... 似乎OpenStack 这一开源领域的os 的说法越来越多的被这些案例所证实。但真的是这样么?在其它的分享中会再谈下我自己的看法。
此博客(可以说是一系列)初衷是将我近年来在OpenStack 以及CloudFoundry 所做的事做个总结,也为那些在PaaS产品选型以及在PaaS 这条路上刚入门的同学一些指导,如何通过这2个开源产品构建一个Out of Box 的Platform以及解决在使用过程中遇到的一些坑

  • 平台初见 --- Hello, World

平台初见 --- Hello, World

'Hello, World' -- 对于每一个干IT的人来说并不陌生,让我们看下在PaaS里面的HelloWorld 是什么样的。

  1. 如果你是刚刚接触PaaS的童鞋, 对PaaS 可能会很陌生,究竟它有什么特点,我怎么用呢?
# ubuntu at lazybox in ~/html [8:09:36]
→ echo "Hello, World" > index.html

# ubuntu at lazybox in ~/html [8:09:45]
→ touch Procfile

# ubuntu at lazybox in ~/html [8:19:31]
→ ls
index.html  Procfile
# ubuntu at lazybox in ~/html [8:19:42]
→ cf p index
Creating app index in org system / space dev as admin...
OK

Creating route index.cf.cloud...
OK

Binding index.cf.cloud to index...
OK

Uploading index...
Uploading app files from: /home/ubuntu/html
Uploading 270B, 2 files
Done uploading
OK

Starting app index in org system / space dev as admin...
Downloading staticfile_buildpack...
Downloading go_buildpack...
Downloading dotnet_core_buildpack...
Downloading binary_buildpack...
Downloading php_buildpack...
Downloaded staticfile_buildpack
Downloading java_buildpack...
Downloaded binary_buildpack
Downloading nodejs_buildpack...
Downloaded dotnet_core_buildpack
Downloading python_buildpack...
Downloaded go_buildpack
Downloading ruby_buildpack...
Downloaded php_buildpack
Downloaded nodejs_buildpack
Downloaded python_buildpack
Downloaded java_buildpack
Downloaded ruby_buildpack
Creating container
Successfully created container
Downloading app package...
Downloaded app package (270B)
Staging...
-----> Staticfile Buildpack version 1.4.11
-----> Installing nginx
       Using nginx version 1.13.3
-----> Installing nginx 1.13.3
       Download [https://buildpacks.cloudfoundry.org/dependencies/nginx/nginx-1.13.3-linux-x64-53917f43.tgz]
-----> Root folder /tmp/app
-----> Copying project files into public
-----> Configuring nginx
Exit status 0
Staging complete
Uploading droplet, build artifacts cache...
Uploading build artifacts cache...
Uploading droplet...
Uploaded build artifacts cache (220B)
Uploaded droplet (2.6M)
Uploading complete
Stopping instance 0aa6692c-8647-4561-9294-ae5c434c21c8
Destroying container
Successfully destroyed container

1 of 1 instances running

App started


OK

App index was started using this command `$HOME/boot.sh`

Showing health and status for app index in org system / space dev as admin...
OK

requested state: started
instances: 1/1
usage: 1G x 1 instances
urls: index.cf.cloud
last uploaded: Fri Aug 18 08:19:49 UTC 2017
stack: cflinuxfs2
buildpack: staticfile 1.4.11

     state     since                    cpu    memory       disk         details
#0   running   2017-08-18 08:20:29 AM   0.0%   3.7M of 1G   7.1M of 1G

# ubuntu at lazybox in ~/html [8:20:37]
→  curl index.cf.cloud
Hello, World

很简单, 简单的一个push 命令就可以将站点发布.

如果你想了解这和OpenStack是怎么关联起来的, 让我们看下这个

bosh-vms

没错,这些实例就构成了PaaS 平台, 你可能会疑问api,cc-bridge, blabla, ....这些都是什么啊? 没关系,这些组件在之后都会有说明.

到目前为止还没有提到OpenStack啊.
让我们看一张这个图

Bluebox power OpenStack
这张图很熟悉了吧,从这里可以看到所有创建出来的VM 信息.
再看一下网络图谱图
这里写图片描述

相信到目前为止已经对OpenStack 和CloudFoundry 有了初步的感受,再接下来的文章里,会介绍如何step-by-step搭建这样的一套云平台