In Short: execute the following commands on the database server and go through the connection wizard.
sudo pip install chartio chartio_setup
There are two ways to connect a PostgreSQL database to Chartio.
Chartio has built a light weight set of scripts to make the highest connection security practices a breeze to setup. You can read more details about the connection client here.
For most Linux systems the following commands should get the Chartio client installed and start the connection wizard.
sudo pip install chartio
chartio_setup
The chartio_setup wizard will walk you through setting up a readonly user, connecting to Chartio, and then give you a link to visit your dashboard and see some charts being automatically generated.
If you don't have pip, but have easy_install you can alternatively run the following
sudo easy_install chartio
chartio_setup
If you do not have the pip or easy_install python package managers you can either install pip with the following commands
$ curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$ python get-pip.py
or download and install the Chartio Connection Client source yourself:
curl https://chartio.com/static/src/chartio-latest.tar.gz -o chartio-latest.tar.gz
tar xvzf chartio-latest.tar.gz
cd chartio-latest
sudo python setup.py install
chartio_setup
If you're PostgreSQL database is hosted on Amazon RDS, Heroku or another hosting service that does not allow shell access to the database instances, you won't be able to use the Connection Client and will instead need to connect directly. If you're database is on Amazon RDS please visit the RDS setup documentation to first enable chartio to your security group before following these steps.
In your project settings select + New Data Source in the Data Sources column. You'll be brought to the following list of connection options where you can choose PostgreSQL to connect your PostgreSQL database.

You will be brought to a page where you can choose between connecting with the Connection Client or the Direct Connection. Since you're reading this documentation you likely want to use the Direct Connection so select it.

Now you'll see the following form for putting in your connection information.

To connect to PostgreSQL Chartio needs the following information.
Creating a Read-only User with the pgAdmin GUI interface
Creating a Read-only user from the command line with PSQL
By default, PostgreSQL restricts connections to hosts and networks included in the pg.hba.conf file. You may need to add Chartio's IP address to this file to allow connectivity to your database.
To allow the user 'chartio_read_only' to connect to the database 'mydatabase' from Chartio's IP address (173.203.96.249) you would add the following line to pg_hba.conf:
host mydatabase chartio_read_only 173.203.96.249/32 md5
You may need to restart your PostgreSQL server for the changes to take effect.
For more details on modifying the pg_hba.conf file consult the PostgreSQL documentation.
If you have issues connecting with Chartio, the exact PostgreSQL or connection errors should be displayed for you as form errors when submitting. If you are unclear on what the error messages mean or how to fix them do not hesitate to email us at support@chartio.com.
If you have already established a database connection but something is going wrong, please read our documentation on database connection debugging.