Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added connection to a host in readme, closed #12 #16

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you;

  • change "pgadmin4" to "pgAdmin 4" (capital "A", and a space before the "4"; it's the preferred naming that's used)
  • put the pg-hba.conf and postgresql.conf in back tics (here, and in the other lines below) so that they are presented in a fixed-width font? i.e.;
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`
  • wrap long lines to 80-characters?


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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"that can be replaced by the your container ip address"; looks like "your" should be removed; can you change to:

`0.0.0.0/0` means any host is allowed to connect. To restrict access to the pgAdmin container,
you can change this to the containers' IP-address.


Open the postgresql.conf changing 9.x to your postgres version.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you change "postgres version" to "PostgreSQL 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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`'*'` configures your PostgreSQL server to listen on all IP addresses.

Perhaps remove the second sentence ("Again, you can replace by your container ip address"), because container IP-addresses are generally random assigned, so listening on any address that the container listens on should be good


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.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps something like;

Now, create a new server connection in pgAdmin, and put your hosts' IP-address
in the `host name/address` field. You can find your hosts' IP address using the
`ifconfig` command.


## Persistent data

Persistent data is stored in a volume, located at `/pgadmin/`. This allows
Expand Down