magicnexush2020/magic-nis-backend

By magicnexush2020

Updated over 5 years ago

A MuSIASEM processors-network engine, product of MAGIC-Nexus project

Image
0

115

magicnexush2020/magic-nis-backend repository overview

Quick start

  1. Execute docker run --rm -p 8085:80 magicnexush2020/magic-nis-backend:latest

This single line runs "nis-backend", internally performing three steps: pull the image (magicnexush2020/magic-nis-backend:latest), create and start a -temporary- container, directing log to console, and opening the application on port 8085.

After startup (which happens right after the image has been pulled), please wait about a minute to allow database initialization (log messages stop).

  1. Follow http://localhost:8085/nis_client/ to open "nis-frontend" GUI in a browser (tested: Chrome, Firefox, Edge). An R or Python script using "nis-client" package may be directed to http://localhost:8085/nis_api/.

To stop the temporary container, press Ctrl+C.

A more elaborated setup

First, download the image:

docker pull magicnexush2020/magic-nis-backend:latest

Then create a container, passing -or not- the name of a configuration file as an environment variable. If specified, a configuration file must be copied inside the container :

docker create --name nis-local -p 8085:80 magicnexush2020/magic-nis-backend:latest (default configuration)

docker create --name nis-local -p 8085:80 -e MAGIC_NIS_SERVICE_CONFIG_FILE="nis-backend.conf" magicnexush2020/magic-nis-backend:latest

Prepare a configuration file (see description of variables in the table of next section), let us assume it is named "nis-backend.conf", to copy it inside the newly created container:

docker cp nis-backend.conf nis-local:/app/nexinfosys/restful_service/nis-backend.conf

To start the container and log to console, issue the following:

docker start nis-local && docker logs nis-local -f

A volume connected to "/srv" can also be used. For instance:

docker create --name nis-local -p 8085:80 -v /home/dummy/nis-data:/srv -e MAGIC_NIS_SERVICE_CONFIG_FILE="nis-backend.conf" magicnexush2020/magic-nis-backend:latest

If the configuration file states that all directories will hang from "/srv", and the volume parameter is used, data will be stored in a directory outside the container.

Configuration file

If no configuration file is provided (environment variable MAGIC_NIS_SERVICE_CONFIG_FILE not specified), a default configuration file is internally generated.

To specify a custom configuration, a text file with the typical syntax of a Variable and its Value per line must be created:

VAR1="VALUE"

VAR2="VALUE"

Variable nameValueExample
DB_CONNECTION_STRINGMetadata database, SQLAlchemy compliant connection string"sqlite:///nis_metadata.db"
DATA_CONNECTION_STRINGDataset cache database, SQLAlchemy compliant connection string"sqlite:///nis_cached_data.db"
CASE_STUDIES_DIRDirectory where case studies would be stored"/srv/nis_data/cs/"
FAO_DATASETS_DIRDirectory where FAO datasets are downloaded and cached"/srv/faostat/"
FADN_FILES_LOCATIONDirectory where FADN datasets are downloaded and cached"/srv/fadn"
CACHE_FILE_LOCATIONDirectory where SDMX datasets are downloaded and cached"/srv/sdmx_datasets_cache"
REDIS_HOST_FILESYSTEM_DIRIf REDIS_HOST='filesystem:local_session', directory where sessions are stored"/srv/sessions"
SSP_FILES_DIRNot used""
REDIS_HOST"localhost" expects a REDIS server available at localhost:6379; "redis-local" creates a local REDIS instance; "filesystem:local_session" uses filesystem to store sessions (perfect option for local execution)""
TESTING"True""True"
FS_TYPENot used""
FS_SERVERNot used""
FS_USERNot used""
FS_PASSWORDNot used""
GAPI_CREDENTIALS_FILEPath to a file obtained from Google API management web, to directly access a NIS workbook file in Google Sheets"/srv/credentials.json"
GAPI_TOKEN_FILEPath to a file used to stored authorization token"/srv/tocken.pickle"

Github repository

The source code can be found at:

https://github.com/MAGIC-nexus/nis-backend

Tag summary

Content type

Image

Digest

Size

398.5 MB

Last updated

over 5 years ago

Requires Docker Desktop 4.37.1 or later.