Skip to content

libms 0.3.1

Install from the command line:
Learn more about npm packages
$ npm install @into-cps-association/libms@0.3.1
Install via package.json:
"@into-cps-association/libms": "0.3.1"

About this version

Overview

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.

Gitlab setup

For this microserivce to be functional, a certain directory or gitlab project structure is expected. The microservice expects that the gitlab consisting of one group, dtaas (by convention), and within that group, all of the projects be located, user1, user2, ... , as well as a commons projects. Each project corresponds to files of one user. A sample file structure can be seen in gitlab dtaas group. You can visit the gitlab documentation on groups for help on the management of gitlab groups.

You can clone the git repositories from the gitlab dtaas group to get a sample file system structure for the lib microservice.

⬇️ Install

The package is available in github packages registry.

Set the registry and install the package with the following commands

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

⚙️ Configure

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

PORT='4001'
MODE='local' or 'gitlab'
LOCAL_PATH ='/Users/<Username>/DTaaS/files'
GITLAB_GROUP ='dtaas'
GITLAB_URL='https://gitlab.com/api/graphql'
TOKEN='123-sample-token'
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.

The GITLAB_URL, GITLAB_GROUP and TOKEN are only relevant for gitlab mode. The TOKEN should be set to your GitLab Group access API token. For more information on how to create and use your access token, gitlab page.

Once you've generated a token, copy it and replace the value of TOKEN with your token for the gitlab group,

Replace the default values the appropriate values for your setup.

NOTE:

  1. When _MODE=local, only LOCAL_PATH is used. Other environment variables are unused.
  2. When MODE=gitlab, GITLAB_URL, TOKEN, and GITLAB_GROUP are used; LOCAL_PATH is unused.

User Commands

This config is saved .env file by convention. The libms looks for .env file in the working directory from which it is run.

If the environment file is named something other than .env, the filename must be specifed with the command -c, --config <path>, when starting the application. For instance,

yarn start -c ".env.development"

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

🚀 Use

Display help.

libms -h

📦 🚢 NPM package

Use the instructions in publish npm package for help with publishing and using libms npm package.

Application of the advice given on that page for libms will require running the following commands.

libms

Run libms with a custom config file.

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

The microservice is available at: http://localhost:PORT/lib

The API page shows sample queries and responses.

Details


Assets

  • libms-0.3.1.tgz

Download activity

  • Total downloads 3
  • Last 30 days 0
  • Last week 0
  • Today 0