SlideShare a Scribd company logo
1 of 43
VAGRANT
3rd WEEK
SATURDAY, JULY 06, 2013 – SUNDAY, JULY 07, 2013
GEEK ACADEMY 2013
INSTRUCTOR TEAM
TAVEE SOMKIAT THAWATCHAI
Tavee (Vee) Khunbida Somkiat (Pui) Puisungnuen Thawatchai (Boy) Jongsuwanpaisan
Siam Chamnan Kit
tavee@sprint3r.com
Siam Chamnan Kit
somkiat@sprint3r.com
Siam Chamnan Kit
thawatchai@sprint3r.com
What Vagrant ?
o http://www.vagrantup.com/
o Based on VirtualBox and Ruby
o Manage VM with Simple Command line
o Run on
o Windows
o Linux
o Mac OS
VAGRANT
101
GEEK ACADEMY 2013
Simple Command Line
$ gem install vagrant
$ vagrant box add base <box url>
$ vagrant init
$ vagrant up
Step 1 :: Installation with Ruby Gem
$ gem install vagrant
Step 2 :: Add Base Box
$ vagrant box add base
http://files.vagrantup.com/precise32.box
…….
[vagrant] Downloading withVagrant::Downloaders::File...
[vagrant] Copying box to temporary location...
[vagrant] Extracting box...
[vagrant]Verifying box...
[vagrant] Cleaning up downloaded box...
Step 2.1 :: Where is my box ?
o http://www.vagrantbox.es/
Step 3 :: Configuration
$ vagrant init
…..
A `Vagrantfile` has been placed in this directory.You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in theVagrantfile as well as documentation on
`vagrantup.com` for more information on usingVagrant.
Vagrantfile
Vagrant::Config.run do |config|
config.vm.box = "base“
end
Step 4 :: Boot
$ vagrant up
….
[default] Importing base box 'base'...
[default] Matching MAC address for NAT networking...
[default] Clearing any previously set forwarded ports...
[default] Fixed port collision for 22 => 2222. Now on port 2200.
[default] Forwarding ports...
[default] -- 22 => 2200 (adapter 1)
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] BootingVM...
[default] Waiting forVM to boot.This can take a few minutes.
Ready to SSH
User=vagrant
Password=vagrant
Optional Command
$ vagrant status
$ vagrant halt
$ vagrant destroy
$ vagrant reload
$ vagrant provision
$ vagrant suspend
$ vagrant resume
Summary for 101
o Reduce setup time
o Simple
o Self-service
o Consistency
o Repeat
VAGRANT
201
GEEK ACADEMY 2013
https://github.com/up1/geeky_devops
Working with Vagrantfile
o Specified base box
o Network Configuration
o Sharing Folder
o MultipleVM
Specified Base Box
Vagrant::Config.run do |config|
config.vm.box = "lucid32“
config.vm.box_url =
"http://files.vagrantup.com/lucid32.box"
config.vm.box_url = "c:demo-geekylucid32.box"
end
Network Configuration
Vagrant::Config.run do |config|
config.vm.network :hostonly, "33.33.33.10"
end
Sharing Folder
Vagrant::Config.run do |config|
config.vm.share_folder "foo", "/guest/path", "/host/path"
end
Path on VM Path on Local
Sharing Folder
Vagrant::Config.run do |config|
config.vm.share_folder "work",
"/var/www",
"./webapp”
end
Multiple VM in Stack
o Web Server
o Application Server
o Database Server
o Caching Server
o Messaging Server
Web Server and DB Server
Vagrant::Config.run do |config|
config.vm.define :web do |web_config|
web_config.vm.host_name = "web01.internal"
web_config.vm.network :hostonly, "192.168.0.100"
end
config.vm.define :db do |db_config|
db_config.vm.host_name = "db01.internal"
db_config.vm.network :hostonly, "192.168.0.101"
end
end
DEMO MORE
o Flexible configuration
o # of Server
o Hostname
o Manage IP
DEMO MORE
o Web Server
o web-01.vagrant.internal 33.33.33.11
o web-02.vagrant.internal 33.33.33.12
o DB Server
o db-01.vagrant.internal 33.33.33.21
Servers
nodes = {
'web' => [2, 10],
'db' => [1, 20],
}
Create Servers
nodes.each do |prefix, (count, ip_start)|
count.times do |i|
hostname = "%s-%02d" % [prefix, (i+1)]
config.vm.define "#{hostname}" do |box|
box.vm.host_name = "#{hostname}.vagrant.internal"
box.vm.network :hostonly, "33.33.33.#{ip_start+i}“
end
end
end
VAGRANT
301
GEEK ACADEMY 2013
Vagrant with Puppet
o https://puppetlabs.com
o Configuration management with Code
o Ruby
o Repeatable
Demo :: Install all in one
o Manage package with Puppet
o Java
o Apache Tomcat
o Redis
o RabbitMQ
https://github.com/up1/geeky_devops
demo-puppet
Structure of Puppet
o puppet
o manifests/default.pp
o modules
o java
o manifests/init.pp
o tomcat
o manifests/init.pp
o redis
o manifests/init.pp
o rabbitMQ
o manifests/init.pp
Starting point
Vagrantfile
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.manifest_file = "default.pp"
puppet.module_path = "puppet/modules"
end
Vagrant provision
Starting point
Default.pp
include bootstrap
include redis
include java
include tomcat
include rabbitmq
Step to execute
modules
Structure of Puppet
o puppet
o manifests/default.pp
o modules
o java
o manifests/init.pp
o tomcat
o manifests/init.pp
o redis
o manifests/init.pp
o rabbitMQ
o manifests/init.pp
Starting point
each module
Init.pp :: Java
class java {
package { "openjdk-7-jdk":
ensure => installed,
require => Exec['apt-get update']
}
}
Init.pp :: Package Apache Tomcat
class tomcat {
package { "tomcat6":
ensure => installed,
require => Package['openjdk-7-jdk'],
}
package { "tomcat6-admin":
ensure => installed,
require => Package['tomcat6'],
}
}
Init.pp :: Service Apache Tomcat
class tomcat {
service { "tomcat6":
ensure => running,
require => Package['tomcat6'],
subscribe => File["tomcat-users.xml"]
}
}
Init.pp :: Tomcat-users.xml
class tomcat {
file { "tomcat-users.xml":
owner => 'root',
path => '/etc/tomcat6/tomcat-users.xml',
require => Package['tomcat6'],
notify => Service['tomcat6'],
content => template(
'/path/tomcat/templates/tomcat-
users.xml.erb')
}
}
Tomcat-users.xml.erb
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager"/>
<role rolename="admin"/>
<user name="tomcat-admin" password="12345"
roles="manager,admin"/>
</tomcat-users>
More Demo
o https://github.com/up1/geeky_devops
o demo-multi-puppet
box.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.manifest_file = "#{prefix}.pp"
puppet.module_path = "puppet/modules"
end
Question ?
GEEK ACADEMY 2013
THANK YOU
FOR
YOUR TIME
GEEK ACADEMY 2013

More Related Content

What's hot

Remote pairing from the comfort of your own shell
Remote pairing from the comfort of your own shellRemote pairing from the comfort of your own shell
Remote pairing from the comfort of your own shellevanlight
 
Vagrant: Your Personal Cloud
Vagrant: Your Personal CloudVagrant: Your Personal Cloud
Vagrant: Your Personal CloudJames Wickett
 
Plone Deployment Secrets & Tricks
Plone Deployment Secrets & TricksPlone Deployment Secrets & Tricks
Plone Deployment Secrets & TricksSteve McMahon
 
Oops Youve Got A Mobile Enterprise App – DevFestWeekend 2018
Oops Youve Got A Mobile Enterprise App – DevFestWeekend 2018Oops Youve Got A Mobile Enterprise App – DevFestWeekend 2018
Oops Youve Got A Mobile Enterprise App – DevFestWeekend 2018Adam Hill
 
CRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual MachineCRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual MachineGR8Conf
 
Tmux and Tmuxinator ~ Rise of the Machines
Tmux and Tmuxinator  ~ Rise of the MachinesTmux and Tmuxinator  ~ Rise of the Machines
Tmux and Tmuxinator ~ Rise of the MachinesBrian Loomis
 
CRaSH the shell for the JVM
CRaSH the shell for the JVMCRaSH the shell for the JVM
CRaSH the shell for the JVMjviet
 
Create connected home devices using a Raspberry Pi, Siri and ESPNow for makers.
Create connected home devices using a Raspberry Pi, Siri and ESPNow for makers.Create connected home devices using a Raspberry Pi, Siri and ESPNow for makers.
Create connected home devices using a Raspberry Pi, Siri and ESPNow for makers.Nat Weerawan
 
High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”
High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”
High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”Valent Mustamin
 
Netpie.io Generate MQTT Credential
Netpie.io Generate MQTT CredentialNetpie.io Generate MQTT Credential
Netpie.io Generate MQTT CredentialNat Weerawan
 
Vagrant 101 Workshop
Vagrant 101 WorkshopVagrant 101 Workshop
Vagrant 101 WorkshopLiora Milbaum
 
WooCommerce WP-CLI Basics
WooCommerce WP-CLI BasicsWooCommerce WP-CLI Basics
WooCommerce WP-CLI Basicscorsonr
 

What's hot (20)

Remote pairing from the comfort of your own shell
Remote pairing from the comfort of your own shellRemote pairing from the comfort of your own shell
Remote pairing from the comfort of your own shell
 
Vagrant: Your Personal Cloud
Vagrant: Your Personal CloudVagrant: Your Personal Cloud
Vagrant: Your Personal Cloud
 
What The Web!
What The Web!What The Web!
What The Web!
 
Plone Deployment Secrets & Tricks
Plone Deployment Secrets & TricksPlone Deployment Secrets & Tricks
Plone Deployment Secrets & Tricks
 
Oops Youve Got A Mobile Enterprise App – DevFestWeekend 2018
Oops Youve Got A Mobile Enterprise App – DevFestWeekend 2018Oops Youve Got A Mobile Enterprise App – DevFestWeekend 2018
Oops Youve Got A Mobile Enterprise App – DevFestWeekend 2018
 
CRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual MachineCRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual Machine
 
Tmux and Tmuxinator ~ Rise of the Machines
Tmux and Tmuxinator  ~ Rise of the MachinesTmux and Tmuxinator  ~ Rise of the Machines
Tmux and Tmuxinator ~ Rise of the Machines
 
CRaSH the shell for the JVM
CRaSH the shell for the JVMCRaSH the shell for the JVM
CRaSH the shell for the JVM
 
MAGA - PUG Roma giugno 2017
MAGA - PUG Roma giugno 2017MAGA - PUG Roma giugno 2017
MAGA - PUG Roma giugno 2017
 
Jetty and Tomcat
Jetty and TomcatJetty and Tomcat
Jetty and Tomcat
 
Create connected home devices using a Raspberry Pi, Siri and ESPNow for makers.
Create connected home devices using a Raspberry Pi, Siri and ESPNow for makers.Create connected home devices using a Raspberry Pi, Siri and ESPNow for makers.
Create connected home devices using a Raspberry Pi, Siri and ESPNow for makers.
 
Vagrant
VagrantVagrant
Vagrant
 
High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”
High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”
High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”
 
Functional javascript
Functional javascriptFunctional javascript
Functional javascript
 
Web socket with php v2
Web socket with php v2Web socket with php v2
Web socket with php v2
 
Plone pwns
Plone pwnsPlone pwns
Plone pwns
 
Netpie.io Generate MQTT Credential
Netpie.io Generate MQTT CredentialNetpie.io Generate MQTT Credential
Netpie.io Generate MQTT Credential
 
Vagrant
VagrantVagrant
Vagrant
 
Vagrant 101 Workshop
Vagrant 101 WorkshopVagrant 101 Workshop
Vagrant 101 Workshop
 
WooCommerce WP-CLI Basics
WooCommerce WP-CLI BasicsWooCommerce WP-CLI Basics
WooCommerce WP-CLI Basics
 

Viewers also liked

Aht Durango
Aht DurangoAht Durango
Aht Durangonarri
 
PROEXPOSURE International day of the girl: the mountain
PROEXPOSURE International day of the girl: the mountainPROEXPOSURE International day of the girl: the mountain
PROEXPOSURE International day of the girl: the mountainPROEXPOSURE CIC
 
Fundamentos de elearning
Fundamentos de elearningFundamentos de elearning
Fundamentos de elearningJose Contreras
 
Отечественная и зарубежная законодательная и нормативная база организации вне...
Отечественная и зарубежная законодательная и нормативная база организации вне...Отечественная и зарубежная законодательная и нормативная база организации вне...
Отечественная и зарубежная законодательная и нормативная база организации вне...Natasha Khramtsovsky
 
Powerpoint Presentation On Animated Flipbook Ryan Mcginty Dd07064
Powerpoint Presentation On Animated Flipbook Ryan Mcginty Dd07064Powerpoint Presentation On Animated Flipbook Ryan Mcginty Dd07064
Powerpoint Presentation On Animated Flipbook Ryan Mcginty Dd07064jaspang
 
Wordcamp St. Louis - Clean Coding
Wordcamp St. Louis - Clean CodingWordcamp St. Louis - Clean Coding
Wordcamp St. Louis - Clean Codinginspector_fegter
 
PROEXPOSURE Photos: Ethiopia
PROEXPOSURE Photos: EthiopiaPROEXPOSURE Photos: Ethiopia
PROEXPOSURE Photos: EthiopiaPROEXPOSURE CIC
 
How Scary Is It
How Scary Is ItHow Scary Is It
How Scary Is Itramlal1974
 
Pptproject flipbook nmm
Pptproject flipbook nmmPptproject flipbook nmm
Pptproject flipbook nmmjaspang
 
PROEXPOSURE Photographer Ataklti Mulu and Adigrat
PROEXPOSURE Photographer Ataklti Mulu and AdigratPROEXPOSURE Photographer Ataklti Mulu and Adigrat
PROEXPOSURE Photographer Ataklti Mulu and AdigratPROEXPOSURE CIC
 
Открытые форматы и открытое ПО: достоинства и проблемы
Открытые форматы и открытое ПО: достоинства и проблемыОткрытые форматы и открытое ПО: достоинства и проблемы
Открытые форматы и открытое ПО: достоинства и проблемыNatasha Khramtsovsky
 

Viewers also liked (20)

Maatschappelijke innovatie en armoedebestrijding - Tuur Ghys
Maatschappelijke innovatie en armoedebestrijding - Tuur GhysMaatschappelijke innovatie en armoedebestrijding - Tuur Ghys
Maatschappelijke innovatie en armoedebestrijding - Tuur Ghys
 
Aht Durango
Aht DurangoAht Durango
Aht Durango
 
Erasmus+ - volwasseneneducatie
Erasmus+ - volwasseneneducatieErasmus+ - volwasseneneducatie
Erasmus+ - volwasseneneducatie
 
PROEXPOSURE International day of the girl: the mountain
PROEXPOSURE International day of the girl: the mountainPROEXPOSURE International day of the girl: the mountain
PROEXPOSURE International day of the girl: the mountain
 
Solidariteit ruimtelijk bekeken
Solidariteit ruimtelijk bekekenSolidariteit ruimtelijk bekeken
Solidariteit ruimtelijk bekeken
 
Fundamentos de elearning
Fundamentos de elearningFundamentos de elearning
Fundamentos de elearning
 
Отечественная и зарубежная законодательная и нормативная база организации вне...
Отечественная и зарубежная законодательная и нормативная база организации вне...Отечественная и зарубежная законодательная и нормативная база организации вне...
Отечественная и зарубежная законодательная и нормативная база организации вне...
 
Powerpoint Presentation On Animated Flipbook Ryan Mcginty Dd07064
Powerpoint Presentation On Animated Flipbook Ryan Mcginty Dd07064Powerpoint Presentation On Animated Flipbook Ryan Mcginty Dd07064
Powerpoint Presentation On Animated Flipbook Ryan Mcginty Dd07064
 
Behoeftengericht en Gecoördineerd Aanbod
Behoeftengericht en Gecoördineerd AanbodBehoeftengericht en Gecoördineerd Aanbod
Behoeftengericht en Gecoördineerd Aanbod
 
Verhalentafel
VerhalentafelVerhalentafel
Verhalentafel
 
Reflecties Provinciaal Cultuurbeleid Voor Sociaal Cultureel Volwassenenwerk
Reflecties Provinciaal Cultuurbeleid Voor Sociaal Cultureel VolwassenenwerkReflecties Provinciaal Cultuurbeleid Voor Sociaal Cultureel Volwassenenwerk
Reflecties Provinciaal Cultuurbeleid Voor Sociaal Cultureel Volwassenenwerk
 
Wordcamp St. Louis - Clean Coding
Wordcamp St. Louis - Clean CodingWordcamp St. Louis - Clean Coding
Wordcamp St. Louis - Clean Coding
 
Gruppo Sicani: SportHello
Gruppo Sicani: SportHelloGruppo Sicani: SportHello
Gruppo Sicani: SportHello
 
PROEXPOSURE Photos: Ethiopia
PROEXPOSURE Photos: EthiopiaPROEXPOSURE Photos: Ethiopia
PROEXPOSURE Photos: Ethiopia
 
Jose G
Jose GJose G
Jose G
 
How Scary Is It
How Scary Is ItHow Scary Is It
How Scary Is It
 
Pptproject flipbook nmm
Pptproject flipbook nmmPptproject flipbook nmm
Pptproject flipbook nmm
 
Gedeelde waarde creëren samen met je stakeholders
Gedeelde waarde creëren samen met je stakeholdersGedeelde waarde creëren samen met je stakeholders
Gedeelde waarde creëren samen met je stakeholders
 
PROEXPOSURE Photographer Ataklti Mulu and Adigrat
PROEXPOSURE Photographer Ataklti Mulu and AdigratPROEXPOSURE Photographer Ataklti Mulu and Adigrat
PROEXPOSURE Photographer Ataklti Mulu and Adigrat
 
Открытые форматы и открытое ПО: достоинства и проблемы
Открытые форматы и открытое ПО: достоинства и проблемыОткрытые форматы и открытое ПО: достоинства и проблемы
Открытые форматы и открытое ПО: достоинства и проблемы
 

Similar to Vagrant 101 and 201 documentation

Vagrant for real
Vagrant for realVagrant for real
Vagrant for realCodemotion
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Michele Orselli
 
Vagrant introduction for Developers
Vagrant introduction for DevelopersVagrant introduction for Developers
Vagrant introduction for DevelopersAntons Kranga
 
Vagrant and Configuration Management
Vagrant and Configuration ManagementVagrant and Configuration Management
Vagrant and Configuration ManagementGareth Rushgrove
 
Minicurso de Vagrant
Minicurso de VagrantMinicurso de Vagrant
Minicurso de VagrantLeandro Nunes
 
Environments line-up! Vagrant & Puppet 101
Environments line-up! Vagrant & Puppet 101Environments line-up! Vagrant & Puppet 101
Environments line-up! Vagrant & Puppet 101jelrikvh
 
Openstack Vagrant plugin overview
Openstack Vagrant plugin overviewOpenstack Vagrant plugin overview
Openstack Vagrant plugin overviewMarton Kiss
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Michele Orselli
 
Open stack and_vagrant-os-meetup-2015
Open stack and_vagrant-os-meetup-2015Open stack and_vagrant-os-meetup-2015
Open stack and_vagrant-os-meetup-2015yfauser
 
Vagrant - Version control your dev environment
Vagrant - Version control your dev environmentVagrant - Version control your dev environment
Vagrant - Version control your dev environmentbocribbz
 
Config managament for development environments iii
Config managament for development environments iiiConfig managament for development environments iii
Config managament for development environments iiiPuppet
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Carlos Sanchez
 
Quick & Easy Dev Environments with Vagrant
Quick & Easy Dev Environments with VagrantQuick & Easy Dev Environments with Vagrant
Quick & Easy Dev Environments with VagrantJoe Ferguson
 
Vagrant & Reusable Code
Vagrant & Reusable CodeVagrant & Reusable Code
Vagrant & Reusable CodeCorley S.r.l.
 
Vagrant-Overview
Vagrant-OverviewVagrant-Overview
Vagrant-OverviewCrifkin
 

Similar to Vagrant 101 and 201 documentation (20)

Vagrant for real
Vagrant for realVagrant for real
Vagrant for real
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Vagrant Up in 5 Easy Steps
Vagrant Up in 5 Easy StepsVagrant Up in 5 Easy Steps
Vagrant Up in 5 Easy Steps
 
Vagrant
Vagrant Vagrant
Vagrant
 
Vagrant introduction for Developers
Vagrant introduction for DevelopersVagrant introduction for Developers
Vagrant introduction for Developers
 
Vagrant and Configuration Management
Vagrant and Configuration ManagementVagrant and Configuration Management
Vagrant and Configuration Management
 
Minicurso de Vagrant
Minicurso de VagrantMinicurso de Vagrant
Minicurso de Vagrant
 
Introduction to Vagrant
Introduction to VagrantIntroduction to Vagrant
Introduction to Vagrant
 
Using vagrant
Using vagrantUsing vagrant
Using vagrant
 
Environments line-up! Vagrant & Puppet 101
Environments line-up! Vagrant & Puppet 101Environments line-up! Vagrant & Puppet 101
Environments line-up! Vagrant & Puppet 101
 
Openstack Vagrant plugin overview
Openstack Vagrant plugin overviewOpenstack Vagrant plugin overview
Openstack Vagrant plugin overview
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
 
Open stack and_vagrant-os-meetup-2015
Open stack and_vagrant-os-meetup-2015Open stack and_vagrant-os-meetup-2015
Open stack and_vagrant-os-meetup-2015
 
Vagrant - Version control your dev environment
Vagrant - Version control your dev environmentVagrant - Version control your dev environment
Vagrant - Version control your dev environment
 
Config managament for development environments iii
Config managament for development environments iiiConfig managament for development environments iii
Config managament for development environments iii
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
 
Vagrant
VagrantVagrant
Vagrant
 
Quick & Easy Dev Environments with Vagrant
Quick & Easy Dev Environments with VagrantQuick & Easy Dev Environments with Vagrant
Quick & Easy Dev Environments with Vagrant
 
Vagrant & Reusable Code
Vagrant & Reusable CodeVagrant & Reusable Code
Vagrant & Reusable Code
 
Vagrant-Overview
Vagrant-OverviewVagrant-Overview
Vagrant-Overview
 

More from Somkiat Puisungnoen (20)

Next of Java 2022
Next of Java 2022Next of Java 2022
Next of Java 2022
 
Sck spring-reactive
Sck spring-reactiveSck spring-reactive
Sck spring-reactive
 
Part 2 :: Spring Boot testing
Part 2 :: Spring Boot testingPart 2 :: Spring Boot testing
Part 2 :: Spring Boot testing
 
vTalk#1 Microservices with Spring Boot
vTalk#1 Microservices with Spring BootvTalk#1 Microservices with Spring Boot
vTalk#1 Microservices with Spring Boot
 
Lesson learned from React native and Flutter
Lesson learned from React native and FlutterLesson learned from React native and Flutter
Lesson learned from React native and Flutter
 
devops
devops devops
devops
 
Angular :: basic tuning performance
Angular :: basic tuning performanceAngular :: basic tuning performance
Angular :: basic tuning performance
 
Shared code between projects
Shared code between projectsShared code between projects
Shared code between projects
 
Distributed Tracing
Distributed Tracing Distributed Tracing
Distributed Tracing
 
Manage data of service
Manage data of serviceManage data of service
Manage data of service
 
RobotFramework Meetup at Thailand #2
RobotFramework Meetup at Thailand #2RobotFramework Meetup at Thailand #2
RobotFramework Meetup at Thailand #2
 
Visual testing
Visual testingVisual testing
Visual testing
 
Cloud Native App
Cloud Native AppCloud Native App
Cloud Native App
 
Wordpress for Newbie
Wordpress for NewbieWordpress for Newbie
Wordpress for Newbie
 
Sck Agile in Real World
Sck Agile in Real WorldSck Agile in Real World
Sck Agile in Real World
 
Clean you code
Clean you codeClean you code
Clean you code
 
SCK Firestore at CNX
SCK Firestore at CNXSCK Firestore at CNX
SCK Firestore at CNX
 
Unhappiness Developer
Unhappiness DeveloperUnhappiness Developer
Unhappiness Developer
 
The Beauty of BAD code
The Beauty of  BAD codeThe Beauty of  BAD code
The Beauty of BAD code
 
React in the right way
React in the right wayReact in the right way
React in the right way
 

Recently uploaded

Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dashnarutouzumaki53779
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 

Recently uploaded (20)

Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dash
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 

Vagrant 101 and 201 documentation

