b u i l d a 1 2 f a c t o r m i c r o s e r v i c e i n a

B u i l d a 1 2 F a c t o r M i c r o s e r v - PowerPoint PPT Presentation

B u i l d a 1 2 F a c t o r M i c r o s e r v i c e i n a n H o u r A n d r e w R o u s e : O p e n L i b e r t y D e v e l o p e r f o r M i c r o P r o f l e a n d


  1. B u i l d a 1 2 F a c t o r M i c r o s e r v i c e i n a n H o u r A n d r e w R o u s e : O p e n L i b e r t y D e v e l o p e r f o r M i c r o P r o f l e a n d C D I , I B M @a z q u e l t

  2. C o n t e n t s B a s i c c o n c e p t s o f 1 2 f a c t o r a p p s D e mo o f c r e a t i n g a 1 2 f a c t o r mi c r o s e r v i c e u s i n g M i c r o P r o f l e

  3. 1 2 F a c t o r s i n a n u t s h e l l – A me t h o d o l o g y – B e s t P r a c t i c e s – M a n i f e s t o h t t p s : / / 1 2 f a c t o r . n e t / b y H e r o k u

  4. Wh y 1 2 f a c t o r ? • D e f n e t h e c o n t r a c t b e t w e e n a p p l i c a t i o n s a n d i n f r a s t r u c t u r e Application Infrastructure

  5. T H E F A C T O R S 1 .C o d e b a s e 7 .P o r t b i n d i n g 2 .D e p e n d e n c i e s 8 .C o n c u r r e n c y 3 .C o n f g 9 .D i s p o s a b i l i t y 4 .B a c k i n g S e r v i c e s 1 0 . D e v / P r o d p a r i t y 5 .B u i l d , R e l e a s e , R u n 1 1 . L o g s 6 .P r o c e s s e s 1 2 . A d mi n P r o c e s s e s

  6. Wh y 1 2 f a c t o r ? I n t h e mo d e r n e r a , s o f t w a r e i s c o mmo n l y d e l i v e r e d a s a s e r v i c e : c a l l e d w e b a p p s , o r s o f t w a r e - a s - a - s e r v i c e . T h e t w e l v e - f a c t o r a p p i s a me t h o d o l o g y f o r b u i l d i n g s o f t w a r e - a s - a - s e r v i c e a p p s t h a t : U s e d e c l a r a t i v e f o r ma t s f o r s e t u p a u t o ma t i o n , t o mi n i mi z e t i me a n d c o s t f o r n e w d e v e l o p e r s j o i n i n g t h e p r o j e c t ; H a v e a c l e a n c o n t r a c t w i t h t h e u n d e r l y i n g o p e r a t i n g s y s t e m, o f f e r i n g ma x i mu m p o r t a b i l i t y b e t w e e n e x e c u t i o n e n v i r o n me n t s ; A r e s u i t a b l e f o r d e p l o y me n t o n mo d e r n c l o u d p l a t f o r ms , o b v i a t i n g t h e n e e d f o r s e r v e r s a n d s y s t e ms a d mi n i s t r a t i o n ; M i n i mi z e d i v e r g e n c e b e t w e e n d e v e l o p me n t a n d p r o d u c t i o n , e n a b l i n g c o n t i n u o u s d e p l o y me n t f o r ma x i mu m a g i l i t y ; A n d c a n s c a l e u p w i t h o u t s i g n i f c a n t c h a n g e s t o t o o l i n g , a r c h i t e c t u r e , o r d e v e l o p me n t p r a c t i c e s . T h e t w e l v e - f a c t o r me t h o d o l o g y c a n b e a p p l i e d t o a p p s w r i t t e n i n a n y p r o g r a mmi n g l a n g u a g e , a n d w h i c h u s e a n y c o mb i n a t i o n o f b a c k i n g s e r v i c e s ( d a t a b a s e , q u e u e , me mo r y c a c h e , e t c ) . F r o m h t t p s : / / 1 2 f a c t o r . n e t

  7. I . C o d e b a s e “ O n e c o d e b a s e t r a c k e d i n r e v i s i o n c o n t r o l , ma n y d e p l o y s . ” • D e d i c a t e s ma l l e r t e a ms t o i n d i v i d u a l a p p l i c a t i o n s o r mi c r o s e r v i c e s . • F o l l o w i n g t h e d i s c i p l i n e o f s i n g l e r e p o s i t o r y f o r a n a p p l i c a t i o n f o r c e s t h e t e a ms t o a n a l y z e t h e s e a ms o f t h e i r a p p l i c a t i o n , a n d i d e n t i f y p o t e n t i a l mo n o l i t h s t h a t s h o u l d b e s p l i t o f f i n t o mi c r o s e r v i c e s .  U s e a s i n g l e s o u r c e c o d e r e p o s i t o r y f o r a s i n g l e a p p l i c a t i o n ( 1 : 1 r e l a t i o n ) .  E . g . u s e a c e n t r a l g i t r e p o

  8. I I . D e p e n d e n c i e s “ E x p l i c i t l y d e c l a r e a n d i s o l a t e d e p e n d e n c i e s ” A c l o u d - n a t i v e a p p l i c a t i o n d o e s n o t r e l y o n t h e p r e - e x i s t e n c e o f d e p e n d e n c i e s i n a d e p l o y me n t t a r g e t . D e v e l o p e r T o o l s d e c l a r e a n d i s o l a t e d e p e n d e n c i e s • M a v e n a n d G r a d l e d e c l a r e J a v a l i b r a r y d e p e n d e n c i e s • D o c k e r f l e d e c l a r e s d e p e n d e n c i e s o n O S a n d o t h e r t o o l s • E a c h mi c r o s e r v i c e d e c l a r e s i t s o w n d e p e n d e n c i e s

  9. I I I . C o n f g “ S t o r e c o n f g i n t h e e n v i r o n me n t ”  C h a n g i n g c o n f g s h o u l d n o t n e e d t o r e p a c k a g e y o u r a p p l i c a t i o n  U s e K u b e r n e t e s c o n f g ma p s a n d s e c r e t s f o r c o n t a i n e r s e r v i c e s , r a t h e r t h a n v a l u e s s p e c i f e d i n t h e a p p o r c o n t a i n e r i ma g e  U s e M i c r o P r o f l e C o n f g t o i n j e c t t h e c o n f g p r o p e r t i e s i n t o t h e mi c r o s e r v i c e s App Password=blah

  10. I V . B a c k i n g s e r v i c e s “ T r e a t b a c k i n g s e r v i c e s a s a t t a c h e d r e s o u r c e s ” Application My SQL Amazon S3 Twitter

  11. V . B u i l d , r e l e a s e , r u n “ S t r i c t l y s e p a r a t e b u i l d a n d r u n s t a g e s ”  S o u r c e c o d e i s u s e d i n t h e b u i l d s t a g e . C o n f g u r a t i o n d a t a i s a d d e d t o d e f n e a r e l e a s e s t a g e t h a t c a n b e d e p l o y e d . A n y c h a n g e s i n c o d e o r c o n f g w i l l r e s u l t i n a n e w b u i l d / r e l e a s e  N e e d s t o b e c o n s i d e r e d i n C I p i p e l i n e I B M A WS A z u r e • • • U r b a n C o d e D e p l o y A WS C o d e B u i l d V i s u a l S t u d i o T e a m S e r v i c e • • I B M C l o u d C o n t i n u o u s D e l i A WS C o d e D e p l o y s ( V S T S ) ( i n c l u d e s g i t ) • We b A p p f o r C o n t a i n e r s • v e r y S e r v i c e A WS C o d e P i p e l i n e ( n o t f e a t u r e o f A z u r e A p p y e t i n t e g r a t e d w i t h E K S ) S e r v i c e

  12. V I . P r o c e s s e s “ E x e c u t e t h e a p p a s o n e o r mo r e s t a t e l e s s p r o c e s s e s ” ➢ S t a t e l e s s a n d s h a r e - n o t h i n g ➢ A n y p e r s i s t e n c e u s e s a b a c k i n g s e r v i c e D a t a b a s e – S h a r e d c a c h e – M e s s a g e q u e u e –

Recommend


More recommend