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

Using APIs for Microservices at SourceLair

Using APIs for Microservices at SourceLair

In SourceLair, having an internal API helped us a lot in building microservices quick and effectively. Having an internal API helps a lot in code quality by building microservices and is an actual need, even if exposing all or part of it is not a future goal.

Antonis Kalipetis

February 16, 2015
Tweet

More Decks by Antonis Kalipetis

Other Decks in Programming

Transcript

  1. –Wikipedia “In computing, microservices is a software architecture design pattern,

    in which complex applications are composed of small, independent processes communicating with each other using language-agnostic APIs. These services are small, highly decoupled and focus on doing a small task.”
  2. Importance of APIs • Language agnostic • Clearly define a

    way of communication • Do not “care” about internal changes
  3. The SourceLair case • Each user gets a server per

    project • Every time is started to a new host:port • Exposed to a static public URL • Might be shut down
  4. P1 P2 P3 P4 P5 P6 P1 P2 P3 P4

    P5 P6 P1 P2 P3 P4 P5 P6 P1 P2 P3 P4 P5 P6 Proxy
  5. Houston, we have a problem • We need a dynamic

    Proxy: • We need a way to inform user and “wake up” servers: Hemera
  6. Houston, we have a problem • We need a dynamic

    Proxy: • We need a way to inform user and “wake up” servers: • We need a way to bootstrap servers from external services: SourceLair API
  7. P1 P2 P3 P4 P5 P6 P1 P2 P3 P4

    P5 P6 P1 P2 P3 P4 P5 P6 P1 P2 P3 P4 P5 P6 Ceryx Hemera SourceLair API
  8. Building Hemera • It took us less than two days

    • It needed 0-changes to our main application • Hooking it up with Ceryx was seamless
  9. What about Ceryx • Ceryx had an API from day

    1 • That’s the only thing left from that day
  10. Ceryx stages • Python Twisted with MongoDB and Redis as

    Cache • TProxy with Redis • NGINX and a watcher with etcd
  11. Making NGINX dynamic • etcd for storing routes • Can

    watch for changes, without loss • NGINX for proxying • Using config file templates for configuration • The exact same API with previous versions