  • 1. VAGRANT 3rd WEEK SATURDAY, JULY 06, 2013 – SUNDAY, JULY 07, 2013 GEEK ACADEMY 2013
  • 2. INSTRUCTOR TEAM TAVEE SOMKIAT THAWATCHAI Tavee (Vee) Khunbida Somkiat (Pui) Puisungnuen Thawatchai (Boy) Jongsuwanpaisan Siam Chamnan Kit tavee@sprint3r.com Siam Chamnan Kit somkiat@sprint3r.com Siam Chamnan Kit thawatchai@sprint3r.com
  • 3.
  • 4. What Vagrant ? o http://www.vagrantup.com/ o Based on VirtualBox and Ruby o Manage VM with Simple Command line o Run on o Windows o Linux o Mac OS
  • 6. Simple Command Line $ gem install vagrant $ vagrant box add base <box url> $ vagrant init $ vagrant up
  • 7. Step 1 :: Installation with Ruby Gem $ gem install vagrant
  • 8. Step 2 :: Add Base Box $ vagrant box add base http://files.vagrantup.com/precise32.box ……. [vagrant] Downloading withVagrant::Downloaders::File... [vagrant] Copying box to temporary location... [vagrant] Extracting box... [vagrant]Verifying box... [vagrant] Cleaning up downloaded box...
  • 9. Step 2.1 :: Where is my box ? o http://www.vagrantbox.es/
  • 10. Step 3 :: Configuration $ vagrant init ….. A `Vagrantfile` has been placed in this directory.You are now ready to `vagrant up` your first virtual environment! Please read the comments in theVagrantfile as well as documentation on `vagrantup.com` for more information on usingVagrant.
  • 12. Step 4 :: Boot $ vagrant up …. [default] Importing base box 'base'... [default] Matching MAC address for NAT networking... [default] Clearing any previously set forwarded ports... [default] Fixed port collision for 22 => 2222. Now on port 2200. [default] Forwarding ports... [default] -- 22 => 2200 (adapter 1) [default] Creating shared folders metadata... [default] Clearing any previously set network interfaces... [default] BootingVM... [default] Waiting forVM to boot.This can take a few minutes.
  • 14. Optional Command $ vagrant status $ vagrant halt $ vagrant destroy $ vagrant reload $ vagrant provision $ vagrant suspend $ vagrant resume
  • 15. Summary for 101 o Reduce setup time o Simple o Self-service o Consistency o Repeat
  • 17. Working with Vagrantfile o Specified base box o Network Configuration o Sharing Folder o MultipleVM
  • 18. Specified Base Box Vagrant::Config.run do |config| config.vm.box = "lucid32“ config.vm.box_url = "http://files.vagrantup.com/lucid32.box" config.vm.box_url = "c:demo-geekylucid32.box" end
  • 19. Network Configuration Vagrant::Config.run do |config| config.vm.network :hostonly, "33.33.33.10" end
  • 20. Sharing Folder Vagrant::Config.run do |config| config.vm.share_folder "foo", "/guest/path", "/host/path" end Path on VM Path on Local
  • 21. Sharing Folder Vagrant::Config.run do |config| config.vm.share_folder "work", "/var/www", "./webapp” end
  • 22. Multiple VM in Stack o Web Server o Application Server o Database Server o Caching Server o Messaging Server
  • 23. Web Server and DB Server Vagrant::Config.run do |config| config.vm.define :web do |web_config| web_config.vm.host_name = "web01.internal" web_config.vm.network :hostonly, "192.168.0.100" end config.vm.define :db do |db_config| db_config.vm.host_name = "db01.internal" db_config.vm.network :hostonly, "192.168.0.101" end end
  • 24. DEMO MORE o Flexible configuration o # of Server o Hostname o Manage IP
  • 25. DEMO MORE o Web Server o web-01.vagrant.internal 33.33.33.11 o web-02.vagrant.internal 33.33.33.12 o DB Server o db-01.vagrant.internal 33.33.33.21
  • 26. Servers nodes = { 'web' => [2, 10], 'db' => [1, 20], }
  • 27. Create Servers nodes.each do |prefix, (count, ip_start)| count.times do |i| hostname = "%s-%02d" % [prefix, (i+1)] config.vm.define "#{hostname}" do |box| box.vm.host_name = "#{hostname}.vagrant.internal" box.vm.network :hostonly, "33.33.33.#{ip_start+i}“ end end end
  • 29. Vagrant with Puppet o https://puppetlabs.com o Configuration management with Code o Ruby o Repeatable
  • 30. Demo :: Install all in one o Manage package with Puppet o Java o Apache Tomcat o Redis o RabbitMQ https://github.com/up1/geeky_devops demo-puppet
  • 31. Structure of Puppet o puppet o manifests/default.pp o modules o java o manifests/init.pp o tomcat o manifests/init.pp o redis o manifests/init.pp o rabbitMQ o manifests/init.pp Starting point
  • 32. Vagrantfile config.vm.provision :puppet do |puppet| puppet.manifests_path = "puppet/manifests" puppet.manifest_file = "default.pp" puppet.module_path = "puppet/modules" end Vagrant provision Starting point
  • 33. Default.pp include bootstrap include redis include java include tomcat include rabbitmq Step to execute modules
  • 34. Structure of Puppet o puppet o manifests/default.pp o modules o java o manifests/init.pp o tomcat o manifests/init.pp o redis o manifests/init.pp o rabbitMQ o manifests/init.pp Starting point each module
  • 35. Init.pp :: Java class java { package { "openjdk-7-jdk": ensure => installed, require => Exec['apt-get update'] } }
  • 36. Init.pp :: Package Apache Tomcat class tomcat { package { "tomcat6": ensure => installed, require => Package['openjdk-7-jdk'], } package { "tomcat6-admin": ensure => installed, require => Package['tomcat6'], } }
  • 37. Init.pp :: Service Apache Tomcat class tomcat { service { "tomcat6": ensure => running, require => Package['tomcat6'], subscribe => File["tomcat-users.xml"] } }
  • 38. Init.pp :: Tomcat-users.xml class tomcat { file { "tomcat-users.xml": owner => 'root', path => '/etc/tomcat6/tomcat-users.xml', require => Package['tomcat6'], notify => Service['tomcat6'], content => template( '/path/tomcat/templates/tomcat- users.xml.erb') } }
  • 39. Tomcat-users.xml.erb <?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="manager"/> <role rolename="admin"/> <user name="tomcat-admin" password="12345" roles="manager,admin"/> </tomcat-users>
  • 40. More Demo o https://github.com/up1/geeky_devops o demo-multi-puppet box.vm.provision :puppet do |puppet| puppet.manifests_path = "puppet/manifests" puppet.manifest_file = "#{prefix}.pp" puppet.module_path = "puppet/modules" end