Upload
jean-christophe-cuvelier
View
1.086
Download
2
Embed Size (px)
Citation preview
Symfony development with Vagrant and Ansible
Symfony User Group Belgium Meetup - http://symfonians.be January 2014
Me, myself and IJean-Christophe Cuvelier Partner @ Morris & Chapman Belgium Founder @ Pictawall.com
!• Web entrepreneur • Begun with a Commodore 64 • Creative PHP developer
! be.linkedin.com/in/totophe ! github.com/totophe ! @totophe
Vagrant“Vagrant provides easy to configure, reproducible, and portable work environments built on top of industry-standard technology and controlled by a single consistent workflow to help maximize the productivity and flexibility of you and your team.” !Basically, Vagrant is a nice way to create virtual machines on the fly, and distribute a common configuration across multiple developers to avoid the “But it work on my machine” famous quote.
Getting started with Vagrant
• vagrant init mymachine http://files.vagrantup.com/precise64.box
• vagrant up
• Vagrantfile
• vagrant halt
• vagrant destroy
Some Vagrantfile recipes • Forwarding a local port:
config.vm.network :forwarded_port, guest: 80, host: 81
• Adding a dedicated private ip:
config.vm.network "private_network", ip: “192.168.100.100"
• Provisioning with a shell script:
config.vm.provision :shell, :path => “db.sh"
• Changing the memory for the virtual machine
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
Ansible
“Ansible is the simplest way to automate.”
Ansible is a provisioning system that allows you to create recipes to build a specific environment and to replicate it on as many machines as you want. It allows you to build a very specific version of a system and to ensure that this configuration works with your project.
Getting started with Ansible
• hosts file
• ansible all -m ping -i hosts
• ansible-playbook playbook.yml -i hosts
• ansible folder structure with tasks & templates using Yaml and Jinja2 (very similar to Twig*)
* Obviously, Twig is based on Jinja2
Ansible with Vagrant
config.vm.provision "ansible" do |ansible|
ansible.playbook = "provisioning/playbook.yml"
ansible.extra_vars = {private_interface: "192.168.100.1"}
end
Ansible with Vagrant and Symfony
Symfony with Vagrant and Ansible
https://github.com/symfonians/symfony-vagrant-ansible
!
git clone https://github.com/symfonians/symfony-vagrant-ansible.git
vagrant up
Thank [email protected] - @totophe
be.linkedin.com/in/totophe - github.com/totophe
http://www.meetup.com/Symfony-User-Group-Belgium/