Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Ensure PGBIN is set in entrypoint, according to PGVERSION env var (#19032)

Cyril Rohr3c01f354245b
diff --git a/docker/prod/entrypoint-slim.sh b/docker/prod/entrypoint-slim.sh
index 96a4cee7173..4b162d8c08b 100755
--- a/docker/prod/entrypoint-slim.sh
+++ b/docker/prod/entrypoint-slim.sh
@@ -8,4 +8,10 @@ if [ "$USE_JEMALLOC" = "true" ]; then
export LD_PRELOAD=libjemalloc.so.2
fi
+# Ensure PGBIN is set according to PGVERSION env var
+if [ -n "$PGVERSION" ]; then
+ export PGBIN="/usr/lib/postgresql/$PGVERSION/bin"
+ export PATH="$PGBIN:$PATH"
+fi
+
exec "$@"
diff --git a/docker/prod/entrypoint.sh b/docker/prod/entrypoint.sh
index c8c34527dfb..546c102b3dd 100755
--- a/docker/prod/entrypoint.sh
+++ b/docker/prod/entrypoint.sh
@@ -20,6 +20,12 @@ if [ -d "/var/db/openproject" ]; then
exit 2
fi
+# Ensure PGBIN is set according to PGVERSION env var
+if [ -n "$PGVERSION" ]; then
+ export PGBIN="/usr/lib/postgresql/$PGVERSION/bin"
+ export PATH="$PGBIN:$PATH"
+fi
+
if [ "$(id -u)" = '0' ]; then
# reexport PGVERSION and PGBIN env variables according to postgres version of existing cluster (if any)
# this must happen in the entrypoint