Micro-service Developer Experience Node Interac6ve 2015 - - PowerPoint PPT Presentation

micro service developer experience node interac6ve 2015
SMART_READER_LITE
LIVE PREVIEW

Micro-service Developer Experience Node Interac6ve 2015 - - PowerPoint PPT Presentation

Micro-service Developer Experience Node Interac6ve 2015 Peter Elger @pelger Micro-services NOT a new concept - See unix J Small,


slide-1
SLIDE 1

Micro-­‑service ¡Developer ¡Experience ¡ ¡ Node ¡Interac6ve ¡2015 ¡

Peter ¡Elger ¡ @pelger ¡ ¡

slide-2
SLIDE 2

Micro-­‑services ¡

  • NOT ¡a ¡new ¡concept ¡-­‑ ¡See ¡‘unix’ ¡J ¡
  • Small, ¡focused, ¡decoupled ¡components ¡
  • Easily ¡understood ¡
  • Rapid ¡itera6ve ¡deployment ¡
  • Architectural ¡style ¡par6cularly ¡suited ¡to ¡

node.js ¡

slide-3
SLIDE 3

That’s ¡Awesome! ¡But… ¡

slide-4
SLIDE 4

Shell ¡Hell? ¡

slide-5
SLIDE 5

Tradeoffs ¡

  • Micro-­‑services ¡

– Smaller ¡units ¡of ¡code ¡ – Easier ¡to ¡reason ¡about ¡in ¡isola6on ¡ – Easier ¡to ¡test ¡in ¡isola6on ¡ – Rapid ¡incremental ¡deployment ¡ ¡ ¡

  • Monoliths ¡

– Large ¡amount ¡of ¡code ¡ – Much ¡more ¡complex ¡to ¡reason ¡about ¡ – More ¡difficult ¡to ¡test ¡in ¡isola6on ¡ – Highly ¡coupled ¡slow, ¡risky ¡deployments ¡

slide-6
SLIDE 6

Tradeoffs ¡

  • Micro-­‑services ¡

– Harder ¡to ¡run ¡a ¡system ¡in ¡development ¡

  • Mul6ple ¡processes ¡

– Trickier ¡to ¡apply ¡debuggers ¡and ¡tooling ¡ ¡

  • Monoliths ¡

– Easier ¡to ¡run ¡a ¡system ¡in ¡development ¡ ¡

  • single ¡process ¡

– Easier ¡to ¡apply ¡debuggers ¡and ¡tooling ¡

slide-7
SLIDE 7

Op6ons? ¡

slide-8
SLIDE 8

Just ¡develop ¡services ¡in ¡isola6on? ¡

  • Developing ¡single ¡services ¡is ¡simple ¡

– Easy ¡to ¡unit ¡test ¡ – 100% ¡line ¡coverage ¡is ¡usually ¡achievable ¡

  • Then ¡integrate ¡on ¡staging ¡or ¡produc6on ¡only. ¡

¡

slide-9
SLIDE 9

Script ¡it ¡

  • Develop ¡custom ¡shell ¡scripts ¡to ¡start ¡and ¡stop ¡

the ¡system ¡under ¡development ¡

  • This ¡can ¡work ¡well ¡

– Used ¡this ¡on ¡several ¡projects ¡

  • However ¡there ¡is ¡addi6onal ¡overhead ¡in ¡

keeping ¡scripts ¡current ¡

  • Also ¡need ¡to ¡ensure ¡that ¡developer ¡machines ¡

have ¡the ¡same ¡infrastructure ¡

slide-10
SLIDE 10

Use ¡containers? ¡

  • Tools ¡like ¡docker-­‑compose ¡allow ¡us ¡to ¡start ¡and ¡

stop ¡mul6ple ¡containers ¡(i.e. ¡services) ¡in ¡one ¡go ¡

  • Also ¡allow ¡us ¡to ¡define ¡the ¡infrastructure ¡

requirements ¡cleanly ¡

– However ¡the ¡container ¡build ¡cycle ¡can ¡be ¡slow ¡and ¡ frustra6ng ¡ – Environmental ¡differences ¡between ¡development ¡and ¡ produc6on ¡can ¡cause ¡fric6on ¡ – Debugging ¡using ¡containers ¡can ¡be ¡a ¡challenge ¡to ¡ setup ¡

