Skip to content

pgAdmin4 Setup

The pgAdmin4 is an Open Source administration console that can be useful for developing applications using a PostgreSQL® database.

There are several ways to install and configure pgAdmin4, the most useful choices are as a Container in the running ESF machine, or as a native application on an external device.

Create pgAdmin4 Container Instance

Warning

The following container only works for amd64/arm64v8 architectures. If using this container in another device, make sure to open ports from the ESF Firewall to be able to access the PostgreSQL® instance.

From ESF, configure the ESF Container Orchestration Service and create a new ContainerInstance as in the Container Setup tutorial. In this case, use the following settings:

  • Enabled: true
  • Image name: dpage/pgadmin4
  • Internal Ports: 5050
  • External Ports: 5050
  • Environment Variables: PGADMIN_DEFAULT_EMAIL=user@domain.com,PGADMIN_DEFAULT_PASSWORD=<password>

Warning

On some filesystems that do not support extended attributes, it may not be possible to run pgAdmin without specifying a value for PGADMIN_LISTEN_PORT that is greater than 1024. In such cases, specify an alternate port when launching the container by adding the environment variable, for example:

Environment Variables: PGADMIN_LISTEN_PORT=5050

Don’t forget to adjust any host-container port mapping accordingly.

This will pull and start a container with pgAdmin4. Other settings (like secure access) can be set at container instantiation. Follow the pgAdmin4 container documentation to find out more.

Warning

pgAdmin runs as the pgadmin user (UID: 5050) in the pgadmin group (GID: 5050) in the container. You must ensure that all files are readable, and where necessary (e.g. the working/session directory) writeable for this user on the host machine. For example:

sudo chown -R 5050:5050 <host_directory>

The console is accessible from a web browser at the link:

https://<device-ip>:5050

Install pgAdmin4 Natively

The correct installer that suits you opertaing system can be found at this link. Once installed, simply run the application.

Configure pgAdmin4

Once opened the console and configured the master password, the following window appears.

To connect to the PostgreSQL® instance, right click on the "Servers" icon and register a new server (picture below).

From the configuration window, enter a meaningful Name and edit the Connection tab with the informations about the postgres instance running on ESF. If configured as in the other tutorials of this documentation, the configuration should look like in the picture below.

From there, it is possible to gather all sorts of information about the database, such as statistics, available schemas, etc. A very handy tool is called the Query Tool which can be used to perform SQL queries to the database (see picture below).

The extended usage and documentation can be found at the pgAdmin Docs page.