Install pgadmin4 on debian with nginx+docker
Based on the instructions at: https://www.pgadmin.org/docs/pgadmin4/latest/container_deployment.html
Configure nginx
location ^~ /pgadmin/ {
include proxy_params;
proxy_set_header X-Script-Name /pgadmin;
proxy_set_header X-Scheme $scheme;
proxy_pass http://localhost:5050;
proxy_redirect off;
}
Create user and paths
adduser --system --home /var/lib/pgadmin --disabled-login --shell /usr/sbin/nologin pgadmin4
Initial setup
As root:
docker run --name "pgadmin4" -e 'PGADMIN_LISTEN_PORT=5050' --net=host \
-v /var/lib/pgadmin:/var/lib/pgadmin --user 117 \
-e "PGADMIN_DEFAULT_EMAIL=user@domain.com" \
-e "PGADMIN_DEFAULT_PASSWORD=SuperSecret" \dpage/pgadmin4
Go to http://localhost:5050 and login with user@domain.com / SuperSecret. Create a user in the web interface with Administrator Role.
Make the docker container auto-start
docker container rm "pgadmin4"
docker run --name "pgadmin4" -e 'PGADMIN_LISTEN_PORT=5050' --net=host -v /var/lib/pgadmin:/var/lib/pgadmin --user 117 --detach dpage/pgadmin4 --restart always