Assumes you have a database and service account with appropriate permissions created.
- Add this buildpack to the build stack.
$ heroku buildpacks:add --index https://github.com/clowder/heroku-buildpack-cloud-sql-proxy.git
- Set an environment variable containing you're service accounts JSON access
key.
heroku config:set GCLOUD_CREDS="$(cat <PATH_TO_KEY_JSON>)"
- Set an environment variable containing the connection name of the instance
you're connecting to.
heroku config:set GCLOUD_SQL_INSTANCE=<INSTANCE_CONNECTION_NAME>
- Update your
Procfile
to launch you're web process via the wrapper script.web: start-cloud-sql-proxy bin/rails server -p ${PORT:-5000} -e $RAILS_ENV