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.
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.
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
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.
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