Connecting to the Tonic database

Instructions for how to connect to the Tonic metadata database, which is a PostgreSQL database.
Tonic uses a PostgreSQL database to store its internal state. This database does not store customer data. It only stores data that Tonic needs to operate.
In general, you do not need to connect directly to the Tonic application database. These details are provided if needed for advanced troubleshooting.

How to connect

When you initially set up Tonic, you provide Tonic with connection details to a PostgreSQL database. How to connect depends on where you set up your PostgreSQL database.

Inside a Docker container

Some customers set up a PostgreSQL database inside the same Docker network as the other Tonic containers. In that case, you should ensure that:
  • Port 5432 is exposed on the PostgreSQL Docker container.
  • Port 5432 is properly mapped.
To do this, add the following section to the PostgreSQL service section of your docker-compose file:
#This will expose Port 5432 on the docker container and map it to
#Port 5432 on the host machine
- 5432:5432

Standalone PostgreSQL or cloud installation

If you installed PostgreSQL in a standalone fashion, or you use a cloud service such as Amazon RDS, then make sure that the firewall settings and security groups allow a connection on the appropriate port.

Making the connection

You can use any PostgreSQL client. The following example uses psql, the PostgreSQL command line client.
#psql -h <HOST> -p <PORT> -U <user> -d <Tonic DB name>
psql -h localhost -p 5432 -U pguser -d allos