Devops days
Upcoming SlideShare
Loading in...5
×
 

Devops days

on

  • 524 views

Presentation by Yosuke Tomita and Derek Szydlowski at DevOps Days Tokyo '13

Presentation by Yosuke Tomita and Derek Szydlowski at DevOps Days Tokyo '13

Statistics

Views

Total Views
524
Views on SlideShare
472
Embed Views
52

Actions

Likes
1
Downloads
6
Comments
0

1 Embed 52

http://blog.shebangri.la 52

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Devops days Devops days Presentation Transcript

  • Our love for Chef and Vagrant Derek Szydlowski & Yosuke Tomita
  • Our setup Why Chef and vagrant - Challenges Starting project Knife vs Vagrant (Solo) Best practice/code to define recipes for multiple environments Problems with Vagrant / Chef Development Flow Recap and why it’s good for international office. More external info sources add chef and vagrant link OUTLINE
  • Intro View slide
  • 60 + production servers ( 120 total ) 3 + environments 50 + repos 15 + active contributors View slide
  • Challenges
  • 作業記録なし Manual Environments = Unstable unscalable environments バラバラな環境 CHALLENGE 1 テスト不可 単調な作業 の連続 → 人為的ミス
  • Devs and Devops not in sync Chef meets Vagrant CHALLENGE 2 開発者は実装にのみ集中しがち Opsの作業時間がタスクに含まれていない 新メンバーが入った時、新しい技術を入れた時の 環境構築が大変
  • 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
  • Workflow
  • Outline
  • Development Flow
  • Code Example Let’s dip into the code and see some ways to create a dev vs production server.
  • Production/QA Knife-Solo roles/api.rb run_list( "role[base]", "recipe[nginx]", "recipe[python]", "recipe[repos::api]", "recipe[monit]", "recipe[monit::nginx]", "recipe[monit::api]" ) Local Vagrant Vagrantfile config.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
  • 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”
  • 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”
  • Changing Resource in a Recipe. cookbooks/repos/recipes/api if node['environment'] == "dev" git "#{node['repos']['home']}/#{project}" do repository "git@github.com:gengo/api.git" ssh_wrapper "/tmp/private_code/wrap-ssh4git.sh" action :checkout notifies :restart, "service[#{project}]" end else deploy "/mnt#{node['repos']['home']}/#{project}" do ssh_wrapper "/tmp/private_code/wrap-ssh4git.sh" repo 'git@github.com:gengo/api' branch "#{node['repos']['branch']}" migrate false keep_releases 3 notifies :restart, "service[#{project}]" end end Define in “node/xxx.json” or “Vagrantfile”
  • Hurdles
  • Chef and Vagrant Hurdles! opsもコードに強くなる必要がある  → Devと一緒にやると距離が縮まる devになかなか使ってもらえない 様々な開発環境(Window, Mac, Ubuntu….) バグを踏むこともある  → コミュニティ
  • Bonus!
  • Any Questions? Name 3 languages that Gengo has client library for? @gengo, @gengo_ja https://github.com/gengo http://gengo.doorkeeper.jp