By rayoflove on Skatehive
Google Cloud SQL + Heroku + Rails So you have a Google Cloud SQL running postgres and you want to use it on Heroku. No problem. I'll walk you through how to do it with a rails application. 1) Add the Heroku Google Cloud SQL Proxy Buildpack 1) Setup the Heroku env variables for the Google Cloud SQL Proxy 1) Setup Rails Procfile and database.yml Heroku Add the Google Cloud SQL Proxy Buildpack From your terminal using the Heroku CLI `` heroku buildpacks:add --index=1 https://github.com/lukelove/heroku-buildpack-cloud-sql-proxy.git ` Google Cloud SQL Follow the Setup and installation) for this buildpack making sure to add all of the env variables to your project. Rails Procfile Your Procfile should look something like this. ` web: bin/runcloudsqlproxy &>null && bundle exec rails server -p $PORT rake: bin/runcloudsqlproxy &>null && rake rails: bin/runcloudsqlproxy &>null && bundle exec rails ` Make sure that the bin/runcloudsqlproxy is always run before your desired actions. This will enabl