1. LONG LIFE TO VAGRANT…
VAGRANT IS DEAD
federico.panini@fazland.com - CTO
Development boxes and modern software
lifecycle development techniques.
How our development
team grew up and how we evolved
our development stack.
4. federico.panini@fazland.com - CTO
Fazland is a marketplace where customers
find the right professional for all their daily
projects and smart professionals find new
clients, while promoting quality, merit and
transparency
5. How many of you use Vagrant ?
federico.panini@fazland.com - CTO
6. How many of you don’t use Vagrant ?
federico.panini@fazland.com - CTO
7. federico.panini@fazland.com - CTO
Martin Fawler
“…This kind of delivery thinking has long been a forgotten corner
of software development, falling into a hole between developers
and operations teams. So it’s no surprise that the techniques in this
book rest upon bringing these teams together—a harbinger of the
nascent but growing DevOps movement.”
Foreword by Martin Fawler in
Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation.
by David Farley; Jez Humble
8. federico.panini@fazland.com - CTO
Continuous Integration:
Improving Software Quality and
Reducing Risk.
by Andrew Glover , Steve
Matyas , Paul M. Duvall
Publisher: Addison-Wesley
Professional Published: June
2007
9. federico.panini@fazland.com - CTO
Continuous Delivery: Reliable
Software Releases through
Build, Test, and Deployment
Automation.
by David Farley; Jez Humble
Published by Addison-Wesley
Professional, 2010
23. federico.panini@fazland.com - CTO
Virtual Machines
Type 1 hypervisor: hypervisors run directly on the system
hardware. A “bare metal” embedded hypervisor
Type 2 hypervisor: hypervisors run on a host operating system
that provides virtualisation services, such as I/O device support
and memory management.
24. Vagrant is responsible for managing and build efficiently Virtual
Machines from the CLI. This is has been for years the most used tools
for DEVELOPERS to create consistent development environments.
federico.panini@fazland.com - CTO
What is Vagrant ?
25. Dependencies and Configuration Isolation
federico.panini@fazland.com - CTO
What is Vagrant ? (DEVS PofV)
All the dependencies and all the configurations files are
isolated from the host OS.
28. Testing Management Infrastructure
Scripts of your Consistent Workflows
federico.panini@fazland.com - CTO
What is Vagrant ? (OPS PofV)
You could test your infrastructure script with a solid, efficient
environment, you can tests your chef or puppet scripts. You can also
tests the same stuff on the cloud, AWS or other providers, which have
the same workflow.
32. federico.panini@fazland.com - CTO
No source control repo
source files managed in a folder backed up with ZIP files
F
A
Z
L
A
N
D
2
0
1
3
FAZLAND … the story so far
33. federico.panini@fazland.com - CTO
No development environment
the very first source files were from another developer
F
A
Z
L
A
N
D
2
0
1
3
FAZLAND … the story so far
34. federico.panini@fazland.com - CTO
1 developer, 1 CTO, 1 ops, 1 ….
just me!
F
A
Z
L
A
N
D
2
0
1
3
no need to change this stack….
FAZLAND … the story so far
36. federico.panini@fazland.com - CTO
how to manage source files ?
how to manage development environment ?
what about server configuration ?
what about application library dependencies ?
how can I remember all the configurations lost ?
what about if my development MAC will crash ?
what about the time and cost of restoring all the environment ?
F
A
Z
L
A
N
D
2
0
1
3
FAZLAND … the story so far
37. what about if my development MAC will
crash ?
federico.panini@fazland.com - CTO
FAZLAND … the story so far
F
A
Z
L
A
N
D
2
0
1
3
39. federico.panini@fazland.com - CTO
I started managing source code consistently.
I started managing development environment consistently and
isolated…. A black box with all the “secrets” about configuration
& co. hidden to the developer. A solid env with clear
dependencies and configuration.
F
A
Z
L
A
N
D
2
0
1
3
FAZLAND … the story so far
41. federico.panini@fazland.com - CTO
FAZLAND … the story so far
F
A
Z
L
A
N
D
2
0
1
3
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
config.vm.box = “ubuntu/precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :forwarded_port, guest: 80, host: 8383
config.vm.network :forwarded_port, guest: 3306, host: 3306
config.vm.network :forwarded_port, guest: 27017, host: 27017
config.vm.network :private_network, ip: "192.168.0.10"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
end
end
42. application in 2013 — Monolith development stack and application
federico.panini@fazland.com - CTO
FAZLAND … the story so far
F
A
Z
L
A
N
D
2
0
1
3
43. federico.panini@fazland.com - CTO
FAZLAND … the story so far
F
A
Z
L
A
N
D
2
0
1
5
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.ssh.forward_agent = true
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.base_mac="0800271AB2AC"
config.vm.provider "virtualbox" do |vb|
# vb.gui = true
vb.customize ["modifyvm", :id, "--memory", “8192"]
vb.customize ["modifyvm", :id, "--cpus", "4"]
end
config.vm.provision :ansible do |ansible|
ansible.playbook = "provision/mainVagrant.yml"
ansible.verbose = "vvvv"
end
end
44. application in 2015 — Monolith + first micro services
federico.panini@fazland.com - CTO
FAZLAND … the story so far
F
A
Z
L
A
N
D
2
0
1
5
45. federico.panini@fazland.com - CTO
FAZLAND … the story so far
F
A
Z
L
A
N
D
2
0
1
6
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
config.vm.box = “ubuntu/xenial64”
config.ssh.forward_agent = true
config.vm.network "private_network", ip: "192.168.33.50"
config.vm.base_mac="0800271AB2AC"
config.vm.synced_folder "./", "/vagrant", :nfs => true
config.vm.provider "virtualbox" do |vb|
# vb.gui = true
vb.customize ["modifyvm", :id, "--memory", "4096"]
vb.customize ["modifyvm", :id, "--cpus", "4"]
end
config.vm.provision :ansible do |ansible|
ansible.playbook = "provision/mainVagrant.yml"
ansible.verbose = "vvvv"
end
end
46. application in 2016 —- monolith + microservices + DOCKER AS R&D project
federico.panini@fazland.com - CTO
FAZLAND … the story so far
F
A
Z
L
A
N
D
2
0
1
6
49. federico.panini@fazland.com - CTO
FAZLAND … the story so far
F
A
Z
L
A
N
D
N
O
W
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = “ubuntu/xenial64"
config.ssh.forward_agent = true
config.ssh.forward_x11 = true
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.base_mac="0800271AB2AC"
config.vm.synced_folder "./", "/vagrant", :nfs => true
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
end
config.vm.provision :ansible do |ansible|
ansible.playbook = "provision/mainVagrant.yml"
ansible.verbose = "vvvv"
end
config.vm.provision :shell, :inline => "sudo rm /etc/localtime && sudo ln -s /
usr/share/zoneinfo/Europe/Rome /etc/localtime", run: "always"
config.vm.provision "shell", run: "always" do |s|
s.inline = '
sudo mount -t ramfs none /opt/sycache -o "mode=0777" ;
sudo service nginx restart
'
end
end
50. application in 2018 - monolith + microservices
federico.panini@fazland.com - CTO
F
A
Z
L
A
N
D
N
O
W
55. federico.panini@fazland.com - CTO
VAGRANT AND DOCKER
F
A
Z
L
A
N
D
N
O
W
Vagrant Docker
Virtualization Virtual machine Linux container
Resource isolation Strong Weak (shared kernel)
Startup time Minutes Seconds
Image build time 10+ minutes mins
Size 1GB+ 100MB+
Sharing Vagrant Cloud Docker Hub
56. • run on top of VM (hypervisor type 2)
• vagrant manage VM’s
• has complete ISOLATION, guest VM
• kernel separated from HOST VM
• it needs some GB of space
• turn on env in minutes
• Linux, Windows, OSX
federico.panini@fazland.com - CTO
VAGRANT AND DOCKER
F
A
Z
L
A
N
D
N
O
W
• uses containers, similar to LXC
• Docker manage container
• less isolation, process isolation
• shared kernel model
• lightweight environment
• turn on env in minutes
• Linux, OSX (slow),
60. federico.panini@fazland.com - CTO
Deployment Pipeline
“It is the process for getting software
from version control
into the hands of your users.”
Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation.
by David Farley; Jez Humble
67. • Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment
Automation. by David Farley; Jez Humble
Published by Addison-Wesley Professional, 2010
• Continuous Integration: Improving Software Quality and Reducing Risk. by Andrew Glover
, Steve Matyas , Paul M. Duvall Publisher: Addison-Wesley Professional Published: June
2007
• https://www.vagrantup.com/intro/index.html
• https://en.wikipedia.org/wiki/Virtual_machine
• https://github.com/hashicorp/vagrant/issues/8788
• https://groups.google.com/forum/#!topic/vagrant-up/UgINc-ppptU
• http://mitchellh.com/comparing-filesystem-performance-in-virtual-machines
• https://hackernoon.com/how-to-create-consistent-development-environments-that-just-
work-55be5417341b
• https://martinfowler.com/bliki/MicroservicePrerequisites.html
• https://martinfowler.com/bliki/MonolithFirst.html
federico.panini@fazland.com - CTO
References
69. federico.panini@fazland.com - CTO
FAZLAND current Deployment Pipeline
Legacy NG + Api
2 different stacks living together
both environments uses micro services for sending email,
manage notifications to browser or mobile app… etc
70. federico.panini@fazland.com - CTO
FAZLAND current Deployment Pipeline
1. developers works on features tickets
2. developers tests their tickets
3. developers merge the feature tickets on develop branch.
4. Before merge a git pre-commit hook will be invoked and re-
executes all tests.
D
E
V
E
L
O
P
M
E
N
T
71. federico.panini@fazland.com - CTO
FAZLAND current Deployment Pipeline
If tests fails the branch will not be merged.
D
E
V
E
L
O
P
M
E
N
T
if test succeed the feature branch will be merged on develop.
72. federico.panini@fazland.com - CTO
FAZLAND current Deployment Pipeline
1. when features branches are merged on develop a web hook is invoked
and a stage environment on AWS will fetch the updates and re-create the
environment updated with the latests stuff.
2. during deployment on stage tests (unit, functional and integrations) are
executed
3. if the process succeed a new fresh Stage environment is ready to be
tested by our Product Team
4. When the Product team Validate the tickets a new release will be created,
the master branch will be updated with new stuff and a new tag is created.
S
T
A
G
E
73. federico.panini@fazland.com - CTO
FAZLAND current Deployment Pipeline
1. every time a new Tag is pushed on remote, a web hook against AWS is
called. And through AWS CodePipeline we start to deploy on production the
new features.
2. the same thing happen with our legacy environment with the difference that
the deploy is done with Capistrano, on pure EC2 instances.if the process
succeed a new fresh Stage environment is ready to be tested by our Product
Team
3. AWS CodePipeline will fetch the new release, make the build (in fact re-
execute tests) and if they succeed update our AWS ECS, draining old images
and creating new ones.
P
R
O
D
U
C
T
I
O
N