Transaction Database Installation

Supported platform

It should be able to run on linux and the transaction_db_setup script can be run on CentOS.

Installation

Extract the package at the desired location:

tar -zxvf aware-knomitransactiondb-*-linux-x86-64.tar.gz

Completing the Running database setup script section (2.3) is required for full functionality of the TransactionDb REST server.

It is recommended that you use the screen tool when running the TransactionDb REST server, so the included commands will be utilizing it.

Start the TransactionDb server:

screen -S aw_transaction_db_rest_server
cd knomitransactiondb/aw_transaction_db_rest_server
./aw_transaction_db_rest_server.sh
Press CTRL A D to disconnect from the screen

At this point, the services are only accessible from the server itself. To make it available to the wider Internet, you must update the “host” parameter with the hostname for your server. For the following example, it will assume the server’s hostname is “server.com”

Edit the Knomi TransactionDb server:

screen -r aw_transaction_db_rest_server
CTRL-C
CTRL-C
sed -i 's/host=.*/host=server.com/g' transaction_db_config.txt
./aw_transaction_db_rest_server.sh
Press CTRL A D to disconnect from the screen

You can query the “/version” endpoint from the command line to ensure it is running correctly:

curl http://server.com:8090/transactiondb/version

Running database setup script

We’ve included this setup script that will install all dependencies, create the postgress database, and apply configuration for TransactionDbRest to function.

If you already have postgres installed, this script will modify some permissions related to the database so that it can be used by Knomi.

Example inputs for running the setup script transaction_db_setup.sh:

Example inputs
   ./transaction_db_setup.sh
       Enter New Postgres Username: test_user
       Enter New Password For New Postgres User: p@sSw3rd
       Enter Database Name: transactiondatabase

Input Requirements:

  • Username : Must be lower case. Underscores and dashes are allowed. 16 char max.
  • Password : May contain any character except for single quote: ‘ . 63 char max.
  • Database : Must be lower case. Alphanumeric characters only. 63 char max.

Response:

A successful run of the setup script should return a response ending like this:
Example response
       CREATE DATABASE
       CREATE ROLE
       GRANT
       Redirecting to /bin/systemctl restart postgresql-12.service

After running this script, you can update the transaction_db_config.txt file and all Knomi servers’ config files with db config options (see Config options for database server section (3.2)). You can then start or restart the transaction db server with connection to the postgres database.

Generating a Full Report

Once setup and installation has been completed and adding db config options to the config txt files of all active Knomi servers (see Config options for database server section (3.2)) has been completed, generating a report can be done via the /fullReport endpoint. Optional additional endpoints of /fullReport/<year>/<month> can be used for more specific reporting.

You can query the endpoint with curl and save the information into a csv file:

curl http://server.com:8090/transactiondb/fullReport/2022 > transactionReport2022.csv