PostgreSQL

View a schematic of the LIMS*Nucleus architecture here. If you have experience with PostgreSQL, you may wish to install the LIMS*Nucleus database independent of the client utilizing resources you already control e.g. an AWS instance of Postgres or Postgres running in your internal datacenter. This archive provides the necessary scripts for database installation/configuration. LIMS*Nucleus is agnostic with respect to the location of the database - all that is needed is a valid connection string. Once the database has been configured, the artanis configuration file must be modified.

Scripts included are:

Name Description
initdba.sql create users
initdbb.sql create database
initdbc.sql create schema and grant privileges to users
create-db-sql create tables, load functions, load required data e.g. layouts, plate types, assay types, etc.
example-data.sql load example data projects 1-10. Note this is not optional as LIMS*Nucleus will not boot without Project 1 in the database
drop-func-tables.sql used to refresh the database i.e. delete all user created data and reload required and example data
install-pg.sh install script that calls above scripts; see below for options

Once the database is up and running, install the client.

Postgres Install script

The postgres install script can be used to install a data directory under the current user, \(HOME/lndata, or to modify the database installed by <code>sudo apt-get install postgres</code> in the default data directory at /etc/postgresql/\)PGMAJOR/main

User directory

install-pg.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

mkdir lndata

echo "export PGDATA=\"$HOME/lndata\"" >> $HOME/.bashrc
export PGDATA="$HOME/lndata"
export LC_ALL="C"

sudo mkdir -p /var/run/postgresql
sudo chown -R admin:admin /var/run/postgresql
initdb -D $HOME/lndata

sed -i 's/\#listen_addresses =/listen_addresses =/' $HOME/lndata/postgresql.conf

pg_ctl -D $HOME/lndata -l logfile start

psql -U postgres -h 127.0.0.1 postgres -a -f initdba.sql
psql -U ln_admin -h 127.0.0.1 postgres -a -f initdbb.sql
psql -U ln_admin -h 127.0.0.1 -d lndb -a -f initdbc.sql
psql -U ln_admin -h 127.0.0.1 -d lndb -a -f create-db.sql
psql -U ln_admin -h 127.0.0.1 -d lndb -a -f example-data.sql

Take ownership with sudo chown -R admin:admin /var/run/postgresql where admin:admin is the user id

Default postgres directory

install-pg.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
PGMAJOR=$(eval "ls /etc/postgresql")
PGHBACONF="/etc/postgresql/$PGMAJOR/main/pg_hba.conf"
sudo sed -i 's/host[ ]*all[ ]*all[ ]*127.0.0.1\/32[ ]*md5/host all all 127.0.0.1\/32 trust/' $PGHBACONF

PGCONF="/etc/postgresql/$PGMAJOR/main/postgresql.conf"
sudo sed -i 's/\#listen_addresses =/listen_addresses =/' $PGCONF

eval "sudo pg_ctlcluster $PGMAJOR main restart"

psql -U postgres -h 127.0.0.1 postgres -a -f initdba.sql
psql -U ln_admin -h 127.0.0.1 postgres -a -f initdbb.sql
psql -U ln_admin -h 127.0.0.1 -d lndb -a -f initdbc.sql
psql -U ln_admin -h 127.0.0.1 -d lndb -a -f create-db.sql
psql -U ln_admin -h 127.0.0.1 -d lndb -a -f example-data.sql