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

Ceryx - San Francisco API Meetup

Ceryx - San Francisco API Meetup

Talk about Ceryx; a dynamic web server, programmable through an HTTP API

Paris Kasidiaris

June 26, 2015
Tweet

More Decks by Paris Kasidiaris

Other Decks in Programming

Transcript

  1. How often do you need to handle 1000s of NGINX

    vhosts? (Most probably never)
  2. Background-story We let our users code web applications on our

    service We provide each of these projects with a public URL r a n d o m i d . a p p s . l a i r . i o
  3. Request flow * . a p p s . l

    a i r . i o resolves to proxy server's IP Ceryx on proxy server listens to * : 8 0 and * : 4 4 3 Ceryx proxies according to H o s t header
  4. The setup NGINX for proxying Flask for serving the API

    Lua scripting in NGINX for routing Redis for storing routes
  5. The API List routes G E T / a p

    i / r o u t e s Add a new route P O S T / a p i / r o u t e s { " s o u r c e " : " r a n d o m t h i n g . a p p s . l a i r . i o " , " t a r g e t " : " u p s t r e a m _ h o s t : u p s t r e a m _ p o r t } Delete a route D E L E T E / a p i / r o u t e s / : s o u r c e
  6. Benefits from API-based web server? We kept our app's logic

    clean We changed Ceryx' back-end 4 times with no change in the main app Easier to monitor and manage