- each system component is broken up into network-accessible services, which are integrated to make a functioning application
- allows to create ever more flexible, powerful infra with less overhead and time
- developers become free to compose new apps from network primitives, resulting in easy reuse, clear encapsulation, and simpler troubleshooting
- core competency of Web 2.0 companies
- SOA principles that apply to infra as code:
- modular: small and simple services that do one thing (well)
- cooperative: services exposed via network APIs encourage cooperation and become more useful, can hand off work to other services
- composable: compose modularized services to automate infra as required
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ vagrant plugin list | |
vagrant-cachier (0.5.0) | |
vagrant-omnibus (1.1.2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----> Running serverspec test suite | |
/opt/chef/embedded/bin/ruby -I/tmp/busser/suites/serverspec -S /opt/chef/embedded/bin/rspec /tmp/busser/suites/serverspec/default_spec.rb --color --format documentation | |
1 | |
skeleton::default | |
installs sample package (FAILED - 1) | |
does something (FAILED - 2) | |
Failures: | |
1) skeleton::default installs sample package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
machine_name=default | |
machine_id=$(cat ".vagrant/machines/$machine_name/virtualbox/id") | |
ssh_port=$(VBoxManage showvminfo "$machine_id" --machinereadable | grep ^Forwarding | head -n1 | cut -d, -f4) | |
echo $ssh_port |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "cucumber" | |
require "aruba/cucumber" | |
# Add shims to PATH | |
SHIMS = "#{Dir.pwd}/tmp/aruba/shims" | |
ENV['PATH'] = "#{SHIMS}:#{ENV['PATH']}" | |
def generate_shims_for(commands) | |
FileUtils.mkdir_p(SHIMS) | |
commands.each do |cmd| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[tmp]$ bash | |
[tmp]$ set -e | |
[tmp]$ (exit 10) | cat - | |
[tmp]$ echo $? | |
0 | |
[tmp]$ set -o pipefail | |
[tmp]$ (exit 10) | cat - | |
[tmp]$ echo $? | |
10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you want to provide custom Chef attributes that should not end up in Git | |
# (e.g. secret tokens), copy `chef.json.example` to `chef.json` and edit the | |
# latter accordingly (in that case, the example file will be ignored). | |
# ... | |
# Configure Chef Solo provisioner | |
config.vm.provision :chef_solo do |chef| | |
# Tell Vagrant where the cookbooks are located | |
chef.cookbooks_path = "vendor/cookbooks" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "net/https" | |
require "json" | |
gh_token = ENV.fetch("GITHUB_TOKEN") | |
gh_user = ARGV.fetch(0) | |
gh_repo = ARGV.fetch(1) | |
release_name = ARGV.fetch(2) | |
release_desc = ARGV[3] | |
uri = URI("https://api.github.com") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant.configure("2") do |config| | |
config.vm.box = "ubuntu-12.04" | |
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box" | |
# Install Chef version 11 | |
config.vm.provision :shell, :inline => <<EOS | |
set -e | |
if ! command -V chef-solo >/dev/null 2>/dev/null; then | |
curl -L https://www.opscode.com/chef/install.sh | bash -s -- -v 11.6.0 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vi: set ft=ruby : | |
# Install Cucumber and dependencies, and run scenarios. | |
$script = <<SCRIPT | |
set -e -x | |
test -f /var/lib/apt/periodic/update-success-stamp || sudo apt-get update -y | |
sudo apt-get install -y update-notifier-common ruby rubygems ruby-bundler git | |
bundle install --gemfile=/vagrant/Gemfile | |
cd /vagrant | |
bundle exec rake features |