go2 design overview

· 267 words · 2 minutes read projects serverless microservice

go2 is a project of mine which is the next generation of the “go redirector”. This could probably be written as a single binary which would run in a docker container but I also figured if I’m going to recreate something, why not try creating a microservice type architecture.

Recently I’ve been learning about OpenFaaS, which allows any docker to become a function which makes it language agnostic and would take care of scaling up and down instances as needed in a kubernetes cluster or docker swarm, so I thought I should use this as the basis for my API. Now while using OpenFaaS is not necessary for auto scaling, it does come out of the box so I don’t need to add any additional logic to automatically scale my pods horizontally. Also because these are simply docker containers if I decide down the line to remove OpenFaaS then I could go a pure kubernetes route quite easily.

On top of using OpenFaaS on kubernetes I decided to add an API gateway in front of it. This will serve two purposes, one it will abstract the endpoint so I can do something like /api/v1/endpoint instead of the URI that OpenFaaS creates, also allowing me to pull out OpenFaaS if needed. The other part is I can take care of authorization at the API level and lock down the functions to only talk to the API Gateway.

basic architecture diagram

If you’re interested in this project feel free to check out the GitHub organization. The swagger spec is currently in the process of being created/finalized for api v1.