GithubHelp home page GithubHelp logo

fo-aas's Introduction

fo-aas

fo-aas provide a proxy server to foaas, by connecting and fetching its response. It enforces user based throttling for incomming requests and provides basic RED metrics.

Authorization was out the scope of this implementation, so the applicaiton expects a specific HTTP header "User" with the user identifier, otherwise the request is reject.

The implementation of the rate limiting is session based. Every user has a quota of tokens (requests), that can be consumed within a session. Sessions have fixed length and on expiration, tokens are re-allocated.

Building and running the app

The app expects the following flags

  • host : listen interface. (def: "0.0.0.0")
  • port : port to listen on. (def: 8080)
  • session-length : amount of time until the session expires in milliseconds (def: 1000 m sec)
  • tokens : amount of tokens available per user by session (def: 1000)
  • timeout : timeout in milleconds to establish a connection with foaas (def: 3000 m sec)

using docker

make build-docker
make run

to run it with custom flags

make build-docker
make start-deps
docker run -p 8080:8080 -d fo-aas -session-length 1000 -tokens 10 -timeout 3000

Sample execution

curl 'http://localhost:8080/message' -H "User: pable"
{"message":"Fascinating story, in what chapter do you shut the f... up?","subtitle":"- pable"}

Metrics

Metrics are published by the app on the /metrics endpoint and collected by the prometheus service running on docker.

Local grafana service can be accessed to check metrics. There's an already simple dashboard built that can be imported under dev/grafana/provisioning/dashboards/metrics.json called Metrics.

Credentias:

  • user: admin
  • passwd: foobar

fo-aas's People

Contributors

pableeee avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.