Skip to content

jramiresbrito/brokers-api

Repository files navigation

@markup markdown

Brokers-API

This repository has an Academic purpose only. The Brokers-API works together with the Exchange-API in order to allow the negotiation of Assets.

Software versions

  • Ruby 2.6.6p146
  • Rails 6.0.4.1

Setup

This software was created only to be used in development environment. Although it is very easy to add, test and production environments are not available.

In order to run the software you will need docker and docker-compose which can be found in:

A script to manage the containers is available. Therefore, after installing both docker and docker-compose, run the following command:

./scripts/development start

Obs: all commands may require sudo if your user does not belong to the docker group

To list all running containers, run:

docker ps

You should see a list of containers, including the following ones:

  • brokers-rails - the main container that runs the rails server. It binds the port 3000 from localhost.
  • brokers-mongo - the only container of MongoDB, the service's database. It binds the localhost's port 27017, which is the default port for MongoDB in most OSs. Make sure you are not running any local MongoDB service.
  • brokers-rabbitmq - message broker used for asynchronous message between services. It expose several ports, but the main connections are performed to port 5672. An Web page for admins is available in port 15672. You can acess it using the default credentials guest:guest.
  • brokers-hutch - the container responsible to send messages using rabbitmq
  • brokers-docs - a server that provides the code documentation. It is accessible through localhost's port 8808.
  • brokers-mailcatcher - Web UI to catch emails in development environment. Currently we send only a few emails, mainly when a new account is created or to get the password recovery token. In the future I'm planning to send some reports via emails. It runs in port 1080.

Also, the docker-compose will use the external newtork named brokers-bridge created by the Brokers-API.

Once you make sure all containers are working, run the script to populate the database with 12 assets and two brokers. You can see this script here. To run the seed script:

./scripts/development exec rails db:clean_seed

Atention ⚠

Please make sure all containers are up and running. You can manually run a container if it doesn't work automatically using the provided script.

Obs: You may need to wait a bit until run the hutch container. As it lies on rabbitmq container, it need to wait until the rabbitmq is properlly running. I'll improve the starting script to ensure that (one day 😛).

Using the API

A Insomnia json is available in the root of both API's. After import the data you can easily run requests using the Insomnia software. If you prefer other softwares, such as Postman, you can create your own collections based on the provided json file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published