From c67bfa356de14115ef1641083d8e2257be80e435 Mon Sep 17 00:00:00 2001 From: Justin Taras Date: Tue, 24 Sep 2024 13:22:00 -0400 Subject: [PATCH 1/2] Update cloud-sql-proxy.sh add postgres JDBC driver; Posgres was removed from newer images when Druid support was dropped. --- cloud-sql-proxy/cloud-sql-proxy.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cloud-sql-proxy/cloud-sql-proxy.sh b/cloud-sql-proxy/cloud-sql-proxy.sh index cd7961df2..ecd2a5874 100755 --- a/cloud-sql-proxy/cloud-sql-proxy.sh +++ b/cloud-sql-proxy/cloud-sql-proxy.sh @@ -138,6 +138,15 @@ else fi readonly METASTORE_PROXY_PORT +# get postgres driver +if [[ "${CLOUDSQL_INSTANCE_TYPE}" == "POSTGRES" ]]; then + log 'Downloading JDBC driver for Postgres...' + wget -P /usr/share/java https://jdbc.postgresql.org/download/postgresql-"${POSTGRES_JDBC_VERSION}".jar + ln -s /usr/share/java/postgresql-"${POSTGRES_JDBC_VERSION}".jar /usr/share/java/postgresql-jdbc.jar + ln -s /usr/share/java/postgresql-jdbc.jar /usr/lib/hive/lib/postgresql-jdbc.jar + #wget https://jdbc.postgresql.org/download/postgresql-42.7.4.jar +fi + # Database user to use to access metastore. DB_HIVE_USER="$(/usr/share/google/get_metadata_value attributes/db-hive-user || echo 'hive')" readonly DB_HIVE_USER From 90a8e702849656e811acab5dec904068004ac210 Mon Sep 17 00:00:00 2001 From: Justin Taras Date: Tue, 24 Sep 2024 13:25:59 -0400 Subject: [PATCH 2/2] Update cloud-sql-proxy.sh --- cloud-sql-proxy/cloud-sql-proxy.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cloud-sql-proxy/cloud-sql-proxy.sh b/cloud-sql-proxy/cloud-sql-proxy.sh index ecd2a5874..62669451c 100755 --- a/cloud-sql-proxy/cloud-sql-proxy.sh +++ b/cloud-sql-proxy/cloud-sql-proxy.sh @@ -69,6 +69,9 @@ readonly METASTORE_INSTANCE ADDITIONAL_INSTANCES="$(/usr/share/google/get_metadata_value ${ADDITIONAL_INSTANCES_KEY} || echo '')" readonly ADDITIONAL_INSTANCES +POSTGRES_JDBC_VERSION="$(/usr/share/google/get_metadata_value attributes/postgres-jdbc-version || echo '42.7.4')" +readonly POSTGRES_JDBC_VERSION + function remove_old_backports { # This script uses 'apt-get update' and is therefore potentially dependent on # backports repositories which have been archived. In order to mitigate this