Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Vagrant & Puppet

Vagrant & Puppet

While working on a project every member of the team can add his libraries, extensions and setup the project as he sees fit.
The problem arises when that process needs to be repeated with other members of the team.
Vagrant, one of the many tools that you might have heard of but did not have a chance to look at, is used to simplify the development setup and allowing identical setup to all the memebers of the team. During the talk I will try to explain why you should use Vagrant/Puppet and what are the advantages/disadvantages

Vranac Srdjan

November 16, 2013
Tweet

More Decks by Vranac Srdjan

Other Decks in Programming

Transcript

  1. SINGLE & MULTIPLE VM c o n f i g

    . v m . d e f i n e : d e v b o x d o | d e v b o x | . . . e n d c o n f i g . v m . d e f i n e : d e v b o x d o | d e v b o x | . . . e n d c o n f i g . v m . d e f i n e : d b b o x d o | d b b o x | . . . e n d
  2. VAGRANTFILE V a g r a n t : :

    C o n f i g . r u n d o | c o n f i g | c o n f i g . v m . b o x = " q u a n t a l " c o n f i g . v m . b o x _ u r l = " h t t p : / / c l o u d - i m a g e s . u b u n t u . c o m / q u a n t a l / c u r r e n t / q u a n t a l - s e r v e r - c l o u # c o m p o s e r r e q u i r e s l o n g t i m e o u t s c o n f i g . s s h . t i m e o u t = 9 0 0 0 c o n f i g . s s h . m a x _ t r i e s = 3 0 0 c o n f i g . v m . p r o v i s i o n : p u p p e t d o | p u p p e t | p u p p e t . m a n i f e s t s _ p a t h = " m a n i f e s t s " p u p p e t . m a n i f e s t _ f i l e = " d e v . p p " # U n c o m m e n t t h i s f o r a t o r r e n t o f p u p p e t i n f o # p u p p e t . o p t i o n s = " - - v e r b o s e - - d e b u g " e n d c o n f i g . v m . n e t w o r k : h o s t o n l y , " 3 3 . 3 3 . 3 3 . 1 0 0 " c o n f i g . v m . s h a r e _ f o l d e r " w w w " , " / v a r / w w w " , " . / " , : n f s = > t r u e e n d
  3. TRIFECTA Package/File/Service: Learn it, live it, love it. If you

    can use only this, you can still do a lot
  4. BASE.PP n o d e b a s e {

    . . . f i l e { ' / e t c / a p t / s o u r c e s . l i s t . d / p h p 5 5 . l i s t ' : e n s u r e = > p r e s e n t , c o n t e n t = > " d e b h t t p : / / p a c k a g e s . d o t d e b . o r g w h e e z y - p h p 5 5 a l l " } . . . e x e c { " a u t h o r i z e - p h p 5 5 " : c o m m a n d = > " s u d o a p t - k e y a d v - - r e c v - k e y s - - k e y s e r v e r k e y s e r v e r . u b u n t u . c o m E 9 C 7 4 F E E A 2 0 r e q u i r e = > F i l e [ " / e t c / a p t / s o u r c e s . l i s t . d / p h p 5 5 . l i s t " ] , } . . . # b e c a u s e p u p p e t c o m m a n d a r e n o t r u n s e q u e n t i a l l y , e n s u r e t h a t p a c k a g e s a r e # u p t o d a t e b e f o r e i n s t a l l i n g p a c k a g e s , s e r v i c e s , f i l e s , e t c . P a c k a g e { r e q u i r e = > E x e c [ " a p t - g e t u p d a t e " ] } . . . p a c k a g e { " n g i n x " : e n s u r e = > p r e s e n t , r e q u i r e = > P a c k a g e [ " a p a c h e 2 . 2 - c o m m o n " ] } # s t a r t s t h e n g i n x s e r v i c e o n c e t h e p a c k a g e s i n s t a l l e d , a n d m o n i t o r s c h a n g e s # t o i t s c o n f i g u r a t i o n f i l e s a n d r e l o a d s i f n e c e s s a r y s e r v i c e { " n g i n x " : e n s u r e = > r u n n i n g , e n a b l e = > t r u e , p r o v i d e r = > ' u p s t a r t ' , r e q u i r e = > [ P a c k a g e [ ' n g i n x ' ] , P a c k a g e [ ' p h p 5 - f p m ' ] ] , s u b s c r i b e = > F i l e [ " / e t c / n g i n x / s i t e s - a v a i l a b l e / d e f a u l t " ] ,
  5. COMPOSER INSTALL n o d e b a s e

    { . . . e x e c { " d o w n l o a d - c o m p o s e r " : c o m m a n d = > " c u r l - s S h t t p s : / / g e t c o m p o s e r . o r g / i n s t a l l e r | p h p & & m v c o m p o s e r . p h a r / u c r e a t e s = > " / u s r / l o c a l / b i n / c o m p o s e r " , r e q u i r e = > P a c k a g e [ " m a k e " , " c u r l " , " g i t " , " p h p 5 " ] } e x e c { " i n s t a l l - v e n d o r s " : c o m m a n d = > " / u s r / l o c a l / b i n / c o m p o s e r - n - q - d = / v a r / w w w i n s t a l l " , r e q u i r e = > [ E x e c [ ' d o w n l o a d - c o m p o s e r ' , ' g e a r m a n p h p ' ] , P a c k a g e [ ' p h p 5 ' , ' p h p 5 - d e v ' , ' p h p l o g o u t p u t = > " o n _ f a i l u r e " , n o t i f y = > S e r v i c e [ " n g i n x " ] } }
  6. SERVER.PP n o d e s e r v e

    r i n h e r i t s b a s e { . . . s s h _ a u t h o r i z e d _ k e y { " v r a n a c _ u b u n t u " : e n s u r e = > p r e s e n t , u s e r = > " u b u n t u " , t y p e = > " s s h - r s a " , t a r g e t = > " / h o m e / u b u n t u / . s s h / a u t h o r i z e d _ k e y s " , k e y = > ' . . . ' , } }
  7. DIFFERENT VAGRANTFILE SYNTAX v1 V a g r a n

    t : : C o n f i g . r u n d o | c o n f i g | . . . . e n d v2 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 | . . . . e n d
  8. SHARED RESOURCES vboxfs can be slow NFS extensions, performance is

    ok(ish) but they do not work on windows Windows
  9. SPEED VM are booted sequentially, that can take time Package

    installation can take time, especially if apt-get (or similar) is executed before each command
  10. DEBUG: Commands in manifest files are not being executed in

    known order e x e c { " d o w n l o a d - c o m p o s e r " : c o m m a n d = > " c u r l - s S h t t p s : / / g e t c o m p o s e r . o r g / i n s t a l l e r | p h p & & m v c o m p o s e r . p h a r / u s r c r e a t e s = > " / u s r / l o c a l / b i n / c o m p o s e r " , r e q u i r e = > P a c k a g e [ " m a k e " , " c u r l " , " g i t " , " p h p 5 " ] }
  11. DEBUG: Puppet files can be linted, but without running them

    you do not know if/when they will fail (and where) Puppet unit testing with rspec-puppet and rspec-system- serverspec