Hi, I'm not sure what's happening but since the latest tag was pushed once I try to download the proxy with this command:
wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy
chmod +x cloud_sql_proxy
On an docker image based from openjdk:8-jre-alpine I'm not able to execute the binary for some reason, and this image was working perfectly fine in the morning but if change it to https://dl.google.com/cloudsql/cloud_sql_proxy.linux.386 then it works fine. This issue is weird because this has been working perfectly fine until a few hours ago so I'm wondering if the latest changes could have caused this problem.
Is it possible that you have released the wrong binaries with wrong architectures? so that amd64 is actually 386 or the other way around? I know it might sound crazy but my issues started to happen around the same time the latest tag was released
Does anyone is able to help with this?
Thanks
What error message are you seeing?
What command are you running?
Ran in to the same issue and it fails silently when following the guide from the quickstart:
Edit: Forgot to mention that this is on alpine:latest
wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy
chmod +x cloud_sql_proxy
And in the shell it looks like this:
/app # wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy
Connecting to dl.google.com (172.217.20.46:443)
cloud_sql_proxy 100% |*********************************************************************| 15.6M 0:00:00 ETA
/app # chmod +x cloud_sql_proxy
/app # ls -l cloud_sql_proxy
-rwxr-xr-x 1 root root 16444117 Sep 9 09:36 cloud_sql_proxy
/app # ./cloud_sql_proxy
/bin/sh: ./cloud_sql_proxy: not found
What error message are you seeing? What command are you running?
/cloud_sql_proxy -instances="$GCLOUD_PROJECT:$CLOUDSQL_ZONE:$CLOUDSQL_INSTANCE"=tcp:3306 -credential_file=creds.json
/cloud_sql_proxy: not found
I'm getting the same thing here on the amd64 binary, here's a Dockerfile which shows the problem (the binary isn't executable):
FROM alpine:3.10.3 as build
RUN cd /usr/local/bin && \
wget https://storage.googleapis.com/cloudsql-proxy/v1.18.0/cloud_sql_proxy.linux.amd64 && \
mv cloud_sql_proxy* cloud_sql_proxy && \
chmod +x cloud_sql_proxy
bash-5.0# cd /usr/local/bin/
bash-5.0# ls -lah
total 16M
drwxr-xr-x 1 root root 4.0K Sep 9 15:54 .
drwxr-xr-x 1 root root 4.0K Oct 21 2019 ..
-rwxr-xr-x 1 root root 15.7M Sep 9 15:54 cloud_sql_proxy
bash-5.0# ./cloud_sql_proxy
bash: ./cloud_sql_proxy: No such file or directory
At least on my machine, the binary is working well for me:
wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy
chmod +x cloud_sql_proxy
Logs:
$ /cloud_sql_proxy -instances=$INSTANCE_CONNECTION_NAME=tcp:3306
2020/09/09 08:55:15 current FDs rlimit set to 32768, wanted limit is 8500. Nothing to do here.
2020/09/09 08:55:16 Listening on 127.0.0.1:3306 for $INSTANCE_CONNECTION_NAME
2020/09/09 08:55:16 Ready for new connections
2020/09/09 08:55:49 New connection for "$INSTANCE_CONNECTION_NAME"
2020/09/09 08:55:50 Client closed local connection on 127.0.0.1:3306
@kurtisvg try specifically with https://storage.googleapis.com/cloudsql-proxy/v1.18.0/cloud_sql_proxy.linux.amd64 ?
@Stono I did try that one before I closed your other issue :) - unfortunately it also works fine for me.
The Dockerfile helps, I will try that now.
As another data point, I can download https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 and https://storage.googleapis.com/cloudsql-proxy/v1.18.0/cloud_sql_proxy.linux.amd64 from both my desktop computer at home and a random virtual machine (running on Google's Compute Engine). All four downloads are the same binary (sha1sum says 396154989ee09383d74a14cb51d7a8334a3daf62).
@Stono what system are you running this on? And what does file cloud_sql_proxy.linux.amd64 say?
For the record, mine says:
$ file cloud_sql_proxy.linux.amd64
cloud_sql_proxy.linux.amd64: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, Go BuildID=sNSuE9RIbzyUXmGP4Lqq/sj43aYTSTLrKLu1iwPJf/IZkWddv9FyfGaVxQJfgk/nIIYvZ0bwGOJPbZ8Qgip, not stripped
In the alpine environment I'm able to successfully reproduce the issue.
I traced this back to the fact that in our new release pipeline, we don't set CGO_ENABLED=0 when building the binaries. My reasoning was that this is automatically configured for cross-build compilations, but in hindsight obviously the linux.amd64 build isn't a cross-build since it's compiled on those machines. 馃う
Recompiling with this flag and copying it into the docker image work as expected.
I'll re-trigger the distribution of these binaries (with the flag properly enabled) momentarily.
Successfully built 67459fb57c77
Successfully tagged eu.gcr.io/at-artefacts/infra-cloudsql-proxy:latest
====================================
====== Test file: common.yaml ======
====================================
=== RUN: Command Test: cloudsql proxy version should work
--- PASS
stdout: Cloud SQL Proxy: 1.18.0
=====================================
============== RESULTS ==============
=====================================
Passes: 1
Failures: 0
Total tests: 1
/lgtm :)
Looks like both GCS and the dl.google.com links are now working 馃憤
Most helpful comment
In the alpine environment I'm able to successfully reproduce the issue.
I traced this back to the fact that in our new release pipeline, we don't set
CGO_ENABLED=0when building the binaries. My reasoning was that this is automatically configured for cross-build compilations, but in hindsight obviously the linux.amd64 build isn't a cross-build since it's compiled on those machines. 馃うRecompiling with this flag and copying it into the docker image work as expected.
I'll re-trigger the distribution of these binaries (with the flag properly enabled) momentarily.