Devops days
Upcoming SlideShare
Loading in...5

Devops days



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

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



Total Views
Views on SlideShare
Embed Views



1 Embed 52 52


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.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
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 = '' <%- when "qa" %> api_url = '' <%- when "dev" %> api_url = '' <%- 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 "" ssh_wrapper "/tmp/private_code/" action :checkout notifies :restart, "service[#{project}]" end else deploy "/mnt#{node['repos']['home']}/#{project}" do ssh_wrapper "/tmp/private_code/" repo '' 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