This page serves as a documentation on what the service registry does and how it works.

Design

Purpose

  1. Provide authentication keys for microservices (as opposed to user-based authentication keys)
    1. This allows microservices to communicate between each other without the approval of a user (action). This is useful (needed) for things such as cron tasks.
  2. Categorize microservices together
    1. Provides ways to register and query as such a category
      1. This allows things such as front-ends to know which services are available and only show those in the user interface.
      2. In the case of the application microservice, this allows for several microservice of the category "application" to be grouped together and used interchangeably for the same thing within oms-events
      3. In the case of the notification pipeline, we will also have several microservices of the category "notification" which either send notifications via mail or push or smoke signals or whatever
  3. Query for frontend modules/pages
    1. Each microservice can register modules/pages/whatever-we-call-them to be displayed additionally in the menu bar and also be loaded upon frontend load. The registry gathers these by a registered getModules.json (the path to this file is set with a label, see "Use"
    2. Currently it uses a hack to register these pages to the core


Use

You can add different labels on a container that the registry will read and that can be queried through the api

LabelDefaultDescription
registry.porttraefik.port or 80The port which the service exposes as the main endpoint
registry.frontendtraefik.frontend.rule parsedThe frontend url under which this service is reachable
registry.enabletraefik.enable or falseWhether the service is reachable through the frontend
registry.categories[ ]

An array of strings and priorities which determines the categories this microservice belongs to

Example: "registry.categories=(events, 10);(notifications, 10)"

registry.description""A description for this service

servicename

The servicename is parsed directly from what is set as a servicename in docker-compose.yml and cannot be altered

registry.modules""

If this service wants to register frontend pages, this should be the relative path where it serves a getModules.json. Do not prepend http://<servicename>:<port> this will be added automatically from the above fields

Example: /frontend/getModules.json → registry queries http://omsevents-frontend:8083/frontend/getModules.json

How to use getModules.json is described here

Code

API

Questions

I (Derk Snijders) read Micro service - communication, went through the code and looked at the API, yet still had some questions. Answering these should provide solid documentation as to how to use the registry.