Skip to content

Latest commit

 

History

History
51 lines (41 loc) · 2.92 KB

README.md

File metadata and controls

51 lines (41 loc) · 2.92 KB

Group 4 microservices library app

App schematics

Services:

  • GraphQL (acts as a gateway between the services and clients). Written in Python.
  • Books (uses containerized Mongo DB). Written in NodeJS. Manages the collection of books.
  • Customers (uses containerized Mongo DB, the same used by books). Written in Java. Manages the collection of customers
  • Lend (uses local-installed My SQL). Written in NodeJS. Keeps track of borrowed (and returned) books

Available features (for books, customers and lends)

Create, list, retrieve, edit and delete

Logging

All services log to console in JSON format. Environment vars allow changing the log level (default INFO and above). All logs related to requests from clients display a correlation id (generated by the gateway service and passed along to backend services). Logs for lend also record the customer id, being able to be used for tracing as well.

How to start and stop services

To start all services at once go into the project directory and type docker-compose up -d (if using docker compose) or, if using kubernetes, type kubectl apply -f ./kubernetes-config To stop the services with docker compose type docker-compose stop to stop all containers and docker-compose rm to remove the now-stopped containers. With kubernetes, type kubectl delete -f ./kubernetes-config

To build an image for the container, go into a service directory and type docker build . -t imageName (you can choose an image name you like) To start a single container, type docker run -p port1:port2 imageName and replace port with the values of ports you wish to open and imagename Default service ports (port1) are 3001 for books, 3002 for lend, 3003 for customers. Note: you can change these in .env files in the corresponding service folder. Port2 is the exposed container port and can be set freely. imageName is the same you chose when typing docker-build.

To start a single NodeJS service, go into the corresponding directory and type the following commands:

  • npm install --include=dev (this will install dependencies, if you don't want to add dev dependencies do not add the --include part)
  • npm start (this will start the service. Stop it by pressing CTRL+C)
  • npm test (optional. this will run the tests but it's not necessary for service running. Requires dev dependencies)

To start GraphQL go into the corresponding directory and type the following commands:

  • python -m venv venv (create the virtual environment for graphQL)
  • venv\Scripts\Activate (activate the virtual environment)
  • pip install -r requirements.txt (install all required dependencies)
  • python app.py (this will start the service. Stop it by pressing CTRL+C)

Project created by: Andrea Cirillo (mantainer) Alex Enrico Aimino Alberto Alineri Daniele Quasimodo Simone Stella