deploy an api gateway with docker

23
Deploy an API gateway with Docker Sandro Cirulli Oxford University Press (OUP) API Days Nordic University of Tampere, Finland 19 May 2016

Upload: ngokhanh

Post on 13-Feb-2017

252 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Deploy an API gateway with Docker

Deploy an API gateway with Docker

Sandro CirulliOxford University Press (OUP)

API Days NordicUniversity of Tampere, Finland

19 May 2016

Page 2: Deploy an API gateway with Docker

Table of contents

1. Introduction

2. What is an API gateway

3. What is Docker

4. Technical Configuration

5. Demo

6. Benefits of Docker

7. Alternative Approaches

8. Summary

Page 3: Deploy an API gateway with Docker

About me

I I work as Platform Tech Lead at Oxford University Press(OUP)

I I am responsible for system architecture and DevOps (CI,Docker, AWS, deployment)

I I started using APIs and Docker in 2014-15 for developinglanguage resources at OUP

3/23

Page 4: Deploy an API gateway with Docker

Oxford University Press (OUP)

I Oxford University Press (OUP) is a world-renowneddictionary publisher

I OUP launched the Oxford Global Languages (OGL) initiativeto digitize under-represented languages

I OUP launched languages websites for Zulu, Northern Sotho,Malay, Urdu, Indonesian, and Setswana

4/23

Page 5: Deploy an API gateway with Docker

Oxford Global Languages (OGL)Vision

I Localized websites and digital access for multiple languages

I Language communities contributing content (crowdsourcing)

I Supporting digitally under-represented languages

I Flexible data serving multiple needs

5/23

Page 6: Deploy an API gateway with Docker

Zulu language websitepowered by APIs and Docker

6/23

Page 7: Deploy an API gateway with Docker

API Gateway

Page 8: Deploy an API gateway with Docker

What is an API gateway?

I An API gateway is a single entry point for APIs in a serviceinfrastructure

I It provides authentication and authorization layers

I It routes, load balances, and caches requests to the API

8/23

Page 9: Deploy an API gateway with Docker

What is an API gateway?

Source: http://microservices.io/patterns/apigateway.html

9/23

Page 10: Deploy an API gateway with Docker

Microservices architecture for OGL project

10/23

Page 11: Deploy an API gateway with Docker

Docker

Page 12: Deploy an API gateway with Docker

What is DockerI Docker is an open-source project that automates the

deployment of applications into software containers

I Docker packages an application with all of its dependencies -no more ”worked on my machine” problems

I Docker isolates applications and resources

I Docker guarantees that the system will run the sameregardless of the running environment - build, ship, and runany app, anywhere

12/23

Page 13: Deploy an API gateway with Docker

Traditional vs Docker Deployment

Source: Miell, I. and Sayers, A. H. (2016) Docker in Practice, Manning.

13/23

Page 14: Deploy an API gateway with Docker

Docker Images and Containers

Object-oriented programming analogy:

I Docker images are likeclasses

I Docker images areblueprints

I Docker images are likerecipes

I Docker containers are likeobjects

I Docker containers areconcrete instances ofDocker images

I Docker containers are likedishes

14/23

Page 15: Deploy an API gateway with Docker

Why using Docker for an API gateway?

I Infrastructure as code

I Replicate configuration accross environments

I Avoid dependencies conflicts

I Facilitate portability and automation

15/23

Page 16: Deploy an API gateway with Docker

Technical Configuration

I Dockerfile

I nginx and 3scale

I https and SSL certificates

Page 17: Deploy an API gateway with Docker

3scale Forum

17/23

Page 18: Deploy an API gateway with Docker

Demo

I Build and run a container on AWS

I Run curl commands to interact with the API

I Debug logs inside the container

Page 19: Deploy an API gateway with Docker

Benefits of Docker

I Reusability: spin up new containers in no time

I Portability: migrate quickly to bigger machines or frombare-metal to the cloud

I Automation: deployment is easily automated and lesserror-prone

19/23

Page 20: Deploy an API gateway with Docker

Alternative ApproachesDocker API gateway from 3scale

Check out the 3scale implementation of a Docker API gateway:

https://github.com/3scale/docker-gateway

20/23

Page 21: Deploy an API gateway with Docker

Alternative ApproachesServerless Architecture

Check out:

I Mikael Puittinen’s workshop on AWS Serverless

I Nicolas Grenie’s presentation on Serverless API

Some considerations:

I Check your use cases and application architecture

I Make a cost analysis

I Check your cloud provider

I Server and serverless architectures can coexist

21/23

Page 22: Deploy an API gateway with Docker

Summary

I An API gateway is a single entry point for APIs andprovides authentication and authorization layers

I Docker makes it easier to replicate the configuration acrossmultiple environments

I Docker automates deployment and makes it lesserror-prone

22/23

Page 23: Deploy an API gateway with Docker

Thank you for your attention!

Contact:www.sandrocirulli.net/contact

[email protected]

Slides:www.sandrocirulli.net/apidaysnordic2016

GitHub:github.com/cirulls/docker-api-gateway

Links:OGL programme: www.oxforddictionaries.com/ogl