GithubHelp home page GithubHelp logo

Comments (7)

mm-wang avatar mm-wang commented on July 21, 2024 6

It was a bit convoluted, but I did get it to work using a specific instantiation of the Procfile using a bash script to download and start the instance.

For others' reference, I used a file called proxy.sh that looks like below:

#!/bin/bash
wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.386
mv cloud_sql_proxy.linux.386 cloud_sql_proxy
chmod +x cloud_sql_proxy
./cloud_sql_proxy -instances=[instance-name]=tcp:3306 -credential_file=[path-to-file]

and a Procfile that looks like this:

web: (bash ./proxy.sh &) & node start.js

from cloud-sql-proxy.

hfwang avatar hfwang commented on July 21, 2024

You will need to do this work yourself, but you can download the proxy and add it to your slug using a custom buildpack. You would then also need to write a script (and use that in your Procfile) that starts both the proxy and the express server together.

A coworker pointed me to heroku's pg-bouncer that uses a very similar strategy, which you can look at: https://github.com/heroku/heroku-buildpack-pgbouncer

Sorry that this is pretty convoluted.

from cloud-sql-proxy.

valentinoli avatar valentinoli commented on July 21, 2024

This was very helpful. Thank you!

from cloud-sql-proxy.

hfwang avatar hfwang commented on July 21, 2024

Thanks for figuring this out!

from cloud-sql-proxy.

PandhuWibowo avatar PandhuWibowo commented on July 21, 2024

@mm-wang does it work? Where is getting the credential file?

from cloud-sql-proxy.

enocom avatar enocom commented on July 21, 2024

I would assume the credential file lives next to the app code, but isn't checked in. But I haven't tried this myself.

from cloud-sql-proxy.

mm-wang avatar mm-wang commented on July 21, 2024

I haven't looked at this anytime recently, but I think I had a file that listed the credentials that was not checked in, as was suggested. It seems as if this is still a possibility:

https://github.com/GoogleCloudPlatform/cloudsql-proxy/blob/main/cmd/cloud_sql_proxy/cloud_sql_proxy.go#L104-L108

from cloud-sql-proxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.