A supported database (currently: PostgreSQL) must be running.
On a Linux system, you would do one of:
postgres
(you can do su - postgres
as root
to log in to that account on Linux) and run: pg_ctl start
root
and run: systemctl start postgresqlXX (XX being the version)
root
and run: service postgresql start
A web (HTTP) server with PHP support (like Apache HTTP Server with mod_php installed) must be running.
On a Linux system, you would do one of (as root
):
systemctl start httpd-prefork
service httpd start
Create the database user to host the application's database.
On PostgreSQL, login to the system as the database user postgres
and run:
createuser -P trinventum
You can create other database users later, and give them full or less privileges so that those users can execute all the activities or just the ones they have access to.
Create the application's database.
On PostgreSQL, login to the system as the database user postgres
and run:
createdb -O trinventum trinventum
A procedural language suitable for the database must be installed in the logical database.
On PostgreSQL versions earlier than 9.0, login to the system as the database user postgres
and run:
createlang plpgsql trinventum
(don't wory if it says that the language already exists).
Later PostgreSQL have the language already built-in by default.
Database access rules must be created within the database server unless you wish to leave the default rules.
On PostgreSQL, you would do (as the database user postgres
or root
):
cp /var/lib/pgsql/data/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf-backup
echo local trinventum trinventum scram-sha-256 >> /var/lib/pgsql/data/pg_hba.conf
echo host all all 127.0.0.1/32 scram-sha-256 >> /var/lib/pgsql/data/pg_hba.conf
(Note the double >>
- it's CRUCIAL to use double >>
, a single >
would OVERWRITE the target file).
On older PostgreSQL versions replace scram-sha-256
with md5
.
If you'll need to access the database from another computer:
host all all 127.0.0.1/32 scram-sha-256
should be added to pg_hba.conf, containing the correct IP address/etc/hosts.allow
file (tcpwrappers) may need to be adjustedAfter changing the access rules for the database server, restart it. On Linux with PostgreSQL, you would do one of:
postgres
and run: pg_ctl restart
root
and run: systemctl restart postgresqlXX (XX being the version)
root
and run: service postgresql restart
To install:
webapp
directory (including hidden files) to a chosen location reachable by the web server and adjust the access modes accordingly so that the web server can actually run the files.make
program and some common Linux utilities, you can run make install
, passing the prefix of the target directory. Trinventum will be installed in $(PREFIX)/trinventum
. Examples: make install PREFIX=/srv/www/html SERVERCONF=/etc/httpd/conf/webapps.d
make install PREFIX=/var/www/html SERVERCONF=/etc/httpd/conf.d
make install PREFIX=$HOME/public_html SERVERCONF=$HOME/tmp
The SERVERCONF
parameter specifies where to put the global web server configuration file. Can be ignored and set to any directory for local installations.
To install the documentation, you can add a chosen directory as the DOCDIR
parameter to make install
. Documentation will be installed in $(DOCDIR)/trinventum
. Examples:
make install PREFIX=/srv/www/html SERVERCONF=/etc/httpd/conf/webapps.d DOCDIR=/usr/share/doc
make install PREFIX=/var/www/html DOCDIR=/usr/share/doc
make install PREFIX=$HOME/public_html DOCDIR=$HOME/tools/doc
trinventum
created earlier). There is NO NEED to run any SQL scripts manually.To install Trinventum as a Docker container for testing, execute one of (as root
):
docker/docker.sh
docker-compose -p trinventum -f docker/docker-compose.yaml up -d
in the Trinventum source code top directory (NOT the docker
subdirectory).
WARNING: The default configuration has no permanent storage for the database. In order to have a persistent, working setup, you must add permanent storage to the configuration files.
WARNING: The default docker-compose.yaml
file has hardcoded simple passwords. If you wish to use this file and have a secure setup, you must change those passwords in the file.
Apart from the main database user (the database owner), you can have users with various privileges using the application:
To create the base roles, run the scripts/create_roles.pgsql
file on the database as the database administration user (postgres
):
psql -U postgres -d trinventum -f scripts/create_roles.pgsql
Then, you can use the shell command createuser
to create new users - login to the system as the database user postgres
and run:
createuser -P trin_mgr
createuser -P trin_sell
createuser -P trin_buy
createuser -P trin_tx
and grant the selected role(s), found in the scripts/create_roles.pgsql
file, to the new user:
psql -U postgres -d trinventum -c 'grant trinventum_product_manager to trin_mgr'
psql -U postgres -d trinventum -c 'grant trinventum_seller_manager to trin_sell'
psql -U postgres -d trinventum -c 'grant trinventum_buyer_manager to trin_buy'
psql -U postgres -d trinventum -c 'grant trinventum_transaction_manager to trin_tx'
Then, you can log in as the chosen user and have access to just the required functionalities.
To uninstall, if needed:
remove the contents of the webapp
directory from the location chosen during installation (you can also run make uninstall
, passing the same prefix as during the installation),
delete the application's database - run as postgres
:
dropdb trinventum
postgres
: dropuser trinventum