From 037b058bb15d0a36ab9546279fa65d0ea6fe8c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o?= Date: Sun, 3 Sep 2017 13:30:33 -0300 Subject: [PATCH] Added connection to a host --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index a6f4653..da2679a 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,39 @@ if everything is working. ![screenshot](https://raw.githubusercontent.com/thaJeztah/pgadmin4-docker/master/pgadmin-screenshot.png) +### Connect to a host running PostgreSQL + +To connect pgadmin4 with a database running in a host you have to modify two files in the host, pg-hba.conf and postgresql.conf + +Open the pg-hba.conf +```bash +#change 9.x to your PostgreSQL version +$ sudo vim /etc/postgresql/9.x/main/pg_hba.conf +``` + +And add the line +```conf +host all all 0.0.0.0/0 trust +``` + +`0.0.0.0/0` means any host is allowed to connect, that can be replaced by the your container ip address + +Open the postgresql.conf changing 9.x to your postgres version. + +```bash +#change 9.x to your PostgreSQL version +$ sudo vim /etc/postgresql/9.x/main/postgresql.conf +``` + +And add the line + +```conf +listen_addresses = '*' +``` +`'*'` means your host is listening all ip address. Again, you can replace by your container ip address + +Now just discover your local ip using `ifconfig`, and put it in the `hostname/address` field, when create a new server in pgadmin4, to connect the database host. + ## Persistent data Persistent data is stored in a volume, located at `/pgadmin/`. This allows