• Save
Getting Your Toolbox Together
Upcoming SlideShare
Loading in...5
×
 

Getting Your Toolbox Together

on

  • 640 views

Slides for my talk "Getting Your Toolbox Together", which I gave a DPC 2013.

Slides for my talk "Getting Your Toolbox Together", which I gave a DPC 2013.

Statistics

Views

Total Views
640
Views on SlideShare
634
Embed Views
6

Actions

Likes
2
Downloads
0
Comments
0

1 Embed 6

http://librosweb.es 6

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • About getting your toolbox together! What are tools, how can we use them, what is available, what does it offer? To illustrate the power of tool, story time!
  • Time to tell a story about how I got started on a new project a few years ago
  • Intro to the project
  • So lets take a look at how it could be done!
  • The mystical 4 th step…
  • So what does this have to do with your toolbox. To get to that, first define what tools are and how they can be used
  • Now we know what tools are – how can we start using them?
  • Well, hopefully you’re using a CI-server!
  • Today looking at 2 specifically
  • So, your dev env and tools, how can we let them work together to make your life easier…
  • So how can we create a development environment?
  • Might be, unless everyone has his/her own image. But think about database, Redis, Solr etc
  • Well, might be, unless there is a different image for every project, which in turn re-emphasizes the previous point…
  • Better yet… do not just use any tool, use…:
  • First a small intro
  • Remember name!
  • Remember name!
  • Remember name!
  • Remember name!
  • Mind the configure(“2”) -> vagranfile configuration version -> backwards compatibility!
  • Customize -> virtualbox only!
  • Is complete without…
  • Attributes: model, Recipes: controller, Templates: view
  • Attributes: model, Recipes: controller, Templates: view
  • Attributes: model, Recipes: controller, Templates: view
  • Attributes: model, Recipes: controller, Templates: view
  • Remember this?
  • It’s maaaagic

