Storage

quantra terminal is a web based app so just a web browser is needed. All data can be downloaded to a file that can be used later to recover what has been done. A local postgres database can be used as a storage system too, see the details in database section.

Files

Download an entity

At any time and regardless of whether you are connected to a database or not is possible to download each of the entities separately. For each entity go to File->Download and a file with the information will be downloaded.

Download all

In case you are not connected to a database you will be able to download everything. Go to Tools->Files->Download.

Upload

Any file that has been downloaded can be uploaded later to recover what has been previously done.

Note

Is not possible yet to import into a database from a file. If you are connected to a database the load file option is disabled

Database

It is possible to use quantra terminal with your own database, all what you need is a postgres database and an instansce of Postgrest configured and running. Once you have this the browser you will use for quantra needs to have access to the services from Postgrest.

Quick installation

This configuration will use the database to create the JWT tokens and this configuration is explained at JWT from SQL section of Postgrest website. You can use a different approach, the only requirement is that login has to be done with /rpc/login url.

  • Install postgres and Postgrest
  • Install pgcrypto and pgjwt extension
  • Create a database
CREATE DATABASE quantradb;
psql < roles.sql
psql -d quantradb < quantradb.sql
  • We will now create a read and write users. Below commands will create a read user with read password that will have read permissions and a write user with write password that will have write permissions
INSERT INTO basic_auth.users VALUES ('write','write','write_user');
INSERT INTO basic_auth.users VALUES ('read','read','write_user');
  • A configuration file is needed for Postgrest:
server-port     = 4000
db-uri          = "postgres://user:password@host/quantradb"
db-schema       = "api"
jwt-secret      = "aSecurePassword"
db-anon-role    = "anon"

The jwt-secret has to be the same that is used inside the login sql function. Inside quantradb.sql file:

117 select sign(
118 row_to_json(r), 'aSecurePassword'
119 ) as token

Note

(From Postgrest documentation) The OpenSSL toolkit provides an easy way to generate a secure password. If you have it installed, run

openssl rand -base64 32

Quantra database

These are the sql scripts for the tables that quantra will use in case you need a different approach to the one already explained.

Just take into account that exists a table called logintable in the api schema that is used to check the permissions of the users. So grant read permission to the table for read roles and all permissions for users that can write to the database.