envrionment as a code with vagrant & chef

33
Environment as a Code with Vagrant & Chef 金明 @imingjin

Upload: mingjin

Post on 07-May-2015

1.253 views

Category:

Business


0 download

DESCRIPTION

This deck is from my sharing about Environment as a code with vagrant & chef on office internal WE-Day.

TRANSCRIPT

Page 1: Envrionment as a code with vagrant & chef

Environment as a Codewith Vagrant & Chef

金明 @imingjin

Page 2: Envrionment as a code with vagrant & chef

Scenario 1

如何满足团队需要新机器的需求?

Page 3: Envrionment as a code with vagrant & chef

Scenario 1

IS同学给我们订购一台机器,但要等半个月

IS同学给我们创建一台虚拟机,但服务器资源有限

Page 4: Envrionment as a code with vagrant & chef

Scenario 2

如何快速搭建一套完全可用的应用环境?

Page 5: Envrionment as a code with vagrant & chef

Scenario 2

团队ghost标准环境,ghost文件缺乏维护

大多数时候,团队仍然需要去做手工部署

每个人基本上都有自己的部署过程,千人千面

Page 6: Envrionment as a code with vagrant & chef

Scenario 3

如何保持团队机器上的工具与库等一致?

Page 7: Envrionment as a code with vagrant & chef

Scenario 3

各人的机器配置很快就变得面目全非

升级工具或者库,需要逐台机器进行

Page 8: Envrionment as a code with vagrant & chef

缺乏管理,环境的问题无休无止开发、测试、CI、Staging、Production⋯

Page 9: Envrionment as a code with vagrant & chef

也要做环境 配置管理

Page 10: Envrionment as a code with vagrant & chef

Scenario 1

何不试试本地的虚拟机?

如何满足团队需要新机器的需求?

Page 11: Envrionment as a code with vagrant & chef

Vagrant Sample 1

创建一台CentOS服务器

Page 12: Envrionment as a code with vagrant & chef

与VirtualBox/VMWare有啥区别?

Page 13: Envrionment as a code with vagrant & chef

没有区别,只不过⋯用Ruby脚本描述机器配置自动化、可以集成到CI等流程Base box的维护、管理社区化集成对环境provision的支持

Page 14: Envrionment as a code with vagrant & chef

Let’s Look Closer...

Box operations

add/remove/list

package

vm instance operations

up/resume/reload

suspend/halt/destroy

ssh/provision

Page 15: Envrionment as a code with vagrant & chef

Let’s Look Closer...

Networking

NAT

host-only

bridged

Shared folder

Page 16: Envrionment as a code with vagrant & chef

Scenario 2

如何快速搭建一套完全可用的应用环境?

如何对应用环境进行配置管理?

Page 17: Envrionment as a code with vagrant & chef

Vagrant Sample2

Provision刚才创建的服务器

Page 18: Envrionment as a code with vagrant & chef

应用环境配置

OS

Runtime

app lib

Container

app

app

Page 19: Envrionment as a code with vagrant & chef

OS

Runtime

app lib

Container

app

app

Infrastracture as Code

应用环境配置

Page 20: Envrionment as a code with vagrant & chef

ChefManage your servers by writing code, not by running commands. (via Cookbooks)

Integrate tightly with your applications, databases, LDAP directories, and more. (via Libraries)

Easily configure applications that require knowledge about your entire infrastructure ("What systems are running my application?" "What is the current master database server?") (via Search)

Create perfect clones of QA environments, pre-production environments, partner preview environments and more. (via Environments)

Page 21: Envrionment as a code with vagrant & chef

Chef sample1

chef-solo配置一台服务器

Page 22: Envrionment as a code with vagrant & chef

与我自己写shell/powershell有啥区别?

Page 23: Envrionment as a code with vagrant & chef

没有区别,只不过⋯Chef对shell的命令与系统提供了良好的抽象对脚本的管理(knife)与版本管理(chef-repo.git)

cookbook/recipe社区Ruby!!client/server的架构支持“pub/sub”

Page 24: Envrionment as a code with vagrant & chef

Let’s Look Closer

Page 25: Envrionment as a code with vagrant & chef

Scenario 3

如何保持团队机器上的工具与库等一致?

如何自动监听应用环境的变更并更新?

Page 26: Envrionment as a code with vagrant & chef

Chef Sample 2

chef-client配置一台服务器

Page 27: Envrionment as a code with vagrant & chef

Let’s Look Closer

Page 28: Envrionment as a code with vagrant & chef

Scenario 4

How about windows?

Page 29: Envrionment as a code with vagrant & chef

Scenario 4

How about Windows?

Chef也行!

Page 30: Envrionment as a code with vagrant & chef

Chef Sample 3

chef + windows server 2008

winrm + knife-windows

Page 31: Envrionment as a code with vagrant & chef

多余的话

本地虚拟机

私有云

公有云

Page 33: Envrionment as a code with vagrant & chef

Q&A