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
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
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).
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..
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
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)