Virtual orb is a library to simulate an Orb, periodically pinging a manager API.
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
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
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
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:
- Setup a proper logger, with defined levels (Warn, Debug, Error)
- Use a dependency injection lib to facilitate mock generation and reduce boilerplate code (e.g wire)
- Define error types and their propagation levels (e.g some errors should be user visible, other should show stacktraces)
- Add a smarter periodic system, with randomized periods.