chore: Add Postgres bin to PATH (#34265)

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**

<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9541787920>
> Commit: 1012266e0924248b0f13a91bee464303e86b87a6
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9541787920&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`

<!-- end of auto-generated comment: Cypress test results  -->



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Chores**
- Updated Docker configurations to streamline PostgreSQL 13 integration.
- Simplified PostgreSQL commands in scripts by removing explicit
versioning paths.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Shrikant Sharat Kandula 2024-06-17 12:53:34 +05:30 committed by GitHub
parent e97dc64432
commit 929873a2c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

View File

@ -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 \

View File

@ -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

View File

@ -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