install ChefDK yet? 4 Not only Chef 4 But many other tools 4 Can be installed via gem install as well though Go download it or ask staff for USB flash drive.
Set up VirtualBox & Chef 2. Create your first cookbook 3. Write test for your cookbook 4. Add cookbook dependencies using Berksfile 5. Prepare environment for your Rails app
base instance 4 Vagrant for local testing 4 EC2 / Digital Ocean or others for production 4 Provisioner is the tool for environment setup process 4 Chef / Puppet / Ansible
Point of Failure) of this workshop. We’ll use it later (and tell you how to download it) We've downloaded it and put it into USB sticks. Feel free to ask us to install faster. vagrant box add PATH --name opscode-ubuntu-14.04
system resources. To name a few built-in ones: 4 directory, file, user, group - create things 4 package - for system package 4 bash - to run random shell script (well, be careful) 4 cron - to update crontab
Reduce inconsistency 2. Improve the trust into your deployment process 3. The whole process is repeatable, hence 4 It’s easier to recover, scale 4 It’s testable
it { should return_stdout "root" } end describe file("/etc/sudoers") do it { should be_readable.by("owner") } it { should be_readable.by("group") } end
test/integration/default/serverspec touch test/integration/default/severspec/packages_spec.rb Be careful about spelling. Test Kitchen uses your directory name to select testing framework.
'serverspec' include Serverspec::Helper::Exec include Serverspec::Helper::DetectOS describe package("git") do it { should be_installed } end describe package("graphicsmagick") do it { should be_installed } end
and test are in good status, use the following command: kitchen test and it does everything we discussed before: {destroy, create, converge, verify} to make sure it works.
can add dependencies in Berksfile or metadata.rb. My personal suggestion: 4 Put related and real dependencies in metadata.rb 4 Put something else in Berksfile
its README file for: 1. What recipes available 2. What node attributes are able to be used to configure Take nginx as example: https://supermarket.getchef.com/cookbooks/nginx
versions of “nginx” cookbook available, and you need to be careful the version you use might provides different set of recipes. Use Berksfile to specify: cookbook 'mysql', path: '../mysql-cookbook' cookbook 'mysql', git: 'git://github.com/opscode-cookbooks/mysql.git' cookbook 'nginx', github: 'dlackty/mysql', branch: 'something'
Chef & deployment tools like Capistrano. Don’t panic. 1. Try to avoid using Chef as deployment tool at first 2. Consider using Chef as a way to set up Capistrano friendly environment
which indicates that it doesn’t require a central server. chef-server isn’t recommended for most people because: 1. The server is complex 2. One more SPoF 3. Many functionalities are duplicate of other tools
upon EC2 & related products. 1. It provides a builtin set of cookbook for Rails / PHP / Node.js 2. It has API to run Chef programmatically 3. Deploy vis GitHub