Vagrant & Reusable Code

987 views

Published on

Gianluca Arbezzano discuss about Vagrant and Saltstack in order to speedup your development operations

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
987
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
4
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Vagrant & Reusable Code

  1. 1. VAGRANT & CODE REUSABLE Gianluca Arbezzano www.gianarb.it - @gianarb Corley srl - www.corley.it Cloud Party 21/05/2014
  2. 2. Don’t sleep developer!
  3. 3. Decrease the complexity •Start up project •Flexibility
  4. 4. What isVagrant? •Provider •Provisioning •Networking •Share Folder
  5. 5. WhyVagrant? Vagrant allow to: •Configure •Reproduce •Share it’s very easy!
  6. 6. Command line •$. vagrant box •$. vagrant init •$. vagrant up •$. vagrant ssh •$. vagrant destroy •$. vagrant reload •$. vagrant provision
  7. 7. Plugin $. vagrant plugin install <name> $. vagrant plugin remove <name> $. vagrant plugin list
  8. 8. Vagrantfile - Configuration # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(“2”) do |config| config.vm.define :web do |web| web.vm.box = "precise64" web.vm.box_url = "http://files.vagrantup.com/precise64.box"
  9. 9. Vagrantfile - Configuration web.vm.network :private_network, ip: “192.168.33.222” web.vm.network “port_forwarding”, guest: 80, host: 8080 config.vm.hostname = "cwitter-dev.local” web.vm.synced_folder "../", "/var/www/cwitter", owner: "www- data", group: "www-data"
  10. 10. Vagrantfile - Configuration config.vm.provision :chef_solo do |chef| chef.cookbooks_path = ["cookbooks"] chef.add_recipe "apt" chef.add_recipe "vim" chef.add_recipe "openssl" chef.add_recipe "apache2" chef.add_recipe "postgresql::server” end
  11. 11. Vagrantfile - Configuration web.vm.provider :virtualbox do |v| v.customize ["modifyvm", :id, "--memory", 512, "--name", "cwitter-dev.local"] end
  12. 12. PROVISIONING
  13. 13. How is it? Server provisioning is a set of actions to prepare a server with appropriate systems, data and software, and make it ready for network operation http://en.wikipedia.org/wiki/Provisio ning#Server_provisioning
  14. 14. I use one of this systems in production •Updating •Maintainability •Scalibility
  15. 15. RISKS Bug in your configurations Price of good cookbook (Chef), formula (salt)…
  16. 16. Answer to this problem is…
  17. 17. REUSABILITY
  18. 18. Environments •Production •Develop •Certification •…
  19. 19. Vagrant configuration is shareable
  20. 20. VAGRANT AND SALT
  21. 21. Repository
  22. 22. Repository/prod/salt
  23. 23. Repository/dev/salt
  24. 24. Salt Provioning Vagrant.configure("2") do |config| config.vm.box = "precise64” config.vm.hostname = “cwitter-dev.local” web.vm.network “port_forwarding”, guest: 80, host: 8080 web.vm.synced_folder “.”, “/srv/” web.vm.synced_folder “../”, “/var/www/cwitter” config.vm.provision :salt do |salt| salt.verbose = true salt.minion_config = “./minion" salt.run_highstate = true salt.install_type = “daily” end end
  25. 25. Minion – Conf(1) master: localhost file_client: local
  26. 26. Minion – Conf(2) file_roots: base: - /srv/base/salt prod: - /srv/prod/salt dev: - /srv/prod/salt - /srv/dev/salt
  27. 27. Minion – Conf(3) pillar_roots: base: - /srv/base/pillar prod: - /srv/prod/pillar dev: - /srv/dev/pillar
  28. 28. top.sls base: '*': - base dev: '*-dev*': - webserver - webserver.dev - webapp - mysql prod: 'proxy.milan.enter.*': - nginx 'web.milan.enter.*': - webserver - webapp …… • Inheritance • Customization of environmentes
  29. 29. Think your system Write it Configure develop env Configure prod …
  30. 30. Links •www.vagrantup.com •www.vagrantbox.es •irc.freenode.net #vagrant •https://github.com/dotless-de/vagrant-vbguest •https://github.com/schisamo/vagrant-omnibus •https://vagrantcloud.com
  31. 31. THANKYOU http://www.corley.it

×