Sign inSign up

hypercliq/bionic-data-storage

By hypercliq

•Updated about 5 years ago

Image
0

2.1K

hypercliq/bionic-data-storage repository overview

BIONIC

⁠Storage Platform

Backend application to collect and share BIONIC⁠ data.

⁠Table of Contents

⁠Installation

$ npm install

⁠Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

⁠Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

⁠API

Please refer to API⁠ for an explanation of how to interact with the Storage Platform API endpoints and more.

⁠Docker

# start the system
$ docker-compose -f "docker-compose.yml" up -d --build

The compose builds bionic-data-storage from source, downloads mongo and links the 2 images.

Storage address:

Database address:

The Database creates a volume on the host at /tmp/mongo. If necessary, change the location in docker-compose.yml.

Check the Migrations⁠ section after starting the database but before inserting new data.

Use something like MongoDB Compass⁠ to connect to the DB and check your data.

⁠Secrets

To use authorization with the database, uncomment the authorization parameters and create 2 files that hold the db root user credentials (username/password).

echo my_username | sudo tee secrets/db_user.txt
echo my_password | sudo tee secrets/db_pass.txt

⁠Migrations

migrations, in the current form, might be removed in a future version!

Database migrations use the migrate-mongo⁠ package.

⁠Creating migrations
# create a new migration file
$ npm run migrate:create my-new-migration

The migration file is located in ./migrations/{timestamp}-my-new-migration.js

Populate the up and down function in the newly created file. See this⁠.

⁠Running migrations
# up
$ npm run migrate:up

# down
$ npm run migrate:down

While up will run⁠ in one go all pending migrations, down will revert⁠ only the last applied migration.

⁠Migration service

it is possible to run migrations using the storage-migrate service in docker-compose:

docker-compose --profile migration up -d

The up in this command refers to starting a dockerized service not to the migrations.

⁠Stay in touch

⁠License

Licensed under the EUPL-1.2-or-later⁠.

Tag summary

Content type

Image

Digest

Size

51.4 MB

Last updated

about 5 years ago

docker pull hypercliq/bionic-data-storage