Skip to content

Detector Microservices Service Registry

This repo contains the itk-demo-registry microservice and related packages.

Service Registry itk-demo-registry
principal key-value store server. README
Python package pyregistry
Python library to access the service registry. README
Registrator
automatic Docker container de/registration service. README
UI itk-demo-registry-ui
Reflex based UI to browse the service registry. README

Starting the stack

To start the stack composed of service registry, registrator and UI run the following commands in the root directory of the repo:

Text Only
./config
docker compose up

Label format

The service registry uses Docker container labels to store information about services. Principally it serves to match service keys to dynamically assigned URLs (ports).

As a reminder, each DeMi project belongs to a site. This could be a single user if several DeMi projects run on a single machine shared by several users, an autonomous setup within a lab shared by several setups, or and actual physical site with a single DeMi project such as ATLAS Point-1. Sites are defined as a set of compose stacks. A stack is a compose file containing several related services. A service is a container defined in a compose file.

The general format of service registry labels is:

Text Only
demi.{SITE}.{STACK}.{SERVICE}.{KEY}={VALUE}

where:

  • {SITE} is the DeMi site.
  • The demi.{SITE} phrase is also called DEMI_NAMESPACE.
  • {STACK} refers to the compose file within the site.
  • {SERVICE} is the name of the service within the compose file.
  • {KEY}={VALUE} are the key and value of the label.

General keys

Label Example Usage
description Interface to FELIX hardware Description of the service.
category Microservice Category of the service.
health /health Endpoint that should be used to access health information of service.

Keys needed for URL generation

Label Example Usage
host wupp-charon.cern.ch Fully qualified hostname of the PC hosting the container.
port 8000 Internal port of the service (only needed when multiple ports are exposed).
url_prefix /api Prefix for the service of the container.
url_postfix /docs Postfix for the SWAGGER UI.
protocol http Protocol used to access service.

The URL of a service can be constructed from the following keys. If no hostport is given, the port is taken from the NetworkSettings/Ports section of docker inspect. The URL is constructed in the following way:

  • API/UI: protocol://host:hostport/url_prefix
  • SWAGGER UI: protocol://host:hostport/url_prefix/url_postfix

Examples

An exmplary list of labels for a FELIX container containing the UI and API services looks like this. Note that the ${STACK} variable is read from the env vars and typically contains something like sr1_lls or the user name.

Text Only
labels:
    - demi.${SITE}.felix.api.host=${HOST}
    - demi.${SITE}.felix.api.port=8000
    - demi.${SITE}.felix.api.url_prefix=
    - demi.${SITE}.felix.api.url_postfix=/docs
    - demi.${SITE}.felix.api.health=/health
    - demi.${SITE}.felix.api.description=Interface to FELIX hardware
    - demi.${SITE}.felix.api.protocol=http
    - demi.${SITE}.felix.api.category=Microservice
    - demi.${SITE}.felix.ui.host=${HOST}
    - demi.${SITE}.felix.ui.port=3000
    - demi.${SITE}.felix.ui.category=Microservice-UI
    - demi.${SITE}.felix.ui.description=FELIX UI
    - demi.${SITE}.felix.ui.protocol=http