armand1m / microservices

A microservices environment managed by Docker Compose.
16 stars 0 forks source link

service: Users #7

Closed armand1m closed 7 years ago

armand1m commented 7 years ago

Proposal

Implement a service that would be responsible to handle simple operations related to Users and their information.

This service is a simple CRUD RESTful API that should expose some routes, and respond correctly to some scenarios.

Routes

armand1m commented 7 years ago

A basic implementation of this service is here: armand1m/users-service

About the implementation:

It is a simple stateless Node.js API built using Hapi.js, that registers himself to a Consul instance, when it starts, and deregisters himself when shutdown for any reason.

It extends some services from the service.yml docker-compose file in the project armand1m/core-services, using the extends property from the Docker Compose v2 specification.

The project was started using a clone from armand1m/microservice-barebone.

It uses RethinkDB as its database. I'd choose this one for its reactivity, simplicity, size and because it works like a charm.

Routes

Running:

$ git clone --recursive https://github.com/armand1m/users-service
$ cd users-service
$ ./commands/run # or docker-compose up -d
$ curl -X GET http://localhost:9999/users

Scalability:

When running only one instance of the service defined in the docker-compose file, your environment probably will look like this:

captura de tela 2017-03-12 as 09 06 50

If you run:

$ ./commands/scale service=3
# or
$ docker-compose scale service=3

Your environment will look like this: captura de tela 2017-03-12 as 09 07 38