0

Context

I've installed pgAdmin4 using the APT installation procedure on Ubuntu 18.04 (default package without this new apt repository ships pgAdmin in version 3, which is deprecated).

This is how my configuration panel looks like when I open in using the "Configure..." menu from the pgadmin server icon tray;

pgAdmin4 config panel

Which seems to match the content of the ~/.config/pgadmin/pgadmin4.conf file:

$ cat ~/.config/pgadmin/pgadmin4.conf
[General]
ApplicationPath=
BrowserCommand=/usr/bin/brave-browser --private %URL%
FixedPort=true
OpenTabAtStartup=false
PortNumber=5433
PythonPath="/usr/local/lib/python3.6/dist-packages;/usr/lib/python3/dist-packages;/usr/local/lib/python3.6/dist-packages"

Error

Now, if I start pgadmin4 in a console, I got this (it takes some seconds to launch, hence the multiple same failure messages at the beginning):

$ pgadmin4
QCoreApplication::applicationFilePath: Please instantiate the QApplication object first
QCoreApplication::applicationFilePath: Please instantiate the QApplication object first
Semaphore name: "pgadmin4-<user>-3ed67051278d25124b2c63f6651290d1-sema"
Shared memory segment name: "pgadmin4-<user>-3ed67051278d25124b2c63f6651290d1-shmem"
Python path:  "/usr/local/lib/python3.6/dist-packages:/usr/lib/python3/dist-packages:/usr/local/lib/python3.6/dist-packages" 
Python Home:  ""
Webapp path:  "/usr/share/pgadmin4/web/pgAdmin4.py"
Failed to connect to the server: "Connection refused" - request URL: "http://127.0.0.1:39931/misc/ping?key=28059bf0-430c-4759-a9c2-1b05e1b67a02" .
Failed to connect to the server: "Connection refused" - request URL: "http://127.0.0.1:39931/misc/ping?key=28059bf0-430c-4759-a9c2-1b05e1b67a02" .
Failed to connect to the server: "Connection refused" - request URL: "http://127.0.0.1:39931/misc/ping?key=28059bf0-430c-4759-a9c2-1b05e1b67a02" .
Failed to connect to the server: "Connection refused" - request URL: "http://127.0.0.1:39931/misc/ping?key=28059bf0-430c-4759-a9c2-1b05e1b67a02" .
Failed to connect to the server: "Connection refused" - request URL: "http://127.0.0.1:39931/misc/ping?key=28059bf0-430c-4759-a9c2-1b05e1b67a02" .
Failed to connect to the server: "Connection refused" - request URL: "http://127.0.0.1:39931/misc/ping?key=28059bf0-430c-4759-a9c2-1b05e1b67a02" .
Failed to connect to the server: "Connection refused" - request URL: "http://127.0.0.1:39931/misc/ping?key=28059bf0-430c-4759-a9c2-1b05e1b67a02" .
Failed to connect to the server: "Connection refused" - request URL: "http://127.0.0.1:39931/misc/ping?key=28059bf0-430c-4759-a9c2-1b05e1b67a02" .
Failed to connect to the server: "Connection refused" - request URL: "http://127.0.0.1:39931/misc/ping?key=28059bf0-430c-4759-a9c2-1b05e1b67a02" .
Failed to connect to the server: "Connection refused" - request URL: "http://127.0.0.1:39931/misc/ping?key=28059bf0-430c-4759-a9c2-1b05e1b67a02" .
Failed to connect to the server: "Connection refused" - request URL: "http://127.0.0.1:39931/misc/ping?key=28059bf0-430c-4759-a9c2-1b05e1b67a02" .
Failed to connect to the server: "Connection refused" - request URL: "http://127.0.0.1:39931/misc/ping?key=28059bf0-430c-4759-a9c2-1b05e1b67a02" .
Failed to connect to the server: "Connection refused" - request URL: "http://127.0.0.1:39931/misc/ping?key=28059bf0-430c-4759-a9c2-1b05e1b67a02" .
Server response: "PING" - request URL: "http://127.0.0.1:39931/misc/ping?key=28059bf0-430c-4759-a9c2-1b05e1b67a02" .


And it automatically opens a new Firefox tab, where I asked it to open a new Brave browser in private mode tab.

Question

What's wrong there and how can I fix it (i.e. force pgadmin4 to run in a Brave private tab)?

I also want to be able to start pgAdmin4 from an ubuntu TTY (Ctrl + F1, not a GUI console), hence telling it to start without starting any kind of browser, but I got plenty of QT errors).

1 Answer 1

0

As a workaround I have build a docker-compose file (based on this image; https://hub.docker.com/r/dpage/pgadmin4/ as explained here: https://www.pgadmin.org/download/pgadmin-4-container/) as follows to be able to connect to my databases hosted on my local machine:

version: '3.8'

services:
  pgadmin4:
    image: dpage/pgadmin4
    container_name: pgadmin4
    environment:
      - [email protected]
      - PGADMIN_DEFAULT_PASSWORD=password
      - PGADMIN_LISTEN_PORT=5050
    ports:
      - "5050:5050"
    network_mode: host

Simply start it with # docker-compose up -d
And follow logs with # docker-compose logs --tail 10 -f

Browse http://localhost:5050 and login with the credentials defined in the compose environment variables you have chosen.

Don't forget the network_mode: host to be able to connect to your local databases. Also keep in mind that if you plug other services, you may want to keep your network isolation secure, so be absolutely sure what you are doing.

If you ever need to connect to a remote server it is possible; in that case, you will need to open an SSH tunnel prior to setting up your connection in pgAdmin4. I also had to create a PostgreSQL user other than postgres on the remote machine in order to connect using a password (postgres is using peer connection on the remote machine, which I'm sure is working from a remote access).

This solution is likely to evolve over time because it relies on a pre release of pgAdmin 4.29 as stated here:

warning pre release pgAdmin 4.29

https://www.pgadmin.org/docs/pgadmin4/development/container_deployment.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .