Coder Social home page Coder Social logo

orb's Introduction

Virtual Orb

Virtual orb is a library to simulate an Orb, periodically pinging a manager API.

Configuration

You can set the required environment variables to run the orb. There are default values and example values for a mocked API server in the conf/config.yaml file.

API_HOST="mock-api"
API_PORT=1080
ASSET_DIR="./assets"
SIGNUP_PATH="/signup"
REPORT_PATH="/status"
REPORT_PERIOD=10
SIGNUP_PERIOD=10

Building and Running with Mocked API

To run locally in a docker environment you can run the following commands. This will deploy a mocked API server and the orb. Follow the orb logs to see the requests being made.

make build-orb

make run-with-mock

docker compose logs -f orb

Building and Running against any API

Set up the desired configuration and pass it to the docker image as environment file.

make build-orb

docker run -it --env-file=./conf/config.yaml --rm orb

Notes

For the sake of velocity, some design decisions were done with a PoC mindset. i.e Proper logging isn't implemented, error handling is basic, etc...

In a complete, "production ready" solution, I'd improve the following:

  1. Setup a proper logger, with defined levels (Warn, Debug, Error)
  2. Use a dependency injection lib to facilitate mock generation and reduce boilerplate code (e.g wire)
  3. Define error types and their propagation levels (e.g some errors should be user visible, other should show stacktraces)
  4. Add a smarter periodic system, with randomized periods.

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.