Skip to content

Host Library Microservice

The lib microservice is a simplified file manager serving files over graphQL and HTTP API.

It has two features:

  • provide a listing of directory contents.
  • upload and download files

This document provides instructions for installing npm package of library microservice and running the same as a standalone service.

Setup the File System

Outside DTaaS

The package can be used independently of DTaaS. If this is your use case, you do not need any specific file structure. Any valid file directory is sufficient.

Inside DTaaS

The users of DTaaS 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 npm package is available in Github packages registry and on npmjs. Prefer the package on npmjs over Github.

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

npmjs

sudo npm install -g @into-cps-association/libms  # requires no login

Github

# requires 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.

🚀 Use

Display help.

libms -h

Please see configuration for explanation of configuration conventions. To use .env as 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.libms, you can run

libms -c ".env.libms"

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.

This microservice can also serve files in a browser with files transferred over HTTP protocol.

This option needs to be enabled with -H http.json flag. A sample http config provided here can be used.

nohup libms [-H http.json] & disown

The regular file upload and download options become available.

Service Endpoints

The GraphQL URL: localhost:PORT/lib

The HTTP URL: localhost:PORT/lib/files

The service API documentation is available on user page.