envrionment as a code with vagrant & chef
DESCRIPTION
This deck is from my sharing about Environment as a code with vagrant & chef on office internal WE-Day.TRANSCRIPT
Environment as a Codewith Vagrant & Chef
金明 @imingjin
Scenario 1
如何满足团队需要新机器的需求?
Scenario 1
IS同学给我们订购一台机器,但要等半个月
IS同学给我们创建一台虚拟机,但服务器资源有限
Scenario 2
如何快速搭建一套完全可用的应用环境?
Scenario 2
团队ghost标准环境,ghost文件缺乏维护
大多数时候,团队仍然需要去做手工部署
每个人基本上都有自己的部署过程,千人千面
Scenario 3
如何保持团队机器上的工具与库等一致?
Scenario 3
各人的机器配置很快就变得面目全非
升级工具或者库,需要逐台机器进行
缺乏管理,环境的问题无休无止开发、测试、CI、Staging、Production⋯
也要做环境 配置管理
Scenario 1
何不试试本地的虚拟机?
如何满足团队需要新机器的需求?
Vagrant Sample 1
创建一台CentOS服务器
与VirtualBox/VMWare有啥区别?
没有区别,只不过⋯用Ruby脚本描述机器配置自动化、可以集成到CI等流程Base box的维护、管理社区化集成对环境provision的支持
Let’s Look Closer...
Box operations
add/remove/list
package
vm instance operations
up/resume/reload
suspend/halt/destroy
ssh/provision
Let’s Look Closer...
Networking
NAT
host-only
bridged
Shared folder
Scenario 2
如何快速搭建一套完全可用的应用环境?
如何对应用环境进行配置管理?
Vagrant Sample2
Provision刚才创建的服务器
应用环境配置
OS
Runtime
app lib
Container
app
app
OS
Runtime
app lib
Container
app
app
Infrastracture as Code
应用环境配置
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)
Chef sample1
chef-solo配置一台服务器
与我自己写shell/powershell有啥区别?
没有区别,只不过⋯Chef对shell的命令与系统提供了良好的抽象对脚本的管理(knife)与版本管理(chef-repo.git)
cookbook/recipe社区Ruby!!client/server的架构支持“pub/sub”
Let’s Look Closer
Scenario 3
如何保持团队机器上的工具与库等一致?
如何自动监听应用环境的变更并更新?
Chef Sample 2
chef-client配置一台服务器
Let’s Look Closer
Scenario 4
How about windows?
Scenario 4
How about Windows?
Chef也行!
Chef Sample 3
chef + windows server 2008
winrm + knife-windows
多余的话
本地虚拟机
私有云
公有云
References
vagrant(http://vagrantup.com)
veewee(https://github.com/jedi4ever/veewee)
chef(http://wiki.opscode.com/display/chef/Home)
knife-windows(https://github.com/opscode/knife-windows)
puppet(http://docs.puppetlabs.com)
Q&A