Coder Social home page Coder Social logo

andrei-calin-dragomir / bookstore Goto Github PK

View Code? Open in Web Editor NEW

This project forked from devdcores/bookstoreapp-distributed-application

1.0 0.0 2.0 11 MB

Ecommerce project is being developed using Spring Boot Microservices and Spring Cloud (Backend) and React (Frontend). Splitting the Ecommerce functionality into various individual microservices so that they can be distributed, scale really well and make use of resources efficiently.

JavaScript 41.03% Java 57.06% CSS 0.40% HTML 0.46% Dockerfile 0.55% Shell 0.24% Python 0.26%

bookstore's Introduction

BookStoreApp-Distributed-Application

About this project

This is an Ecommerce project where users can adds books to the cart and buy those books.

Architecture

All the Microservices are developed using spring boot. This spring boot applications will be registered with eureka discovery server.

FrontEnd React App makes request's to NGINX server which acts as a reverse proxy. NGINX server redirects the requests to Zuul API Gateway.

Zuul will route the requests to microservice based on the url route. Zuul also registers with eureka and gets the ip/domain from eureka for microservice while routing the request.

Run front-end app

Navigate to bookstore-frontend-react-app folder Run below commnads to start Frontend React Application

yarn install
yarn start

Build all microservice Jars

Run mvn clean install at root of project to build all the microservices jars.

Run this project using Docker Swarm

Follow the tutorial for setting up Docker Swarm on your cluster.

Demo deployment

Run deploy.sh to automatically deploy the stack.

You can specify the compose file to be used and the name of the stack as follows: deploy.sh -n <name_of_stack> -c <compose_file>

Manual deployment

Create network: docker network create --driver overlay bookstore-app-network

Run docker service create --name registry --publish published=5000,target=5000 registry:2 to create a disposable registry for the docker images.

Run docker compose build to build all the images.

Run docker compose push to push all the generated images to the local repository.

Run docker stack deploy --with-registry-auth -c docker-compose.yml <name_of_stack> to deploy the stack.

In order for telegraf to be able to read information from influxDB, you need to modify the docker GID accordingly in the docker-compose.yml file under the bookstore-telegraf configuration (specifically, user: telegraf:<GID>).

Remove the stack from your swarm cluster

Bring stack down: docker stack rm <name_of_stack>

Remove local repository: docker service rm registry

Service Discovery

This project uses Eureka or Consul as Discovery service.

While running services in local, then using eureka as service discovery.

While running using docker, consul is the service discovery.

Reason to use Consul is it has better features and support compared to Eureka. Running services individually in local uses Eureka as service discovery because dont want to run consul agent and set it up as it becomes extra overhead to manage. Since docker-compose manages all consul stuff hence using Consul while running services in docker.

TICK stack monitoring.

TICK(Telegraf, InfluxDB, Chronograf, Kapacitor) This setup is getting more attention due to its push and pull model. InfluxDB is a time series database, bookstore services push the metrics to influxDB(push model), In Telegraf we specify the targets to pull metrics(pull model). Chronograf/Graphana can be used to view the graph/charts. Kapacitor is used to configure rules for alarms.

Deploying with docker-compose.yml will take care of bringing all this monitoring containers up.

Port Configurations

Business Logic

Service Port
Account 4001
Billing 5001
Catalog 6001
Order 7001
Payment 8001

Administrative

Service Port
MySQL 3306
Consul 8500
Zuul 8765
Telegraf 8125
Zipkin 9411
InfluxDB 8086
Chronograf 8888
Kapacitor 9092

Account Service

To Get access_token for the user, you need clientId and clientSecret

clientId : '93ed453e-b7ac-4192-a6d4-c45fae0d99ac'
clientSecret : 'client.devd123'

There are 2 users in the system currently. ADMIN, NORMAL USER

Admin 
userName: 'admin.admin'
password: 'admin.devd123'
Normal User 
userName: 'devd.cores'
password: 'cores.devd123'

To get the accessToken (Admin User)

curl 93ed453e-b7ac-4192-a6d4-c45fae0d99ac:client.devd123@localhost:4001/oauth/token -d grant_type=password -d username=admin.admin -d password=admin.devd123

bookstore's People

Contributors

devdcores avatar andrei-calin-dragomir avatar vnzstc avatar

Stargazers

 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.