Skip to content

Host Library Microservice

The lib microservice is a simplified file manager providing graphQL API. It has three features:

  • provide a listing of directory contents.
  • transfer a file to user.
  • Source files can either come from local file system or from a gitlab instance.

The library microservice is designed to manage and serve files, functions, and models to users, allowing them to access and interact with various resources.

This document provides instructions for running a stand alone library microservice.

Setup the File System

The users expect the following file system structure for their reusable assets.

File System Layout

There is a skeleton file structure in DTaaS codebase. You can copy and create file system for your users.

⬇ Install

The package is available in Github packages registry and on npmjs.

Set the registry and install the package with the one of the two following commands

sudo npm install -g @into-cps-association/libms  # requires no login
sudo npm config set @into-cps-association:registry https://npm.pkg.github.com

The github package registry asks for username and password. The username is your Github username and the password is your Github personal access token. In order for the npm to download the package, your personal access token needs to have read:packages scope.

⚙ Configure

The microservices requires config specified in INI format. The template configuration file is:

1
2
3
4
5
6
PORT='4001'
MODE='local'
LOCAL_PATH='/Users/<Username>/DTaaS/files'
LOG_LEVEL='debug'
APOLLO_PATH='/lib' or ''
GRAPHQL_PLAYGROUND='false' or 'true'

The LOCAL_PATH variable is the absolute filepath to the location of the local directory which will be served to users by the Library microservice.

Replace the default values the appropriate values for your setup.

🚀 Use

Display help.

libms -h

The config is saved .env file by convention. The libms looks for .env file in the working directory from which it is run. If you want to run libms without explicitly specifying the configuration file, run

libms

To run libms with a custom config file,

libms -c FILE-PATH
libms --config FILE-PATH

If the environment file is named something other than .env, for example as .env.development, you can run

libms -c ".env.development"

You can press Ctl+C to halt the application. If you wish to run the microservice in the background, use

nohup libms [-c FILE-PATH] & disown

The lib microservice is now running and ready to serve files, functions, and models.

Service Endpoint

The URL endpoint for this microservice is located at: localhost:PORT/lib

The service API documentation is available on user page.