devops days
DESCRIPTION
Presentation by Yosuke Tomita and Derek Szydlowski at DevOps Days Tokyo '13TRANSCRIPT
![Page 1: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/1.jpg)
![Page 2: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/2.jpg)
Our love for Chef and Vagrant Derek Szydlowski
&Yosuke Tomita
![Page 3: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/3.jpg)
Our setupWhy Chef and vagrant - Challenges
Starting project Knife vs Vagrant (Solo)Best practice/code to define recipes for multiple environments
Problems with Vagrant / ChefDevelopment Flow
Recap and why it’s good for international office.More external info sources add chef and vagrant link
OUTLINE
![Page 4: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/4.jpg)
Intro
![Page 5: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/5.jpg)
60 + production servers ( 120 total )3 + environments
50 + repos15 + active contributors
![Page 6: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/6.jpg)
Challenges
![Page 7: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/7.jpg)
作業記録なし
Manual Environments = Unstable unscalable environments
バラバラな環境
CHALLENGE 1
テスト不可
単調な作業 の連続 → 人為的ミス
![Page 8: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/8.jpg)
Devs and Devops not in syncChef meets Vagrant
CHALLENGE 2
開発者は実装にのみ集中しがち
Opsの作業時間がタスクに含まれていない
新メンバーが入った時、新しい技術を入れた時の環境構築が大変
![Page 9: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/9.jpg)
Chef / Chef-Solo: configuration management tool
Chef Recipe/Cookbook: Chef configuration file
AWS EC2: Virtual Machine Cloud Service
VirtualBox: Virtual Machine for Local Environments
Vagrant: wrapper for creating VirtualMachines, delivering chef recipes and runs Chef remotely
Knife-solo: Delivers recipes and runs chef remotely.
Words and Terms
![Page 10: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/10.jpg)
Workflow
![Page 11: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/11.jpg)
Outline
![Page 12: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/12.jpg)
Development Flow
![Page 13: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/13.jpg)
Code Example
Let’s dip into the code and see some ways to create a dev vs production server.
![Page 14: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/14.jpg)
Production/QAKnife-Solo
roles/api.rbrun_list(
"role[base]",
"recipe[nginx]",
"recipe[python]",
"recipe[repos::api]", "recipe[monit]",
"recipe[monit::nginx]",
"recipe[monit::api]"
)
LocalVagrant
Vagrantfileconfig.vm.provision :chef_solo do |chef|
chef.add_recipe "base::git"
chef.add_recipe "nginx"
chef.add_recipe "php_pack"
chef.add_recipe "python"
chef.add_recipe "repos::api" end
Sharing recipe on local and servers
![Page 15: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/15.jpg)
Changing server configuration in a template
cookbooks/repos/templates/api.erb------<%- case node[‘environment'] %><%- when "live" %> api_url = 'http://api.gengo.com'<%- when "qa" %> api_url = 'http://yyy.api.gengo.com'<%- when "dev" %> api_url = 'http://xxx.api.gengo.com'<%- end %>------
Define in “node/xxx.json or Vagrantfile”
![Page 16: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/16.jpg)
Changing server configuration via Attributes
cookbooks/repos/attributes/default.rb------if node['environment'] == 'live' default['repos']['gengo_database'] = "database_live" default[‘repos’][‘nginx_security_password’] = “true”elseif node['environment'] == 'qa' default['repos']['gengo_database'] = "database_qa" default[‘repos’][‘nginx_security_password’] = “false”------
cookbooks/repos/templates/api.erb------database = ‘<%= default['repos']['gengo_database'] %>’------
Define in “node/xxx.json”or“Vagrantfile”
![Page 17: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/17.jpg)
Changing Resource in a Recipe.
cookbooks/repos/recipes/api
if node['environment'] == "dev" git "#{node['repos']['home']}/#{project}" do repository "[email protected]:gengo/api.git" ssh_wrapper "/tmp/private_code/wrap-ssh4git.sh" action :checkout notifies :restart, "service[#{project}]" endelse deploy "/mnt#{node['repos']['home']}/#{project}" do ssh_wrapper "/tmp/private_code/wrap-ssh4git.sh" repo '[email protected]:gengo/api' branch "#{node['repos']['branch']}" migrate false keep_releases 3 notifies :restart, "service[#{project}]" endend
Define in “node/xxx.json” or“Vagrantfile”
![Page 18: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/18.jpg)
Hurdles
![Page 19: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/19.jpg)
Chef and Vagrant Hurdles!
opsもコードに強くなる必要がある → Devと一緒にやると距離が縮まる
devになかなか使ってもらえない
様々な開発環境(Window, Mac, Ubuntu….)
バグを踏むこともある → コミュニティ
![Page 20: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/20.jpg)
Bonus!
![Page 21: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/21.jpg)
Any Questions?
Name 3 languages that Gengo has client library for?
@gengo, @gengo_ja
https://github.com/gengo
http://gengo.doorkeeper.jp
![Page 22: Devops days](https://reader034.vdocument.in/reader034/viewer/2022052315/554a3431b4c9051b578b549e/html5/thumbnails/22.jpg)