Sign inSign up

cerberus237/adaptable-teastore-registry

By cerberus237

Updated about 1 year ago

The Registry service for the Adaptable TeaStore

Image
Developer tools
Web servers
1

549

cerberus237/adaptable-teastore-registry repository overview

Adaptable TeaStore Registry Service Documentation

1. Overview of the Component

Description

The Adaptable TeaStore Registry service is a crucial component that acts as a service registry for the Adaptable TeaStore application. It enables other services to register themselves and be discoverable by load balancers, facilitating seamless communication and scalability across the microservices architecture.

Architecture

The Registry service operates as a microservice within the Adaptable TeaStore ecosystem. It allows different services to make themselves visible to load balancers, ensuring that requests are directed to the appropriate service instances. This architecture supports dynamic scaling and efficient service discovery.

Role in the Adaptable TeaStore
  • Service Discovery: Allows services to register and discover other services within the ecosystem.
  • Load Balancing: Provides the necessary information for load balancers to distribute traffic effectively.
  • Integration: Works in conjunction with other services to ensure efficient communication.

2. Helpful Docker Command

To start the Adaptable TeaStore Registry service, you can use the following command:

docker run -e "HOST_NAME=10.1.2.3" -e "SERVICE_PORT=10000" -p 10000:8080 -d cerberus237/adaptable-teastore-registry
Explanation of Command:
  • docker run: Command to create and run a new container.
  • -e "HOST_NAME=10.1.2.3": Sets the environment variable for the host name.
  • -e "SERVICE_PORT=10000": Sets the port number for the service.
  • -p 10000:8080: Maps port 10000 of the host to port 8080 of the container.
  • -d: Runs the container in detached mode.
  • cerberus237/adaptable-teastore-registry: The name of the Docker image.

3. Sample Docker-Compose Code

Here’s a sample docker-compose.yml file to run the Adaptable TeaStore Registry service using Docker Compose:

version: '3'
services:
  registry:
    image: cerberus237/adaptable-teastore-registry
    expose:
      - "8080"
Explanation of Directives:
  • version: '3': Specifies the Docker Compose file format version.
  • services: Defines the services to be run.
    • registry: The name of the service.
      • image: Specifies the Docker image to use for the service.
      • expose: Makes the specified port accessible to linked services (not to the host).

4. Overview of the Dockerfile

The Dockerfile for the Adaptable TeaStore Registry service is designed to set up the environment for running the service. Below is an overview of its structure and components:

FROM cerberus237/adaptable-teastore-base:latest
LABEL org.opencontainers.image.authors="Inria R&D engineer <[email protected]>"

COPY target/*.war /usr/local/tomcat/webapps/
Explanation of Dockerfile Components:
  • FROM cerberus237/adaptable-teastore-base:latest: Specifies the base image to use, which is the latest version of the Adaptable TeaStore base image.
  • LABEL: Provides metadata about the image, including the author's contact information.
  • COPY target/*.war /usr/local/tomcat/webapps/: Copies the compiled WAR file of the Registry service to the Tomcat webapps directory for deployment.

5. Instrumented Adaptation Actions and Metrics Collectors

5.1 Available Collectors

The Registry service provides a family of collectors to support various system metrics:

CategoryCollectors (Local & Remote)
CPU UsageLocalCpuUsageCollector, RemoteRegistryCpuUsageCollector
Memory UsageLocalMemoryUsageCollector, RemoteRegistryMemoryUsageCollector
RequestsLocalRequestMetricsCollector, RemoteRegistryRequestMetricsCollector
Response TimeRemoteRegistryResponseTimeCollector
Service StateRemoteRegistryStateCollector
Service StatusRemoteRegistryStatusCollector

Each collector is designed to fetch remote metrics via REST API calls, providing insights into the registry's performance and health.

5.2 Usage Examples
Remote CPU Usage Collection

The RemoteRegistryCpuUsageCollector fetches CPU metrics from the registry service using a REST API call.

Example: Collecting Remote CPU Usage
RemoteRegistryCpuUsageCollector cpuUsageCollector = new RemoteRegistryCpuUsageCollector("metrics/cpu");
double currentCpuUsage = cpuUsageCollector.get();
System.out.println("Current Remote Registry CPU Usage: " + currentCpuUsage + "%");
5.3 REST API Endpoints for Metrics Collection

Note: Each service in the Adaptable TeaStore exposes a REST API endpoint to provide its metrics.

Example API Endpoints
MetricEndpointHTTP Method
CPU Usage/metrics/cpuGET
Memory Usage/metrics/memoryGET
Request Count/metrics/requestsGET
Response Time/metrics/statusGET
Service State/metrics/stateGET
Service Status/metrics/statusGET
Example: Fetching CPU Usage from the Registry Service
curl -X GET http://service-instance:8080/metrics/cpu

6. Adaptation Actions

The Adaptable TeaStore Registry service does not currently implement any adaptation actions.

7. Summary

The Adaptable TeaStore Registry service is essential for service discovery and communication within the application. It can be easily deployed using Docker commands or Docker Compose and integrates seamlessly with other services in the Adaptable TeaStore architecture. The provided Dockerfile ensures a well-configured environment for running the service, while the instrumented metrics collectors enable effective monitoring capabilities. For further details, refer to the Getting Started documentation.

Tag summary

Content type

Image

Digest

sha256:23feaba83

Size

269.7 MB

Last updated

about 1 year ago

docker pull cerberus237/adaptable-teastore-registry