Vagrant Up

Vagrant Up

Vagrant is a tool to create and configure development environments in a virtual machine. I'll go over the basics of vagrant plus orchestration tools like chef. I'll also show how Bloom Health uses Vagrant to help developers cope with our growing services based stack. These tools allow developers to focus on writing business logic and not worry about mysql versions and other minutiae.

E655ab825a4bd2f23b90c85d57c3ee01?s=128

Kyle Boon

April 05, 2014
Tweet

Transcript

  1. Vagrant Up! Kyle Boon

  2. Kyle Boon Team Lead @ Bloomhealth kyle.f.boon@gmail.com @kyleboon http://www.kyleboon.org

  3. Vagrant creates Virtual clouds for your workstation

  4. It works on my machine -- every developer

  5. Are you a full stack developer?

  6. None
  7. Devops is about culture; Vagrant is an enabling technology

  8. Your first Vagrant image $ v a g r a

    n t i n i t h a s h i c o r p / p r e c i s e 3 2 $ v a g r a n t u p
  9. # - * - m o d e : r

    u b y - * - # v i : s e t f t = r u b y : # V a g r a n t f i l e A P I / s y n t a x v e r s i o n . D o n ' t t o u c h u n l e s s y o u k n o w w h a t y o u ' r e d o i n g ! V A G R A N T F I L E _ A P I _ V E R S I O N = " 2 " V a g r a n t . c o n f i g u r e ( V A G R A N T F I L E _ A P I _ V E R S I O N ) d o | c o n f i g | c o n f i g . v m . b o x = " h a s h i c o r p / p r e c i s e 3 2 " e n d
  10. Main Commands box manages boxes: installation, removal, etc. destroy stops

    and deletes all traces of the vagrant machine halt stops the vagrant machine init initializes a new Vagrant environment by creating a Vagrantfile plugin manages plugins: install, uninstall, update, etc. provision provisions the vagrant machine reload restarts vagrant machine, loads new Vagrantfile configuration resume resume a suspended vagrant machine ssh connects to machine via SSH suspend suspends the machine up starts and provisions the vagrant environment
  11. Boxes Base images to start a virtual machine https://vagrantcloud.com/

  12. Providers All boxes are provider specific VirtualBox VmWare Hyper-V Cloud

    providers
  13. Configuring providers c o n f i g . v

    m . p r o v i d e r : v i r t u a l b o x d o | v b | v b . c u s t o m i z e [ " m o d i f y v m " , : i d , " - - n a t d n s h o s t r e s o l v e r 1 " , " o n " ] v b . c u s t o m i z e [ " m o d i f y v m " , : i d , " - - m e m o r y " , m e m _ s i z e ? m e m _ s i z e : 6 6 0 8 ] v b . c u s t o m i z e [ " m o d i f y v m " , : i d , " - - c p u s " , n u m _ c p u s ? n u m _ c p u s : 2 ] e n d
  14. Syncing Folders c o n f i g . v

    m . s y n c e d _ f o l d e r F i l e . e x p a n d _ p a t h ( " . . / " ) , " / p r e s e n t a t i o n "
  15. Netorking Support for forwarded ports, public and private networks etc

    c o n f i g . v m . n e t w o r k " f o r w a r d e d _ p o r t " , g u e s t : 8 0 , h o s t : 8 0 8 0
  16. Multi Machine to mimic the topology of large systems

  17. V a g r a n t . c o

    n f i g u r e ( " 2 " ) d o | c o n f i g | c o n f i g . v m . p r o v i s i o n " s h e l l " , i n l i n e : " e c h o H e l l o " c o n f i g . v m . d e f i n e " w e b " d o | w e b | w e b . v m . b o x = " a p a c h e " e n d c o n f i g . v m . d e f i n e " d b " d o | d b | d b . v m . b o x = " m y s q l " e n d e n d
  18. What's the big deal so far?

  19. Provisioning Basic Usage File Shell Ansible Chef Solo Chef Client

    Docker Puppet Apply Puppet Agent Salt
  20. V a g r a n t . c o

    n f i g u r e ( " 2 " ) d o | c o n f i g | c o n f i g . v m . p r o v i s i o n " s h e l l " , i n l i n e : " e c h o H e l l o , W o r l d " e n d
  21. c o n f i g . v m .

    p r o v i s i o n : c h e f _ s o l o d o | c h e f | c h e f . j s o n = { : j a v a = > { : i n s t a l l _ f l a v o r = > " o r a c l e " , : j d k _ v e r s i o n = > " 7 " , : o r a c l e = > { " a c c e p t _ o r a c l e _ d o w n l o a d _ t e r m s " = > t r u e } } } c h e f . r u n _ l i s t = [ " r e c i p e [ a p t ] " , " r e c i p e [ g i t ] " , " r e c i p e [ j a v a ] " , " r e c i p e [ m o n g o d b : : 1 0 g e n _ r e p o ] " , " r e c i p e [ m o n g o d b ] " , " r e c i p e [ v e r t x ] " ] e n d
  22. Rails Dev Box

  23. Related Projects Docker Packer

  24. Links Vagrant documentation Vagrant: Up and Running Vagrant source This

    presentation