Giter Site home page Giter Site logo

ruisunon / nestjs-microservices Goto Github PK

View Code? Open in Web Editor NEW

This project forked from backendworks/nestjs-microservices

0.0 0.0 0.0 215 KB

๐Ÿš€ Fully customized microservices pack using NestJs, RabbitMQ, Kong api gateway, MongoDB, PostgreSQL, Bull Queues with Redis, Grafana, Loki, Fluentbit.

License: MIT License

Shell 82.51% Dockerfile 17.49%

nestjs-microservices's Introduction

Nest Microservices with RabbitMQ (Version 2)

Fully managed microservices starter using NestJS, Kong API gateway, RabbitMQ, Bull Queues using Redis, Firebase Cloud Notifications, Grafana stack, Fluent-Bit, MongoDB, PostgreSQL, Prisma.

Dependencies & Services

Get started

  • use git submodule update --init --recursive command to update/fetch submodules.
  • copy env variables from each submodule repo from example.env file.
  • To explore APIs collection here is the link of postman collection
  • For CI/CD with AWS CodePipeline, use buildspec.yml file.

Setting up an environment notes:

  • before starting docker-compose up, make sure that you have set up .env and .env.dev file.
  • use of .env file - to interact with the services using localhost by running docker-compose.core.yml services in docker. as we're interacting with them in localhost env.
  • use of .env.dev file - to use environment variables in docker-compose.yml file, while running all services together. as we're running those services in docker env.
  • kong.yml from kong/conf file will be used for routing for the services. add new services in kong.yml file.
  • authentication for each service is handled by kong api gateway itself. to assign authentication, attach jwt plugin in specific service. see kong.yml for example.
  • The development server endpoint will start on kong port 8000.

Run in local

  1. start core services (postgres, rabbitmq, mongodb, redis)
npm start core:up 
  1. go to service folder cd auth, and to start in development mode
npm run dev

to stop core services, run script

npm run core:down

Run in docker-compose

docker-compose up 

Setup Grafana Dashboard

To see the logs on Grafana dashboard, follow below steps.

  1. Open the browser and go to http://localhost:3000, use default values admin and admin for username and password.
  2. Now, go to http://localhost:3000/datasources and select Loki from Logging and document databases section.
  3. Enter http://loki:3100 in URL under HTTP section. We can do this because we are running Loki and Grafana in the same network.
  4. loki else you have to enter host IP address and port here, click on Save and Test button from the bottom of the page.
  5. Now, go to 3rd tab Explore from the left sidebar or http://localhost:3000/explore image

Deployment

Deploy service to ECR.

sh deploy.sh

Notes:

Docker Notes:

  • Use name of the service to connect service internally with docker compose environment.
  • for rebuild services use command docker-compose up --build.

Blogs and References:

nestjs-microservices's People

Contributors

hmake98 avatar harsh-simform avatar alishasimform avatar

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.