configure pgAdmin4 in server mode

background

pgSQL is common used to store hd map in ADS stack, and the client is usually pgAdmin4. in big tech companies, e.g. Tencent, Alibaba, Uber e.t.c, their data infrastructure for ADS stack development is usually based on pgSQL. for our team work, we also store most map info in pgSQL, and for better development toolchain, there is a need to configure the client pgAdmin4 as a web server, rather than request every developer to install a copy of pgAdmin4 at their local side.

in LAN web server, apache2 is used to serve a few services, so there is a need to configure multi virutal host in Aapche2, with differnt port and same IP.

pgSQLServer

1
2
3
4
/etc/init.d/postgresql start
sudo su - postgres

pgAdmin4

installed by apt-get install pgadmin4, will put pgAdmin4 under local user or root permission, which will be rejected if accessed by remote clients, whose permission is www-data

so it’s better to install from src and in a different Python virtual env.

there maybe a few errors as following:

*  No package 'libffi' found  

*  error: invalid command 'bdist_wheel' [sol](https://stackoverflow.com/questions/34819221/why-is-python-setup-py-saying-invalid-command-bdist-wheel-on-travis-ci)

* error: command 'x86_64-linux-gnu-gcc' failed with exit status 1, [sol](https://stackoverflow.com/questions/21530577/fatal-error-python-h-no-such-file-or-directory)

configure pgAdmin4

follow this configure pgadmin4 in Server mode

configure Apache2

follow previous blog to set Apache2 for pgadmin4:

<VirtualHost *:8084>
    ServerName 10.20.181.119:8084
    ErrorLog  "/var/www/pgadmin4/logs/error.log"
    WSGIDaemonProcess pgadmin  python-home=/home/david/py_venv/pgenv
    WSGIScriptAlias /pgadmin4 /home/david/py_venv/pgenv/lib/python3.5/site-packages/pgadmin4/pgAdmin4.wsgi

    <Directory "/home/david/py_venv/pgenv/lib/python3.5/site-packages/pgadmin4/">
        WSGIProcessGroup pgadmin
        WSGIApplicationGroup %{GLOBAL}
        Require all granted
    </Directory>
</VirtualHost>

restart Apache2 server will make this works.

refer

why sudo - su

godaddy about sudo - su

configure pgadmin4 in Server mode