Git Product home page Git Product logo

celo-onboarding's Introduction

Onboarding service (prototype)

This might serve as a base for the development of the onboarding service but at the moment it's just a prototype showing how NestJS can be leveraged in order to structure an application close to our needs.

Structure

A Nest monorepo project combines several independent applications and libraries which are used by these applications. These applications can be either full-blown HTTP servers or microservices where Nest provides us with efficient and configurable transport mechanism. In our case we have:

  • apps/onboarding - the Onboarding Service
  • apps/relayer - the Relayer Service which is a TCP microservice
  • libs/blockchain - dummy lib that could expose a Service which wraps ContractKit and is used by both applications

Load balancing

In order to play around with load-balancing the relayers I've also included a toy haproxy config and a docker-compose that spins up a network which looks like:

                                        *-------------------*
                                   o----| Relayer 1: 0xaaaa |
*-------------*      *---------*   |    *-------------------*   
| Onboarding  |------| HAProxy |---o
|  Service    |      *---------*   |    *-------------------*
*-------------*                    o----| Relayer 2: 0xbbbb |
                                        *-------------------*

To test it out run:

$ docker-compose -f docker-compose.proxy.yml up

This should build everything and spin up the network. It might take 1-2 seconds for HAProxy to pick up the relayers once they're online. You should see this:

relayer_proxy_1  | [WARNING] 245/063307 (6) : Server relayer_pool/relayer2 is UP, reason: Layer4 check passed, check duration: 0ms. 1 active and 0 backup servers online. 0 sessions requeued, 0 total in queue.
relayer_proxy_1  | [WARNING] 245/063307 (6) : Server relayer_pool/relayer1 is UP, reason: Layer4 check passed, check duration: 0ms. 2 active and 0 backup servers online. 0 sessions requeued, 0 total in queue.

After that navigate to localhost:3000/distributedBlindedPepper and you should see the payload composed in apps/relayer/src/relayer.service.ts and we can see how relayers are rotated.

celo-onboarding's People

Watchers

 avatar  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.