Getting Your Toolbox Together Getting Your Toolbox Together Presentation Transcript

  • Getting Your Toolbox TogetherDaan van RenterghemJune 7th, 2013
  • Welcome!Daan van RenterghemSoftware Engineer @Ibuildings
  • Welcome!Daan van RenterghemSoftware Engineer @Ibuildingshttps://joind.in/8453
  • Welcome!Daan van RenterghemSoftware Engineer @IbuildingsConference Social!
  • What is this talk about?
  • Story Time!http://thedailygrowl.co.uk/2009/10/14/its-story-time/
  • Welcome Aboard!
  • Welcome Aboard!http://www.quickmeme.com
  • Welcome Aboard!All you have to do…
  • Welcome Aboard!All you have to do…• Step 1: get the code from VCS
  • Welcome Aboard!All you have to do…• Step 1: get the code from VCS• Step 2: download base image
  • Welcome Aboard!All you have to do…• Step 1: get the code from VCS• Step 2: download base image• Step 3: configure shared folders
  • Welcome Aboard!All you have to do…• Step 1: get the code from VCS• Step 2: download base image• Step 3: configure shared folders• Step 4: start image, say it is copied over, create a new shell user, transfer ownership of this list offiles to yourself, make sure these folders are writeable, mount your shared folder, check if your virtual hostssettings are correct, that your /etc/hosts file is pointing to the correct IP, which you need to get from the VM, oh,and if you’re not using linux, just google for the location of the hosts file, check if the browser doesn’t show thedefault it works page, resolve a bunch of errors to get the application up and running, ah cool, that’s at least not afatal error! Ehhhr, yeah, I believe that is caused because of this, oh, and you need to run this list of databasepatches in that particular sequence, and then resolve some more errors, create you local configuration, and justsee if you can get the thing to work, it took me only 5 days, so yeah… Good luck!
  • In other words:
  • In other words:
  • Could it be done differently?
  • Could it be done differently?Yes, yes it could!
  • Could it be done differently?Yes, yes it could!And it should!
  • Welcome Aboard (Tooling Style)
  • Welcome Aboard (Tooling Style)• Step 1: get the code from VCS
  • Welcome Aboard (Tooling Style)• Step 1: get the code from VCS• Step 2: copy configuration sample
  • Welcome Aboard (Tooling Style)• Step 1: get the code from VCS• Step 2: copy configuration sample• Step 3: run “vagrant up”
  • Welcome Aboard (Tooling Style)• Step 1: get the code from VCS• Step 2: copy configuration sample• Step 3: run “vagrant up”• Step 4: ???
  • Your Toolbox
  • Tools, what do you mean?
  • Tools, what do you mean?Having a toolbox means you are using toolsto solve problems (rather than checklistsand procedures)
  • Tools, what do you mean?Having a toolbox means you are using toolsto solve problems (rather than checklistsand procedures)Make development, maintenance anddeployment as easy and fast as possible,with the least amount of interaction.
  • Why are Tools important?
  • Why are Tools important?In devops you either are contribute to tool oryou are tool.- DevOps Borathttps://twitter.com/DEVOPS_BORAT/status/139898439621296129
  • Why are Tools important?In devops you either are contribute to tool oryou are tool.- DevOps BoratTools help you accomplish (repetitive) tasksin an easy, consistent manner.https://twitter.com/DEVOPS_BORAT/status/139898439621296129
  • Why are Tools important?In devops you either are contribute to tool oryou are tool.- DevOps BoratTools help you accomplish (repetitive) tasksin an easy, consistent manner.Added bonus: no human errorhttps://twitter.com/DEVOPS_BORAT/status/139898439621296129
  • When to use tools?
  • Chances areYou’re already using tools!
  • Chances areYou’re already using tools!• VCS
  • Chances areYou’re already using tools!• VCS• Editor / IDE
  • Chances areYou’re already using tools!• VCS• Editor / IDE• CI - server
  • Where can tools be used
  • Where can tools be used• Code Management
  • Where can tools be used• Code Management• Development Environment
  • Where can tools be used• Code Management• Development Environment• Any other environment
  • Where can tools be used• Code Management• Development Environment• Any other environment• Deployment
  • Where can tools be used• Code Management• Development Environment• Any other environment• Deployment• Quality Control
  • Where can tools be used• Code Management• Development Environment• Any other environment• Deployment• Quality Control• Monitoring
  • Where can tools be used• Code Management• Development Environment• Any other environment• Deployment• Quality Control• Monitoring
  • DevelopmentEnvironment
  • Development Environment
  • Development EnvironmentDifferent options
  • Development EnvironmentDifferent options• Local Webserver
  • Development EnvironmentDifferent options• Local Webserver• Single Shared Server
  • Development EnvironmentDifferent options• Local Webserver• Single Shared Server• Development Images
  • Local WebserverPro: Con:
  • Local WebserverPro:•PortableCon:
  • Local WebserverPro:•PortableCon:•No consistentenvironment
  • Local WebserverPro:•PortableCon:•No consistentenvironment•Multiple projects cancause conflicts
  • Local WebserverPro:•PortableCon:•No consistentenvironment•Multiple projects cancause conflicts•Different OS, differentbuild
  • Single Shared ServerPro: Con:
  • Single Shared ServerPro:•Possible per projectCon:
  • Single Shared ServerPro:•Possible per projectCon:•Single state foreveryone
  • Single Shared ServerPro:•Possible per projectCon:•Single state foreveryone•Single state for everyproject
  • Single Shared ServerPro:•Possible per projectCon:•Single state foreveryone•Single state for everyproject•Costs (hardware,management)
  • Single Shared ServerPro:•Possible per projectCon:•Single state foreveryone•Single state for everyproject•Costs (hardware,management)•Downtime, network
  • Development ImagePro: Con:
  • Development ImagePro:•Specific per projectCon:
  • Development ImagePro:•Specific per project•PortableCon:
  • Development ImagePro:•Specific per project•Portable•Consistent stackbetween devsCon:
  • Development ImagePro:•Specific per project•Portable•Consistent stackbetween devs•Allows for localdifferences whereneededCon:
  • Development ImagePro:•Specific per project•Portable•Consistent stackbetween devs•Allows for localdifferences whereneededCon:•Takes time to set up
  • Development Image
  • Development ImageRequirements
  • Development ImageRequirements• Reliable, maintainable
  • Development ImageRequirements• Reliable, maintainable• OS agnostic
  • Development ImageRequirements• Reliable, maintainable• OS agnostic• Allow for consistent configuration
  • Development ImageRequirements• Reliable, maintainable• OS agnostic• Allow for consistent configuration• Reusable, Idempotent
  • Development ImageNow we know what we want, but how tocreate one?
  • Development ImageNow we know what we want, but how tocreate one?Use a tool!
  • Development ImageNow we know what we want, but how tocreate one?Use Vagrant!
  • Vagrant
  • Vagrant
  • VagrantCreate and configure lightweight,reproducible, and portable developmentenvironments.
  • VagrantCreate and configure lightweight,reproducible, and portable developmentenvironments.•Provider agnostic
  • VagrantCreate and configure lightweight,reproducible, and portable developmentenvironments.•Provider agnostic•Uses “boxes”: base images to quickly clonea virtual machine
  • VagrantCreate and configure lightweight,reproducible, and portable developmentenvironments.•Provider agnostic•Uses “boxes”: base images to quickly clonea virtual machine•Provisioning: automated installation ofsoftware
  • Vagrant - Resources
  • Vagrant - ResourcesWebsite:http://www.vagrantup.com
  • Vagrant - ResourcesWebsite:http://www.vagrantup.comInstallation:http://downloads.vagrantup.com
  • Vagrant - ResourcesWebsite:http://www.vagrantup.comInstallation:http://downloads.vagrantup.comDocumentation:http://docs.vagrantup.com
  • Vagrant - Usage
  • Vagrant - BoxesBox: Portable files which can be used byothers on any platform that runs Vagrant tobring up a working environment.
  • Vagrant - BoxesBox: Portable files which can be used byothers on any platform that runs Vagrant tobring up a working environment.$ vagrant box add <name> <url> <provider>
  • Vagrant - BoxesBox: Portable files which can be used byothers on any platform that runs Vagrant tobring up a working environment.$ vagrant box add <name> <url> <provider>http://www.vagrantbox.es
  • Vagrant - BoxesDefine configuration, in Vagrantfile
  • Vagrant - BoxesDefine configuration, in VagrantfileVagrant.configure("2") do |config|config.vm.box = "<name>"end
  • Vagrant - ConfigurationConfigure amount of memory, give it a nameVagrant.configure("2") do |config|config.vm.customize ["modifyvm", :id,"--name", "foobar","--memory", 2048]end
  • Vagrant - ConfigurationShared folder configurationVagrant.configure("2") do |config|config.vm.share_folder("htdocs","/var/www/my_project/""/path/to/local/folder")end
  • Vagrant - ConfigurationUsing local configurationrequire "yaml"conf = YAML.load_file("./deploy/dev/conf.yaml")
  • Vagrant - ConfigurationUsing local configurationrequire "yaml"conf = YAML.load_file("./deploy/dev/conf.yaml")Vagrant.configure("2") do |config|# conf available hereend
  • Vagrant - ConfigurationShared folder configurationVagrant.configure("2") do |config|config.vm.share_folder("htdocs","/var/www/" + conf["project_name"],conf["shared_folder"])end
  • Vagrant - ConfigurationWe can localize this too!Vagrant.configure("2") do |config|config.vm.customize ["modifyvm", :id,"--name", conf["project_name"],"--memory", conf["mem_limit"]]end
  • Vagrant - ConfigurationEven the IP on which it can be reached.Vagrant.configure("2") do |config|config.vm.network :hostonly, conf["ip"]end
  • Vagrant - ConfigurationBasic configuration
  • Vagrant - ConfigurationBasic configuration•Commit Vagrantfile to VCS
  • Vagrant - ConfigurationBasic configuration•Commit Vagrantfile to VCS•Commit sample dev config to VCS
  • Vagrant - ConfigurationBasic configuration•Commit Vagrantfile to VCS•Commit sample dev config to VCS•Ignore dev config
  • Vagrant - Commands
  • Vagrant - Commands• $ vagrant up• $ vagrant halt• $ vagrant suspend• $ vagrant resume• $ vagrant destroy• $ vagrant provision
  • Vagrant – Recap
  • VagrantSingle command to get your VM running
  • VagrantSingle command to get your VM running$ vagrant up
  • VagrantSingle command to get your VM running$ vagrant upAnd it’s running!
  • VagrantSingle command to get your VM running$ vagrant upAnd it’s running!But that’s not usable as server right now…
  • VagrantWe have a machine…
  • VagrantWe have a machine…… but its not a server
  • VagrantWe have a machine…… but its not a server
  • VagrantWe have a machine…… but its not a server… and we do not want everyone to installeverything themselves
  • VagrantWe have a machine…… but its not a server… and we do not want everyone to installeverything themselvesEnter: Provisioning
  • VagrantWe have a machine…… but its not a server… and we do not want everyone to installeverything themselvesEnter: Provisioning
  • Vagrant - ProvisioningConfiguration Management
  • Vagrant - ProvisioningProvisioning
  • Vagrant - ProvisioningProvisioning+
  • Vagrant - ProvisioningProvisioning+
  • Vagrant - ProvisioningConfiguration Management
  • Vagrant - ProvisioningConfiguration Management•Infrastructure as code
  • Vagrant - ProvisioningConfiguration Management•Infrastructure as code•Since it is code… VCS!
  • Vagrant - ProvisioningVarious provisioning tools•Puppet•Chef•Ansible•Salt (requires gem)•Shell
  • Vagrant - ProvisioningVarious provisioning tools•Puppet•Chef•Ansible•Salt (requires gem)•Shell
  • Chef
  • No Talk About Chef…
  • No Talk About Chef…http://www.telegraph.co.uk/culture/qi/8735232/QI-Quite-interesting-facts-about-hats.html
  • ChefInfrastructure Automation Framework
  • ChefInfrastructure Automation Framework•Chef Server
  • ChefInfrastructure Automation Framework•Chef Server•Chef Solo
  • ChefCore Concepts
  • ChefCore Concepts•Cookbooks
  • ChefCore Concepts•Cookbooks•Roles
  • Chef - CookbookFundamental Unit of Configuration andPolicy Distribution in Chef
  • Chef - CookbookFundamental Unit of Configuration andPolicy Distribution in ChefOr: Definition of how to install what andwhere it should be installed
  • Chef - CookbookFundamental Unit of Configuration andPolicy Distribution in ChefOr: Definition of how to install what andwhere it should be installedhttp://community.opscode.com/cookbooks
  • Chef - CookbookStructureCookbook//attributes/recipes/templates
  • Chef - CookbookStructureCookbook//attributes/recipes/templatesAttributes: parameters
  • Chef - CookbookStructureCookbook//attributes/recipes/templatesAttributes: parametersRecipes: code that needs to be executed
  • Chef - CookbookStructureCookbook//attributes/recipes/templatesAttributes: parametersRecipes: code that needs to be executedTemplates
  • Chef - RoleA way to define certain patterns andprocesses that exist across nodes in a Cheforganization as belonging to a single jobfunction.
  • Chef - RoleA way to define certain patterns andprocesses that exist across nodes in a Cheforganization as belonging to a single jobfunction.Or: A collection of cookbooks and attributesthat should be used
  • Chef - Role• Simple json file• Name• Default Attributes• Override Attributes• Run List
  • Chef - RoleAllows for per environment configuration ofsetup.As example, a basic example of Apache,php and mysql
  • Chef - Role - Example{"name": "development","default_attributes": { },"override_attributes": { },"run_list": ["recipe[apache2]","recipe[apache2::mod_php5]","recipe[php]","recipe[mysql]”,]}
  • Vagrant & Chef
  • Vagrant - Chef
  • Vagrant - Chefconfig.vm.provision :chef_solo do |chef|chef.cookbooks_path ="deploy/chef/cookbooks"chef.roles_path = "deploy/chef/roles"chef.add_role(development)end
  • Vagrant - ChefWhat have we got so far?
  • Vagrant - ChefWhat have we got so far?
  • Vagrant - ChefWhat have we got so far?•Consistent virtual machine with known OS
  • Vagrant - ChefWhat have we got so far?•Consistent virtual machine with known OS•Standardized stack for all developers
  • Vagrant - ChefWhat have we got so far?•Consistent virtual machine with known OS•Standardized stack for all developersWhere to keep it?
  • Vagrant - ChefWhat have we got so far?•Consistent virtual machine with known OS•Standardized stack for all developersWhere to keep it?Inside your project!
  • Vagrant - ChefCustom Cookbooks
  • Vagrant - ChefCustom Cookbooks•Database
  • Vagrant - ChefCustom Cookbooks•Database•Fixtures
  • Vagrant - ChefCustom Cookbooks•Database•Fixtures•File generation
  • Remember This?
  • Welcome Aboard (Tooling Style)• Step 1: get the code from VCS• Step 2: copy configuration sample• Step 3: run “vagrant up”• Step 4: ???
  • Welcome Aboard (Tooling Style)• Step 1: get the code from VCS• Step 2: copy configuration sample• Step 3: run “vagrant up”• Step 4: there is no step 4
  • Vagrant - ChefSo, how to get started then?$ git clone git@github.com:adent/42.git$ cp ./deploy/dev/conf.yaml.sample ./deploy/dev/conf.yaml$ vagrant upAnd ready to go!
  • Other EnvironmentsAutomated Deployment•Phing•Capistrano• Webistrano• Capifony•Fabric•Vlad the Deployer•…
  • Other EnvironmentsRun Tasks•Create Backup•Build / Update Environment•DeployBuild / Update the Environment with thesame tools you use for your dev env!
  • Other EnvironmentsBuilding or Updating Environment notpossible through tools?
  • Other EnvironmentsBuilding or Updating Environment notpossible through tools?Configure your tools to reflect the productionenvironment
  • Other EnvironmentsBuilding or Updating Environment notpossible through tools?Configure your tools to reflect the productionenvironment•Version locking•Recreate the production environment
  • Shameless PlugDeploying your apps… the right way!Robbert van den Bogerd13:30, track 2
  • Recap
  • Recap• Use Development Images
  • Recap• Use Development Images• Takes time to set up, but pays off in the longrun
  • Recap• Use Development Images• Takes time to set up, but pays off in the longrun• Automate Deployment
  • Recap• Use Development Images• Takes time to set up, but pays off in the longrun• Automate Deployment• Use Provisioning for every Environment
  • Further ReadingDocumentation•http://www.vagrantup.com•http://opscode.com/chef/Resources•http://community.opscode.com/cookbooks•http://www.vagrantbox.es
  • Thank You!Feedback? Please let me know:@DRvanRhttps://joind.in/8453See you at the Conference Social!