Let’s install and configure PgHero and PgAdmin4 in docker to connect to the databases deloyed in the previous post.
If you don’t have docker installed, now is the time to do it.
PgHero:
Create the config for PgHero pghero.yml
:
databases:
database1:
url: postgres://dummy:123456@10.0.0.3:5432/postgres
database2:
url: postgres://dummy:123456@10.0.0.4:5432/postgres
And run the docker command to start it:
docker run -it -d -v $(pwd)/pghero.yml:/app/config/pghero.yml -p 8080:8080 ankane/pghero
If everything is ok, you should see:
PgAdmin 4
First we create pg-admin-servers.json
:
{
"Servers": {
"1": {
"Name": "database1",
"Group": "all",
"Port": 5432,
"Username": "dummy",
"PasswordExecCommand": "echo '123456'",
"Host": "10.0.0.3",
"MaintenanceDB": "postgres"
},
"2": {
"Name": "database2",
"Group": "all",
"Port": 5432,
"Username": "dummy",
"PasswordExecCommand": "echo '123456'",
"Host": "10.0.0.4",
"MaintenanceDB": "postgres"
}
}
}
Now to run it:
docker run -it -v $(pwd)/pg-admin-servers.json:/pgadmin4/servers.json -p 8080:80 -e PGADMIN_CONFIG_ENABLE_SERVER_PASS_EXEC_CMD=True -e 'PGADMIN_DEFAULT_EMAIL=test@example.com' -e 'PGADMIN_DEFAULT_PASSWORD=password' dpage/pgadmin4
If everything is ok, you should see:
Documentation and links:
- PgAdmin 4 docker - https://www.pgadmin.org/docs/pgadmin4/latest/container_deployment.html
- PgAdmin 4 import_export_servers - https://www.pgadmin.org/docs/pgadmin4/latest/import_export_servers.html#json-format
- PgAdmin 4 - PasswordExecCommand issue - https://github.com/pgadmin-org/pgadmin4/issues/6792