-
Notifications
You must be signed in to change notification settings - Fork 58
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps something like;
|
||
|
||
## Persistent data | ||
|
||
Persistent data is stored in a volume, located at `/pgadmin/`. This allows | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you;
pg-hba.conf
andpostgresql.conf
in back tics (here, and in the other lines below) so that they are presented in a fixed-width font? i.e.;