vegaprotocol / topgun-service

Leaderboard API service for Fairground incentives (code name TOPGUN)
0 stars 0 forks source link

Ability to create a leaderboard for a specific competition #6

Closed campbellssource closed 3 years ago

campbellssource commented 3 years ago

At the moment each instance of topgun-service has one leaderboard.

Somehow we need to be able to have different leaderboards running at the same time e.g.

ashleyvega commented 3 years ago

topgun-sevice is run with:

docker run -d \
  --name=topgun-service-testnet-competition-001 \
  -p 30001:8000 \
  -v /path/to/some/includelist.csv:/includelist.csv \
  docker.pkg.github.com/vegaprotocol/topgun-service/topgun-service:latest \
                -assetpoll 60s \
                -endpoint https://lb.testnet.vega.xyz/query \
                -includelist=/includelist.csv \
                -vegapoll 60s \
                -base BTC \
                -quote USD \
                -vegaasset tDAI \
                -addr=0.0.0.0:8000 \
                -algorithm-to-use-when-sorting=some_algorithm_name

In this way, any number of leaderboards can be run.

Then it's up to Caddy to route:

Since the leaderboards do not interfere/interact with each other, each one can be (re)started / stopped independently.

ashleyvega commented 3 years ago

Note: Caddy2 is not so good with reverse proxying and path rewriting at the same time, hence the clunky per-competition DNS hostnames.

ashleyvega commented 3 years ago

It's possible to have multiple leaderboards using multiple docker containers, each with its own config file. Caddy2 then reverse-proxies requests to the right container, depending on URL.