From 929873a2c62f4501f3c4f57d915e2b5605b30bea Mon Sep 17 00:00:00 2001 From: Shrikant Sharat Kandula Date: Mon, 17 Jun 2024 12:53:34 +0530 Subject: [PATCH] chore: Add Postgres bin to PATH (#34265) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of using absolute paths to Postgres binaries, and in doing so, hard-coding the Postgres version number, we add the bin folder to `PATH` so they're available directly. This also won't need the `current` symlink we created. That symlink is causing problems in some post-installations scripts in `apt`/`dpkg`, since they're expecting a _number_ in that folder, and sees `current`, it's confused and produces this error: ``` dpkg: warning: version 'current' has bad syntax: version number does not start with digit ``` After this is merged, we should be able to get rid of the `current` symlink as well. **/test sanity** > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 1012266e0924248b0f13a91bee464303e86b87a6 > Cypress dashboard. > Tags: `@tag.Sanity` ## Summary by CodeRabbit - **Chores** - Updated Docker configurations to streamline PostgreSQL 13 integration. - Simplified PostgreSQL commands in scripts by removing explicit versioning paths. --- deploy/docker/base.dockerfile | 2 ++ deploy/docker/fs/opt/appsmith/entrypoint.sh | 5 ++++- deploy/docker/fs/opt/appsmith/run-postgres.sh | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/deploy/docker/base.dockerfile b/deploy/docker/base.dockerfile index d6907208ad..6ce8453cc8 100644 --- a/deploy/docker/base.dockerfile +++ b/deploy/docker/base.dockerfile @@ -32,6 +32,8 @@ RUN set -o xtrace \ && ln -s /usr/lib/postgresql/13 /usr/lib/postgresql/current \ && apt-get clean +ENV PATH="/usr/lib/postgresql/13/bin:${PATH}" + # Install Java RUN set -o xtrace \ && mkdir -p /opt/java \ diff --git a/deploy/docker/fs/opt/appsmith/entrypoint.sh b/deploy/docker/fs/opt/appsmith/entrypoint.sh index 5add1b8e28..c35eefe857 100644 --- a/deploy/docker/fs/opt/appsmith/entrypoint.sh +++ b/deploy/docker/fs/opt/appsmith/entrypoint.sh @@ -4,6 +4,9 @@ set -e tlog "Running as: $(id)" +# Temporary, remove after this change goes into `base.dockerfile`. +export PATH="/usr/lib/postgresql/13/bin:${PATH}" + stacks_path=/appsmith-stacks export SUPERVISORD_CONF_TARGET="$TMP/supervisor-conf.d/" # export for use in supervisord.conf @@ -427,7 +430,7 @@ init_postgres() { if [[ ! -e "$POSTGRES_DB_PATH/PG_VERSION" ]]; then tlog "Initializing local Postgres data folder" - su postgres -c "/usr/lib/postgresql/13/bin/initdb -D $POSTGRES_DB_PATH" + su postgres -c "initdb -D $POSTGRES_DB_PATH" fi else runEmbeddedPostgres=0 diff --git a/deploy/docker/fs/opt/appsmith/run-postgres.sh b/deploy/docker/fs/opt/appsmith/run-postgres.sh index 427fa4a677..4f0b72b394 100755 --- a/deploy/docker/fs/opt/appsmith/run-postgres.sh +++ b/deploy/docker/fs/opt/appsmith/run-postgres.sh @@ -1,4 +1,4 @@ #!/bin/bash rm -f /appsmith-stacks/data/postgres/main/core.* -exec /usr/lib/postgresql/13/bin/postgres -D "/appsmith-stacks/data/postgres/main" -c listen_addresses=127.0.0.1 +exec postgres -D "/appsmith-stacks/data/postgres/main" -c listen_addresses=127.0.0.1