»DevOps is a software development method that stresses communication, collaboration and integration between software developers and IT professionals« - Wikipedia
Application Lifecycle
Develop
Deploy
Maintain
Vagrant
Puppet / Chef
Docker
Capistrano
Consul
Packer
Nagios
How does DevOps improve our process?
Virtual
Development Environment
git clone
vagrant up
Hands On
git clone https://github.com/doebi/catbook.git
How vagrant works.
base box
Vagrantfile
Provider
vagrant boxes
https://vagrantcloud.com/
$ vagrant box
vagrant box add ubuntu/trusty32
Hands On
vagrant box add fhlug/trusty32
http://fhlug.at/~cd/boxes/trusty32/package.box
$ vagrant init
vagrant init ubuntu/trusty32
initialize a Vagrantfile
Hands On
vagrant init fhlug/trusty32
Vagrantfile
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty32"
end
$ vagrant up
vagrant up
Hands On
vagrant up
$ vagrant ssh
vagrant ssh
connect to a running VM using ssh
$ vagrant rdp
vagrant rdp
connect to a running Windows-VM using rdp
Hands On
vagrant ssh
now mess with your VM, it's desposable! ;)
just run
vagrant destroy and
vagrant up to restore a new one
Synced Folders
Benefits
Vagrant.configure("2") do |config|
# other config here
config.vm.synced_folder "src/", "/srv/website"
end
Hands On
edit Vagrantfile
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
...
config.vm.synced_folder "../data", "/vagrant_data"
...
end
vagrant up
Provisioning
This is where the magic happens!
Vagrant.configure("2") do |config|
# ... other configuration
config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig"
end
config.vm.provision "shell", inline: "echo Hello, World"
config.vm.provision "shell", path: "script.sh"
config.vm.provision "shell", path: "https://example.com/provisioner.sh"
Hands On
edit Vagrantfile
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
...
config.vm.provision "shell", inline: "echo Hello, Vagrant"
...
end
vagrant provision
Provisioning
Why not use the same scripts as for deployment in production?
YOU CAN!
Provisioning
Vagrant.configure("2") do |config|
config.vm.provision "puppet" do |puppet|
puppet.manifests_path = "my_manifests"
puppet.manifest_file = "default.pp"
end
end
config.vm.provision "chef_client" do |chef|
chef.chef_server_url = "http://mychefserver.com"
chef.validation_key_path = "validation.pem"
end
config.vm.provision "docker" do |d|
d.build_image "/vagrant/app"
end
Hands On
vagrant destroy
git checkout provision
vagrant up
Vagrant.configure("2") do |config|
config.vm.network "forwarded_port", guest: 80, host: 8080
end
config.vm.network "private_network", type: "dhcp"
config.vm.network "public_network", ip: "192.168.0.17"
Networking
Hands On
edit Vagrantfile
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
...
config.vm.network "forwarded_port", guest: 80, host: 8080
...
end
vagrant reload --provision
vagrant share
sicker shit
vagrant connect
HTTP sharing
SSH sharing
General Sharing
share a VMs HTTP port on a public address
share a VMs SSH port
share any port
now go and vagrantify your projects!
Thanks
devopsreactions.tumblr.com
thecodinglove.com
securityreactions.tumblr.com