slide-11
SLIDE 11

Three ¡strikes ¡and ¡automate… ¡

h_ps://github.com/apparatus/fuge ¡

slide-12
SLIDE 12

Goals ¡

  • Provide ¡a ¡tool ¡that ¡generates ¡micro-­‑service ¡

scaffolding ¡

¡

  • Provide ¡a ¡run ¡6me ¡environment ¡for ¡micro-­‑

service ¡development ¡that ¡supports ¡

– Rapid ¡development ¡ – Reduces ¡container ¡fric6on ¡ – Eases ¡debugging ¡

slide-13
SLIDE 13

Stack ¡

slide-14
SLIDE 14

Stack ¡

slide-15
SLIDE 15

Code ¡6me!! ¡

fuge generate system

slide-16
SLIDE 16

System ¡Genera6on ¡

slide-17
SLIDE 17

System ¡Genera6on ¡

slide-18
SLIDE 18

System ¡Genera6on ¡

  • Uses ¡Dockerfile ¡and ¡docker-­‑compose ¡syntax ¡
  • Fuge ¡uses ¡these ¡files ¡to ¡run ¡local ¡processes ¡

and ¡containers ¡ ¡

slide-19
SLIDE 19

System ¡execu6on ¡

Fuge shell compose-dev.yml

slide-20
SLIDE 20

Add ¡a ¡service ¡

¡ ¡

fuge generate service

slide-21
SLIDE 21

Add ¡a ¡service ¡

slide-22
SLIDE 22

Add ¡Infrastructure ¡

  • docker ¡pull ¡mongo ¡
  • Update ¡compose-­‑dev.yml ¡
  • Add ¡some ¡code ¡to ¡service1 ¡
  • restart ¡
slide-23
SLIDE 23

Add ¡Infrastructure ¡

slide-24
SLIDE 24

Proxy ¡

  • We ¡are ¡now ¡recording ¡data ¡into ¡MongoDB ¡

running ¡in ¡a ¡container ¡from ¡a ¡process ¡ ¡

  • Fuge ¡will ¡proxy ¡connec6ons ¡between ¡processes ¡

and ¡containers ¡

– Without ¡our ¡code ¡needing ¡to ¡be ¡configured ¡

¡

  • Mixing ¡containers ¡and ¡processes ¡with ¡reduced ¡

fric6on ¡

slide-25
SLIDE 25

Logging ¡

  • For ¡convenience ¡
  • Fuge ¡creates ¡per ¡service ¡logs ¡at ¡

– ./fuge/log/<servicename>.log ¡ ¡

  • Fuge ¡grep ¡

– Search ¡by ¡service ¡or ¡over ¡all ¡

slide-26
SLIDE 26

Debugging ¡

  • Experimental ¡
  • Fuge ¡provides ¡a ¡debug ¡command ¡

– Currently ¡requires ¡node-­‑debug ¡installed ¡

  • A_ach ¡a ¡debugger ¡to ¡a ¡specific ¡service ¡
slide-27
SLIDE 27

Retrofit ¡-­‑ ¡Nodezoo ¡

slide-28
SLIDE 28

Retrofit ¡-­‑ ¡Nodezoo ¡

  • Exis6ng ¡system ¡
  • Added ¡compose ¡yml ¡

– Broken ¡out ¡infrastructure ¡from ¡code ¡

  • Docker-­‑compose ¡runs: ¡

– Redis, ¡elas6csearch, ¡influx ¡and ¡beanstalkd ¡ ¡

  • Fuge ¡runs: ¡

– Frontend ¡and ¡services ¡

slide-29
SLIDE 29

Summary ¡

  • Developing ¡micro-­‑services ¡presents ¡its ¡own ¡

unique ¡challenges ¡

  • Tooling ¡can ¡help! ¡

¡

slide-30
SLIDE 30

Contributors ¡

slide-31
SLIDE 31

Thank ¡you! ¡

¡ ¡

  • h_ps://github.com/apparatus/fuge ¡
  • npm ¡install ¡–g ¡fuge ¡
  • @pelger ¡