Skip to content

KomMonitor/client-config

Repository files navigation

KomMonitor Client Config REST Service

This NodeJS project is part of the KomMonitor spatial data infrastructure. As a simple REST service it stores and serves several configuration files consumed by client applications like KomMonitor web client.

Table of Content

Quick Links And Further Information on KomMonitor

Overview

This Client Config Service offers REST endpoints to store and fetch configuration files consumed by the KomMonitor web client component. Thus it enables dynamic modification of configuration settings within dedicted administration pages of the web client. Three configuration files exist within the folder ./configStorage, each using a non-changeable name for update/retrieval via REST endpoint:

  1. general application settings stored in ./configStorage/webClientAppConfig.js
  2. Keycloak connection parameters stored in ./configStorage/webClientKeycloakConfig.js
  3. group-based app element visibility settings to hide certain app functions/elements for non-authorized users/groups in ./configStorage/webClientControlsConfig.js
  4. global filter definitions for grouping topics, indicator and georesources in ./configStorage/webClientFilterConfig.js

The respective content of each file may change over time. Please refer to the documentation of the KomMonitor Web Client component to inspect each config file options or get hints on how to adjust contents.

The described REST operations are specified using Swagger/OpenAPI v3. The corresponding openapi.yaml containing the REST API specification is located at api/openapi.yaml. To inspect the REST API you may use the online Swagger Editor or, having access to a running instance of the KomMonitor Client Config REST API simply navigate to <pathToDeyployedInstance>/docs, e.g. localhost:8088/docs.

The service is implemented as a NodeJS server application.

Dependencies to other KomMonitor Components

Since version 2.0.0 KomMonitor Client Config service requires Keycloak for authenticated access to POST requests. Only KomMonitor administrators shall be allowed to call the POST endpoints of this service. Within the Keycloak realm the client-config component must be integrated as a realm client with access type confidential so that a keycloak secret can be retrieved and configured. The client config component itself is required by Web client component.

Installation / Building Information

Being a NodeJS server project, installation and building of the service is as simple as calling npm install to get all the node module dependencies, then configure the service by adjusting the variables in env.js and eventually run npm start. This will start the service per default on localhost:8088. Even Docker images can be acquired with ease, as described below. However, depending on your environment configuration aspects have to be adjusted first.

Configuration

Similar to other KomMonitor components, some settings are required, especially to adjust connection details to other linked services to your local environment. This NodeJS app makes use of dotenv module, which parses a file called .env located at project root when starting the app to populate its properties to app components.

.env - Configure Deployment Details of other Services

The central configuration file is located at .env. Several important aspects must match your target environment when deploying the service. These are:

# server port
PORT=8088 
# enable/disable keycloak
KEYCLOAK_ENABLED=true 
# keycloak realm name
KEYCLOAK_REALM=kommonitor 
# keycloak target URL inlcuding /auth/
KEYCLOAK_AUTH_SERVER_URL=http://localhost:8080/auth/
# keycloak client name 
KEYCLOAK_RESOURCE=kommonitor-client-config
# keycloak client secret using access type confidential 
KEYCLOAK_CLIENT_SECRET=keycloak-secret 
# name of kommonitor admin role within keycloak - default is 'kommonitor-creator'
KOMMONITOR_ADMIN_ROLENAME=kommonitor-creator 

After adjusting the configuration to your target environment, you may continue to build and run the service as described next.

Running the NodeJS KomMonitor Client Config Server

Local Manual Startup and Shutdown

Make sure you have installed all node dependencies by calling npm install. The to locally start the server enter command npm start from the project root, which will launch the app and serve it according to port setting at localhost:<PORT> (per default localhost:8088). In a browser call localhost:<PORT>/docs to inspect the REST API. To shutdown simply hit CTRL+c in the terminal.

Docker

The KomMonitor Client Config component can also be build and deployed as Docker image (i.e. docker build -t kommonitor/client-config:latest .). The project contains the associated Dockerfile and an exemplar docker-compose.yml on project root level. The Dockerfile contains a RUN npm install --production command, so necessary node dependencies will be fetched on build time.

The exemplar docker-compose.yml file specifies only a the web client and client config service components of the KomMonitor stack

Exemplar docker-compose File with explanatory comments

Only contains subset of whole KomMonitor stack to focus on the config parameters of this component. See separate KomMonitor docker repository for full information on launching all KomMonitor components via docker.

version: '2.1'

networks:
  kommonitor:
      name: kommonitor

services:
  
  # web map client - main user interface of KomMonitor
    kommonitor-client:       
      image: 'kommonitor/web-client'
      container_name: kommonitor-client
      #restart: unless-stopped
      volumes:
       - ./client/config-storage-server.json:/usr/share/nginx/html/config/config-storage-server.json    # mount config for client-config-service 
      ports:
        - 8089:80
      networks:
       - kommonitor

    # simple REST service that stores and serves various config files for KomMonitor clients (i.e. web-client)   
    kommonitor-client-config:          
      image: 'kommonitor/client-config'
      container_name: kommonitor-client-config
      #restart: unless-stopped
      ports:
        - 8088:8088
      networks:
       - kommonitor 
      volumes:
       - client_config_storage:/code/configStorage        # persist web client config files on disk
      environment:
       - PORT=8088  

How to Contribute

The technical lead of the whole KomMonitor spatial data infrastructure currently lies at the Bochum University of Applied Sciences, Department of Geodesy. We invite you to participate in the project and in the software development process. If you are interested, please contact any of the persons listed in the Contact section:

Branching

The master branch contains latest stable releases. The develop branch is the main development branch that will be merged into the master branch from time to time. Any other branch focuses certain bug fixes or feature requests.

Third Party Dependencies

We use license-checker to gain insight about used third party libs. I.e. install globally via npm install -g license-checker, navigate to root of the project and then perform license-checker --json --out ThirdParty.json to create/overwrite the respective file in JSON format.

Contact

Name Organization Mail
Christian Danowski-Buhren Bochum University of Applied Sciences christian.danowski-buhren@hs-bochum.de
Andreas Wytzisk Bochum University of Applied Sciences Andreas-Wytzisk@hs-bochum.de

Credits and Contributing Organizations

  • Department of Geodesy, Bochum University of Applied Sciences
  • Department for Cadastre and Geoinformation, Essen
  • Department for Geodata Management, Surveying, Cadastre and Housing Promotion, Mülheim an der Ruhr
  • Department of Geography, Ruhr University of Bochum
  • 52°North GmbH, Münster
  • Kreis Recklinghausen

About

Storage server API that stores and serves various KomMonitor client config files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •