Vagrant allows setting up portable development environments for TYPO3 projects quickly using virtual machines. Chef is a configuration management tool that can automate the provisioning of these Vagrant boxes. Using Vagrant and Chef together provides benefits like sharing projects easily and having development environments match production.
10. How canVagrant help you?
• Install (multiple)TYPO3 projects in minutes
• Have it “to go”
• Share it with others
• Have a “copy” of your production server
14. Vagrant Boxes
• Basically a “tweaked” virtual machine Image
• Used as base layer for all further provisioning
• Many pre-installed boxes available online:
19. Provisioners
• Run once the box is booted inVirtualBox
• „Where the magic happens“
– Installing packages and software
– Configuration and starting of services
– E.g. creating vhost, database, ...
20. Providers
• Describe in which virtualization environment
to provision your machines
• Multiple providers available
– VirtualBox
– VMWare
– Amazon AWS
21. What is Chef?
• Configuration Management AutomationTool
• Written in Ruby
– Provides easy-to-learn (?) DSL
• „Infrastructure as code“
– Reproducible,Testable,Versionable
30. Vagrant &TYPO3
• Find inspiration on
https://git.typo3.org/Teams/Server/Vagrant/T
ypo3Org.git
31. Your ownVagrant Box
• The “Playbook-to-Cookbook-Algorithm”
– Write installation steps in a text document
– Follow steps yourself, refine document
– Give document to someone else, refine again
– No changes in document start writing
cookbooks
32. GenericTYPO3
Cookbook
1. Install Packages for Apache, MySQL, PHP
2. Provision Webspace(s) and vhost(s)
3. Provision MySQL Database(s)
4. DownloadTYPO3 sources (or use Composer)
5. Clone your Git project
33. “The punkt.de way”
• Project configuration in JSON files (DataBags)
• Each developer works on multiple projects
• Each developer has individual projects list
34. “The punkt.de way”
• Vagrant Box == Hosting Server
• Provisioning with Chef
• Chef recipes also used for Jenkins
35. “The punkt.de way”
• Project files on Host
– NFS mount intoVagrant Box
– No problems with IDE & Git
– Faster provisioning after vagrant destroy
36. “The punkt.de way”
• Next steps
– Provisioning of hosting servers with Chef
– BuildingVagrant Boxes on CI Server
– Vagrant Boxes for customers
– Codecoon
37.
38. The nice things…
• Multi-Machine setup
• Remote Debugging with PHPStorm
• Local Project Files
• Git GUIs
• Ships with all the tools
– Node.js, grunt, bower, xdebug, …
39. Biggest Pain: File Mounts
• 3 solutions
– VirtualBox /VMWare shared folders
– Samba Mounts
– NFS Mounts
• Files in Box -- Mount on Host
• Files on Host -- Mount in Box
40. Codecoon
Make it fun to code again!
• Ready-to-use Vagrant Boxes
• Identical to hosting environment
• One-click deployment
• Try it www.codecoon.com
41. Summary
• Vagrant is a great tool for portable boxes
• Chef can help you manage your configuration
• „Infrastructure as Code“
• Same environment on dev and production
• DevOps brings devs and admins together
Hinweis der Redaktion
In our company, we started to use Vagrant for a project that simply took too long to be set up on our developers‘ laptops.
We wanted to work on this projects with a group of developers that should change in each sprint.
After we introduced Vagrant for the installation of the project on the developers‘ machines, we reduced the time required for installation from 1 day to about 15 minutes.
Besides the reduced installation time, we could be sure that every change of the configuration took effect immediately on all the developer machines.
This slide is presenting the stack of software that we use for the Vagrant Boxes in our company.
Go to the respective project website to get more information on the components.
The main aspects of Vagrant is the BUILDING and the DISTRIBUTION of whole work environments.
By well established tools, I‘m talking about software like VirtualBox, VMWare or Chef and Puppet.
This slide shows an overview of the components that make up a Vagrant installation.
See the following slides for the details of each component.
Boxes are the base images that are used in the virtualization software. They include the operating system and probably most of the packages and services that you need on the boxes to be running (e.g. MySQL Server, Apache Webserver...)
There is a website with a lot of pre-build boxes that you can build your customized boxes upon: http://vagrantbox.es
The Vagrantfile configures your Vagrant project. All settings for VirtualBox and the provisioning process are included in this file. It‘s a very simply Ruby script.
When Vagrant is run, it uses the commands provided in this file to bring up the box.
Besides the box itself, you can set parameters for VirtualBox to match the requirements for your box (e.g. the network settings of virtual box...)
Provisioners are used to run the configuration management inside the Vagrant box. In the following slides, we will use Chef as a provisioner. There exist other provisioners for different configuration management tools.
Provisioners are not only run, if the box is booted, but you can trigger them later on (inside the running box), if your configuration has changed (e.g. add an additional database to a running box)
We only talk about the provider for VirtualBox in these slides. I don‘t have any experience with different providers.
One of the main aspects of Chef is to follow the principle, that you should put EVERYTHING into version control. Chef helps you to put the configuration for your hardware (or virtualized) infrastructure into Version Control.
When using Chef for your hardware infrastructure you will probably rely on the Client / Server architecture of Chef, where the Client (run on each server to be provisioned by Chef) will repeatly pull its configuration from the Chef server.
In our scenario, we use chef-solo, a tool that kind of combines the Chef Server and the Chef Client in a single tool for handier use inside the Vagrant Boxes. When using chef-solo, you do not have to set up a Chef Server.
This slide explains how to mount a folder from your Host system (the system on which you run VirtualBox) into your guest system (the Vagrant Box) using a configuration inside the Vagrant File. For more information on synched folders go to http://docs.vagrantup.com/v2/synced-folders/index.html
As explained earlier, we will use Chef for the provisioning of the box. The second code snippet shows how we can use chef-solo during the provisioning step inside the Vagrantfile
This slide shows the whole process of Chef Provisioning
Vagrant tells VirtualBox, to start the respective virtual machine that we use for our Vagrant Box
The folders configured as synched folders will be mounted inside the Vagrant Box
Vagrant triggers chef-solo inside the running Vagrant Box
Chef-solo will then use the previously mounted Cookbooks to do the provisioning of the Vagrant Box