Using Chef and Vagrant at Gengo
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Using Chef and Vagrant at Gengo

on

  • 580 views

 

Statistics

Views

Total Views
580
Views on SlideShare
580
Embed Views
0

Actions

Likes
0
Downloads
8
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

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

Using Chef and Vagrant at Gengo Presentation Transcript

  • 1. Chef and VagrantDerek Szydlowski & Yosuke Tomita
  • 2. I’ll Talk about how I feel about using chef, how we use chef. (not what is chef, not why start using chef) -> Derek will talk the second part in Devops Day, 9/28
  • 3. Chef and it’s recipe connects many things….
  • 4. ● Dev - Ops ● Production - Local ● English - Japanese
  • 5. ● Dev - Ops ● Production - Local ● English - Japanese
  • 6. Ops Dev
  • 7. Many many talks about it.. DevOpsの今とこれから https://speakerdeck.com/naoya/devopsfalsejin-tokorekara-number-init-devops 10 + deploys per day Dev & ops coorporation at Flickr http://www.slideshare.net/jallspaw/10-deploys-per-day-dev-and-ops-cooperation-at-flickr
  • 8. https://github.com/gengo/devops-tools How about Gengo??
  • 9. (Team Leader) Contributor
  • 10. Bottom up
  • 11. ● Dev - Ops ● Production - Local ● English - Japanese
  • 12. Local Production
  • 13. Develop Flow (for new application) 1. Develop in local. 2. Create recipe. 3. Test on QA env, both appication and recipe. 4. Deploy to Production using chef. 5. Make it work in local env(Vagrant).
  • 14. Production Knife solo nodes/hoge1.fuga.com.json { "run_list": [ "role[api]" ], "environment": "prod", "n_fqdn": "hoge1.fuga.com", "server_name": "api-live" } roles/api.rb run_list( "role[base]", "recipe[nginx]", "recipe[python]", "recipe[repos::api]", "recipe[monit]", "recipe[monit::nginx]", "recipe[monit::api]" ) Local(Vagrant) vagrant-omnibus Vagrantfile config.vm.provision :chef_solo do |chef| chef.add_recipe "nginx" chef.add_recipe "php_pack" chef.add_recipe "base::git" chef.add_recipe "repos::dev_repos" chef.add_recipe "python" chef.add_recipe "repos::api" end
  • 15. Knife solo knife solo cook ubuntu@hoge1.fuga.com && knife solo cook ubuntu@hoge2.fuga.com daidokoro -> project-name nodes -> server information roles -> define role (web server, db etc..) cookbooks -> recipes data_bags -> store password etc..
  • 16. nodes nodes/hoge1.fuga.com.json { "run_list": [ "role[api]" ], "environment": "prod", "n_fqdn": "hoge1.fuga.com", "server_name": "hoge1" }
  • 17. roles roles/api.rb run_list( "role[base]", "recipe[nginx]", "recipe[python]", "recipe[repos::api]", "recipe[monit]", "recipe[monit::nginx]", "recipe[monit::api]" )
  • 18. cookbooks cookbooks/repos/api.rb - install required module for application (apt-get) - setting virtualenv and install required package - add start/stop shell - restart service
  • 19. Vagrant omnibus A Vagrant plugin that ensures the desired version of Chef is installed https://github.com/schisamo/vagrant-omnibus don’t need to “knife solo prepare” in Vagrantfile config.vm.provision :chef_solo do |chef| chef.add_recipe "redis" chef.add_recipe "apache" end
  • 20. difference between local and prod - port setting use “template” resource template "#{virtual_env}/bin/api_start.sh" do source "api_start.sh.erb" owner "deployer" group "www-data" mode 0655 variables({ :env => node['environment'], :port => node['repos']['api_port'] }) end
  • 21. difference between local and prod - deploy use “deploy” resource for prod, use “git” resource for dev 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']}" keep_releases 3 user "deployer" group "www-data" create_dirs_before_symlink [] symlink_before_migrate.clear symlinks.clear symlinks "bin" => "bin" notifies :restart, "service[#{project}]" end http://docs.opscode.com/resource.html 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 http://docs.opscode.com/resource_git.html
  • 22. ● Dev - Ops ● Production - Local ● English - Japanese
  • 23. Japanese English
  • 24. 日本人はドキュメント作って、 忠実に実行することが得意だから、 Chef のようなツールが浸透しない (らしい) ↓ Gengoは、、、、 + 言葉の壁、、、
  • 25. Can review the code if can’t hear well. Can explain with code if can’t speak well. No (less?) manual operation on a server. <- When Running the same recipe in next release, the change can be lost. Infrastructure as code (for me)
  • 26. Chef connects…. ● Dev - Ops ● Production - Local ● English - Japanese and more!!!