concept each service in category microservice

appears as: each service, each services
Microservices in Action

This is an excerpt from Manning's book Microservices in Action.

In a monolithic application, you try to design for these properties at a class, module, or library level. In a microservice application, you aim instead to attain these properties at the level of independently deployable units of functionality. A single microservice should be highly cohesive: it should be responsible for some single capability within an application. Likewise, the less that each service knows about the inner workings of other services, the easier it is to make changes to one service — or capability — without forcing changes to others.

As we discussed earlier, each service should be responsible for a single capability. Your first step will be to identify the distinct business capabilities you want to implement and the relationship between those capabilities.

Figure 2.9 In a simple microservices deployment, requests to each service are load balanced across multiple instances, running across multiple virtual machines. Likewise, multiple instances of a service may subscribe to a queue.

c02_09.png
Listing 12.2 Docker compose file with Elasticsearch, Kibana, and Fluentd containers
version: '2.1'
services:

  gateway:
    container_name: simplebank-gateway
    restart: always
    build: ./gateway
    ports:
      - 5001:5000
    volumes:
      - ./gateway:/usr/src/app
    links:
      - "rabbitmq:simplebank-rabbitmq"
      - "fluentd”
 logging:    #1  
      driver: "fluentd" 
      options:
        fluentd-address: localhost:24224
        tag: simplebank.gateway

(…)
  kibana:
 image: kibana    #2  
    links:
 - "elasticsearch"    #3  
    ports:
      - "5601:5601"

  elasticsearch:
 image: elasticsearch    #4  
    expose:
      - 9200
    ports:
      - "9200:9200"

  fluentd:
 build: ./fluentd    #5  
    volumes:
 - ./fluentd/conf:/fluentd/etc    #6  
    links:
 - "elasticsearch"    #7  
    ports:
      - "24224:24224"
      - "24224:24224/udp"
(…)

#1   Adds a logging directive to each service to force Docker to push the output of each container running a service to Fluentd, which in turn will make sure data gets pushed to Elasticsearch
#2   For Kibana, uses the default image in Docker Hub with the defaults set
#3   Links Kibana to the Elasticsearch container, because it’ll consume data from it
#4   Like you did for Kibana, uses the default image for Elasticsearch
#5   Builds Fluentd from a custom Docker image
#6   Injects the configuration for Fluentd into the built container, allowing you to tweak the default configuration
#7   Links the Fluentd container to the Elasticsearch container, because it’ll be pushing data into it
Spring Microservices in Action

This is an excerpt from Manning's book Spring Microservices in Action.

  • Log correlation— How do you tie together all the logs produced between services for a single user transaction? With this pattern, we’ll look at how to implement a correlation ID, which is a unique identifier that will be carried across all service calls in a transaction and can be used to tie together log entries produced from each service.
  • Figure 6.1. Without a services gateway, the service client will call distinct endpoints for each service.

    To implement authorization and authentication controls, you’re going to use Spring Cloud security and the OAuth2 (Open Authentication) standard to secure your Spring-based services. OAuth2 is a token-based security framework that allows a user to authenticate themselves with a third-party authentication service. If the user successfully authenticates, they will be presented a token that must be sent with every request. The token can then be validated back to the authentication service. The main goal behind OAuth2 is that when multiple services are called to fulfill a user’s request, the user can be authenticated by each service without having to present their credentials to each service processing their request. Spring Boot and Spring Cloud each provide an out-of-the-box implementation of an OAuth2 service and make it extremely easy to integrate OAuth2 security into your service.