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. Using APIs
    for Microservices
    Antonis Kalipetis - @akalipetis
    www.SourceLair.com
    API Meetup 16/02/2015

    View full-size slide

  2. –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.”

    View full-size slide

  3. Importance of APIs
    • Language agnostic
    • Clearly define a way of communication
    • Do not “care” about internal changes

    View full-size slide

  4. 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

    View full-size slide

  5. 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

    View full-size slide

  6. Houston, we have a problem

    View full-size slide

  7. Houston, we have a problem
    • We need a dynamic Proxy: Ceryx

    View full-size slide

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

    View full-size slide

  9. 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

    View full-size slide

  10. 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

    View full-size slide

  11. Building Hemera
    • It took us less than two days
    • It needed 0-changes to our main application
    • Hooking it up with Ceryx was seamless

    View full-size slide

  12. What about Ceryx

    View full-size slide

  13. What about Ceryx
    • Ceryx had an API from day 1

    View full-size slide

  14. What about Ceryx
    • Ceryx had an API from day 1
    • That’s the only thing left from that day

    View full-size slide

  15. Ceryx stages
    • Python Twisted with MongoDB and Redis as
    Cache
    • TProxy with Redis
    • NGINX and a watcher with etcd

    View full-size slide

  16. 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

    View full-size slide

  17. Thanks
    Antonis - SourceLair
    Talk to us :)

    View full-size slide