GeezerVison is showing github.com — Expose UNIX socket in entrypoint.sh for Docker implementation · Issue #7221 · pgadmin-org/pgadmin4
Expose UNIX socket in entrypoint.sh for Docker implementation #7221
Description
Describe the solution you'd like
Can you implement in entrypoint.sh to expose UNIX socket for a reverse proxy like Nginx, maybe defined with an environment variable like PGADMIN_SOCK or your liking? It will automatically take presence over listen address and port. In a Docker Compose stack, where most of the communication managed with UNIX sockets between containers, current pgAdmin container not supporting such deployment.
The official server deployment docs giving examples such Gunicorn setup: https://www.pgadmin.org/docs/pgadmin4/latest/server_deployment.html
Activity
LantosIstvan commented on Feb 17, 2024
ContributorAuthor
More actions
I use this possible implementation at the end of my monkey patched entrypoint.sh:
if [ -n "${PGADMIN_SOCK}" ]; then
BIND_ADDRESS="unix:${PGADMIN_SOCK}"
else
if [ -n "${PGADMIN_ENABLE_TLS}" ]; then
BIND_ADDRESS="${PGADMIN_LISTEN_ADDRESS:-[::]}:${PGADMIN_LISTEN_PORT:-443}"
else
BIND_ADDRESS="${PGADMIN_LISTEN_ADDRESS:-[::]}:${PGADMIN_LISTEN_PORT:-80}"
fi
fi
if [ -n "${PGADMIN_ENABLE_TLS}" ]; then
exec /venv/bin/gunicorn --limit-request-line "${GUNICORN_LIMIT_REQUEST_LINE:-8190}" --timeout "${TIMEOUT}" --bind "${BIND_ADDRESS}" -w 1 --threads "${GUNICORN_THREADS:-25}" --access-logfile "${GUNICORN_ACCESS_LOGFILE:--}" --keyfile /certs/server.key --certfile /certs/server.cert -c gunicorn_config.py run_pgadmin:app
else
exec /venv/bin/gunicorn --limit-request-line "${GUNICORN_LIMIT_REQUEST_LINE:-8190}" --timeout "${TIMEOUT}" --bind "${BIND_ADDRESS}" -w 1 --threads "${GUNICORN_THREADS:-25}" --access-logfile "${GUNICORN_ACCESS_LOGFILE:--}" -c gunicorn_config.py run_pgadmin:app
fi
Where PGADMIN_SOCK is /run/pgadmin/pgadmin.sock. I use separate folders for sockets in Docker Compose for convenience with volumes.
Of course, the folder also has to exist with needed rights:
mkdir -p /run/pgadmin
chown pgadmin:root /run/pgadmin
khushboovashi commented on Feb 19, 2024
LantosIstvan commented on Feb 19, 2024
ContributorAuthor
More actions
Metadata
Metadata
Development
No branches or pull requestsIssue actions