Connecting to Tonic Database

Instructions for how to connect to Tonics internal data store, a Postgres database

Tonic makes use of a Postgres 9.6 database to store it's internal state. Customer data is not stored in this database but only data needed to allow Tonic to operate.

How to Connect

When you initially setup Tonic you had to provide Tonic with connection details to a Postgres database. How to connect will depend on where you setup your Postgres database.

Inside a Docker Container

Many customers opt to setup a Postgres database inside the same Docker network as the other Tonic containers. In that case, you should ensure that Port 5432 is exposed on the Postgres Docker container and that it is properly mapped. This can be accomplished by adding the following section to your docker-compose file in the Postgres service section:

#This will expose Port 5432 on the docker container and map it to
#Port 5432 on the host machine
- 5432:5432

A Standalone Postgres or Cloud installation

If Postgres was installed in a standalone fashion or you are using a cloud service such as Amazon's RDS then there is nothing special one must do besides make sure that the firewall settings/security groups will allow a connection on the appropriate port.

Making the connection

Any Postgres client can be used but for this example, we'll use psql the Postgres command line client.

#psql -h <HOST> -p <PORT> -U <user> -d <Tonic DB name>
psql -h localhost -p 5432 -U pguser -d allos