Documentation pages
One PostgreSQL server holds the database wsp of the portal; the connection servers use the same database. (A cloud database, your own PostgreSQL cluster or SQL Server work too, see 6.5.)
4.1 Second disk for the data (optional)
If the VM has a second disk for the databases, mount it at /var/lib/postgresql before 4.2. Find it (no file system, no partitions, usually sdb) and check its size: the block erases it.
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
DISK=/dev/sdb
sudo mkfs.ext4 -L pgdata $DISK
sudo mkdir -p /var/lib/postgresql
echo 'LABEL=pgdata /var/lib/postgresql ext4 defaults,noatime 0 2' | sudo tee -a /etc/fstab
sudo systemctl daemon-reload && sudo mount /var/lib/postgresql && findmnt /var/lib/postgresql
4.2 Install and configure
sudo apt install -y postgresql
PGV=$(ls /usr/lib/postgresql | sort -V | tail -1); echo "PostgreSQL $PGV"
sudo tee /etc/postgresql/$PGV/main/conf.d/trinity.conf >/dev/null <<'EOF'
listen_addresses = '*'
max_connections = 200
password_encryption = scram-sha-256
EOF
sudo tee -a /etc/postgresql/$PGV/main/pg_hba.conf >/dev/null <<'EOF'
# TRINITY: portal nodes and VIP, connection servers and VIP - database wsp only, TLS only
hostssl wsp wsp 10.0.10.33/32 scram-sha-256
hostssl wsp wsp 10.0.10.34/32 scram-sha-256
hostssl wsp wsp 10.0.10.36/32 scram-sha-256
hostssl wsp wsp 10.0.10.24/32 scram-sha-256
hostssl wsp wsp 10.0.10.25/32 scram-sha-256
hostssl wsp wsp 10.0.10.26/32 scram-sha-256
EOF
sudo systemctl restart postgresql
Ubuntu's PostgreSQL has TLS on with its own certificate, which is enough for require.
4.3 Database and user
The last command asks for the password twice at a prompt, so it never appears on a command line. Keep it: the portal setup asks for it.
sudo -u postgres psql -c "CREATE ROLE wsp LOGIN"
sudo -u postgres psql -c "CREATE DATABASE wsp OWNER wsp ENCODING 'UTF8' TEMPLATE template0"
sudo -u postgres psql -c '\password wsp'
4.4 Firewall and check
for ip in 33 34 36 24 25 26; do sudo ufw allow from 10.0.10.$ip to any port 5432 proto tcp; done
pg_lsclusters
sudo -u postgres psql -XtAc "select name, setting from pg_settings where name in ('listen_addresses','max_connections','password_encryption','ssl')"
ss -ltn | grep 5432
Back up the database server with your backup product; the portal also makes a nightly dump of its own database.
Names, addresses and accounts in the examples (corp.example.com, 10.0.x.x, CORP\…) are examples: use your own. TRINITY 1.2.1, December 2026.