Skip to content

Commit 230f66b

Browse files
FIX (deployments): Use binaries instead of symlinks on PostgreSQL download
1 parent 1cd1077 commit 230f66b

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

backend/tools/download_linux.sh

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,29 +59,22 @@ for version in $versions; do
5959
version_dir="$POSTGRES_DIR/postgresql-$version"
6060
mkdir -p "$version_dir/bin"
6161

62-
# Create symlinks to the installed binaries
63-
if [ -f "/usr/bin/pg_dump" ]; then
64-
# If multiple versions, binaries are usually named with version suffix
65-
if [ -f "/usr/bin/pg_dump-$version" ]; then
66-
ln -sf "/usr/bin/pg_dump-$version" "$version_dir/bin/pg_dump"
67-
ln -sf "/usr/bin/pg_dumpall-$version" "$version_dir/bin/pg_dumpall"
68-
ln -sf "/usr/bin/psql-$version" "$version_dir/bin/psql"
69-
ln -sf "/usr/bin/pg_restore-$version" "$version_dir/bin/pg_restore"
70-
ln -sf "/usr/bin/createdb-$version" "$version_dir/bin/createdb"
71-
ln -sf "/usr/bin/dropdb-$version" "$version_dir/bin/dropdb"
72-
else
73-
# Fallback to non-versioned names (latest version)
74-
ln -sf "/usr/bin/pg_dump" "$version_dir/bin/pg_dump"
75-
ln -sf "/usr/bin/pg_dumpall" "$version_dir/bin/pg_dumpall"
76-
ln -sf "/usr/bin/psql" "$version_dir/bin/psql"
77-
ln -sf "/usr/bin/pg_restore" "$version_dir/bin/pg_restore"
78-
ln -sf "/usr/bin/createdb" "$version_dir/bin/createdb"
79-
ln -sf "/usr/bin/dropdb" "$version_dir/bin/dropdb"
80-
fi
62+
# Create symlinks to the version-specific installed binaries
63+
# PostgreSQL packages create versioned binaries like pg_dump-13, pg_dump-14, etc.
64+
if [ -f "/usr/bin/pg_dump-$version" ]; then
65+
ln -sf "/usr/bin/pg_dump-$version" "$version_dir/bin/pg_dump"
66+
ln -sf "/usr/bin/pg_dumpall-$version" "$version_dir/bin/pg_dumpall"
67+
ln -sf "/usr/bin/psql-$version" "$version_dir/bin/psql"
68+
ln -sf "/usr/bin/pg_restore-$version" "$version_dir/bin/pg_restore"
69+
ln -sf "/usr/bin/createdb-$version" "$version_dir/bin/createdb"
70+
ln -sf "/usr/bin/dropdb-$version" "$version_dir/bin/dropdb"
8171

8272
echo "PostgreSQL $version client tools installed successfully"
8373
else
84-
echo "Warning: PostgreSQL $version client tools may not have installed correctly"
74+
echo "Error: PostgreSQL $version versioned binaries not found. Expected /usr/bin/pg_dump-$version"
75+
echo "Available pg_dump binaries:"
76+
ls -la /usr/bin/pg_dump* 2>/dev/null || echo "No pg_dump binaries found"
77+
exit 1
8578
fi
8679
echo
8780
done
@@ -96,6 +89,9 @@ for version in $versions; do
9689
version_dir="$POSTGRES_DIR/postgresql-$version"
9790
if [ -f "$version_dir/bin/pg_dump" ]; then
9891
echo " postgresql-$version: $version_dir/bin/"
92+
# Verify the correct version
93+
version_output=$("$version_dir/bin/pg_dump" --version 2>/dev/null | grep -o "pg_dump (PostgreSQL) [0-9]\+")
94+
echo " Version check: $version_output"
9995
fi
10096
done
10197

0 commit comments

Comments
 (0)