DevOps

What is DevOps?

»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

Why DevOps?

How does DevOps improve our process?

  • Reusability
  • Automation
  • Faster Deploys
  • Higher Quality
  • Error Reduction
  • Shorter Lifecycles

Vagrant

how cats use enterprise development tools for world domination

What is Vagrant?

Applications need ...

  • ... their own private environment
  • ... certain versions of libraries
  • ... configfiles in place
  • ... other circumstances

Virtual

Development Environment

The Vagrant Approach

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
  •      add
  •      list
  •      outdated
  •      remove
  •      repackage
  •      update

 

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

  • config file
  • ruby
  • multiple machines
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "ubuntu/trusty32"

end

$ vagrant up

vagrant up
  • boot a VM
  • when run for the first time set up and provision according to Vagrantfile

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

  • use your own IDE/Editor for development
  • never loose project files in a corrupt VM
  • integrate files in your usual backup strategy or git
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

  • connect to a generaly shared vagrant VM to have access to all ports

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

Made with Slides.com