From 914ddd8cc492f6c7bfa7ed15420ad43c6ccd23d2 Mon Sep 17 00:00:00 2001 From: Shrikant Sharat Kandula Date: Mon, 17 Jun 2024 08:49:19 +0530 Subject: [PATCH 1/2] chore: Add Postgres bin to PATH --- deploy/docker/base.dockerfile | 2 ++ deploy/docker/fs/opt/appsmith/entrypoint.sh | 10 +++++----- deploy/docker/fs/opt/appsmith/run-postgres.sh | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/deploy/docker/base.dockerfile b/deploy/docker/base.dockerfile index d6907208ad46..6ce8453cc854 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 e2e5cf83d423..f0eed0d97a40 100644 --- a/deploy/docker/fs/opt/appsmith/entrypoint.sh +++ b/deploy/docker/fs/opt/appsmith/entrypoint.sh @@ -435,16 +435,16 @@ init_postgres() { chown postgres:postgres "$POSTGRES_DB_PATH" # Initialize the postgres db file system - su postgres -c "/usr/lib/postgresql/13/bin/initdb -D $POSTGRES_DB_PATH" + su postgres -c "initdb -D $POSTGRES_DB_PATH" sed -Ei "s,^#(unix_socket_directories =).*,\\1 '$TMP/pg-runtime'," "$POSTGRES_DB_PATH/postgresql.conf" # Start the postgres server in daemon mode - su postgres -c "/usr/lib/postgresql/13/bin/pg_ctl -D $POSTGRES_DB_PATH start" + su postgres -c "pg_ctl -D $POSTGRES_DB_PATH start" # Create mockdb db and user and populate it with the data seed_embedded_postgres # Stop the postgres daemon - su postgres -c "/usr/lib/postgresql/13/bin/pg_ctl stop -D $POSTGRES_DB_PATH" + su postgres -c "pg_ctl stop -D $POSTGRES_DB_PATH" fi else runEmbeddedPostgres=0 @@ -456,14 +456,14 @@ seed_embedded_postgres(){ # Create mockdb database psql -U postgres -c "CREATE DATABASE mockdb;" # Create mockdb superuser - su postgres -c "/usr/lib/postgresql/13/bin/createuser mockdb -s" + su postgres -c "createuser mockdb -s" # Dump the sql file containing mockdb data psql -U postgres -d mockdb --file='/opt/appsmith/templates/mockdb_postgres.sql' # Create users database psql -U postgres -c "CREATE DATABASE users;" # Create users superuser - su postgres -c "/usr/lib/postgresql/13/bin/createuser users -s" + su postgres -c "createuser users -s" # Dump the sql file containing mockdb data psql -U postgres -d users --file='/opt/appsmith/templates/users_postgres.sql' } diff --git a/deploy/docker/fs/opt/appsmith/run-postgres.sh b/deploy/docker/fs/opt/appsmith/run-postgres.sh index 427fa4a677d7..4f0b72b3949a 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 From 1012266e0924248b0f13a91bee464303e86b87a6 Mon Sep 17 00:00:00 2001 From: Shrikant Sharat Kandula Date: Mon, 17 Jun 2024 09:36:50 +0530 Subject: [PATCH 2/2] Update entrypoint.sh --- deploy/docker/fs/opt/appsmith/entrypoint.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deploy/docker/fs/opt/appsmith/entrypoint.sh b/deploy/docker/fs/opt/appsmith/entrypoint.sh index f0eed0d97a40..cb3389237847 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