Code Monkey home page Code Monkey logo

strago's Introduction

logo

Strago

go version version

Simple traffic controller agent with Golang. With Strago you can create and config a load balancer for your services. Load balancing logic of Strago is very simple, it works by the number of requests per service or the total burst time of requests in each service. All you need to do is to give your service addresses as an IP and leave the rest up to Strago.

How to use?

Install library:

go get -u github.com/amirhnajafiz/strago

build

Then build the executable file:

go build -o strago
chmod +x ./strago
STRAGO_PORT=9370 STRAGO_SERVICES='127.0.0.1:5050&127.0.0.1:5051' STRAGO_DEBUG=true ./strago

docker

Start strago on docker with:

docker pull amirhossein21/strago:v0.1.1
docker run -d \
  -e STRAGO_PORT=9370 \
  -e STRAGO_SERVICES='127.0.0.1:5050&127.0.0.1:5051' \
  amirhossein21/strago:v0.1.1

Example

If you set two echo servers on localhost ports 5050 and 5051, then you have to set the strago server like the example below:

test

You can test the above code by creating two echo servers:

### generating a service on port 5050
go run example/echo/main.go 5050
### generating a service on port 5051
go run example/echo/main.go 5051

Now you can test the load-balancer:

curl localhost:9370

Envs

  • STRAGO_SERVICES: seperated with &. Example: 127.0.0.1:5050&127.0.0.1:5051
  • STRAGO_PORT: http port
  • STRAGO_SECURE: using https or not (ture/false)
  • STRAGO_TYPE: load balancing type (0 is request count / 1 is burst time)
  • STRAGO_DEBUG: used for debug mode (true/false)

Metrics & Health

Strago metrics will be exposed on localhost:9370/metrics. And you can check the system health on localhost:9370/health.

strago's People

Contributors

amirhnajafiz avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

strago's Issues

remove firewall

We are developing a load balancer. Not a firewall service.
Please remove the firewall feature and focus on load balancing features.

update firewall

Update the firewall feature.
Suggested features:

  • Create new handler for service status
  • Add IPv6 banning

add test

Write some unit tests for Strago.
Check the followings:

  • Configs
  • Server initialize
  • Balancing logic

add options

change configs to options, update the following style.

  • Add strago options
  • Services is a part of options
  • Methods for adding and removing services

export metrics

Export metrics on a port, so we can use it in prometheus or victoria metrics.

metrics

Add Victoria metrics for Strago.
Suitable metrics:

  • Number of requests
  • Number of requests per service
  • Service response time
  • Strago failed requests

cloud

Generate cloud manifests.

refactor examples

Update the following problems:

  • firewall example
  • full example for ip

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.