{"id":20263651,"url":"https://github.com/springerpe/cf-cloud-sql-proxy-buildpack","last_synced_at":"2025-12-03T10:03:30.526Z","repository":{"id":80987013,"uuid":"314266054","full_name":"SpringerPE/cf-cloud-sql-proxy-buildpack","owner":"SpringerPE","description":"Intermediate Buildpack for running legacy apps with GCP service broker","archived":false,"fork":false,"pushed_at":"2021-04-02T11:53:12.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-14T04:44:40.169Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SpringerPE.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-19T14:04:34.000Z","updated_at":"2023-03-21T23:00:52.000Z","dependencies_parsed_at":"2023-06-04T05:00:18.770Z","dependency_job_id":null,"html_url":"https://github.com/SpringerPE/cf-cloud-sql-proxy-buildpack","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpringerPE%2Fcf-cloud-sql-proxy-buildpack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpringerPE%2Fcf-cloud-sql-proxy-buildpack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpringerPE%2Fcf-cloud-sql-proxy-buildpack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpringerPE%2Fcf-cloud-sql-proxy-buildpack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SpringerPE","download_url":"https://codeload.github.com/SpringerPE/cf-cloud-sql-proxy-buildpack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241731744,"owners_count":20010781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T11:35:50.308Z","updated_at":"2025-12-03T10:03:25.472Z","avatar_url":"https://github.com/SpringerPE.png","language":"Shell","readme":"# cf-cloud-sql-proxy-buildpack\n\nHaving mysql or postgres instances deployed by Google Service Broker, this buildpack allows\nthe app to connect to the DB without TLS certificates. It defines env vars which \ncan be used by the app to connect via the cloud sql proxy.\n\nThe Cloud SQL Proxy provides secure access to your instances without the need\nfor Authorized networks or for configuring SSL. More info: https://cloud.google.com/sql/docs/mysql/sql-proxy\nand https://github.com/GoogleCloudPlatform/cloudsql-proxy\n\nThis buildpack is focused on CloudSQL offered by Google Service Broker.\n\n# TLS with GCP Service Broker and Cloud SQL Proxy\n\nSome applications/framework have issues dealing with TLS certificates or connection strings\nwith embedded certificates, the way to overcome to this situation\nwas using a Cloud SQL Proxy: https://github.com/GoogleCloudPlatform/cloudsql-proxy\n\nWhen the builpack detects a GCP Service broker, it automatically runs the cloud-sql proxy\nand change connection settings to point to localhost. The SQL proxy connects\nto the DB server using the TLS settings and `PrivateData` auth.\n\n## Using it\n\nFirst of all, this buildpack has no requirements at all. The way it works is being an\nintermediate builpack setting up the cloud-sql proxy and redefining the environment\nvariables for the app.\n\nTo use this buildpack, specify the URI of this repository when push to Cloud Foundry\nby adding it to the list of buildpacks of your app, **not being the last one** which\nis the one in charge of run your app.\n\n\n```manifest.yml\n---\napplications:\n- name: grafana\n  memory: 512M\n  instances: 1\n  stack: cflinuxfs3\n  random-route: true\n  buildpacks:\n  - https://github.com/SpringerPE/cf-cloud-sql-proxy-buildpack.git\n  - https://github.com/SpringerPE/cf-grafana-buildpack.git\n  env:\n    ADMIN_USER: admin\n    ADMIN_PASS: admin\n    SECRET_KEY: yUeEBtX7eTmh2ixzz0oHsNyyxYmebSat\n```\n\nand deploy the application again\n\n\n### Configuration and environment variables\n\nIn case you have multiple services bound to the app, you can define a specific\nbinding by defining `DB_BINDING_NAME` env var in the manifest.\n\n\nThe buildpack also redefines `DATABASE_URL` to point to localhost, so the app\ncan use the variable direclty as connection string. The rest of variables are:\n\n```\n# Variables exported, they are automatically filled from the  service broker instances\n# These are their default values.\nDB_TYPE=\"\"\nDB_USER=\"\"\nDB_HOST=\"\"\nDB_PASS=\"\"\nDB_PORT=\"\"\nDB_NAME=\"\"\nDB_CA_CERT=\"\"\nDB_CLIENT_CERT=\"\"\nDB_CLIENT_KEY=\"\"\nDB_CERT_NAME=\"\"\nDB_TLS=\"\"\n```\n\n### Service brokers\n\nAs said, you can use a service broker instance which exposes a SQL connection string\nin `.credentials.uri`, the DB connection string has to be properly formed and only\nusing `mysql` or `postgres`.\n\nIf you do not have a service broker implementation, you can still use it via user provided\nservices:\n\n```\n$ cf create-user-provided-service mysql-db -p '{\"uri\":\"mysql://root:secret@dbserver.example.com:3306/mydatabase\"}'\n# bind a service instance to the application\n$ cf bind-service \u003capp name\u003e \u003cservice name\u003e\n# restart the application so the new service is detected\n$ cf restart\n```\n\n# Development\n\nImplemented using bash scripts to make it easy to understand and change.\n\nhttps://docs.cloudfoundry.org/buildpacks/understand-buildpacks.html\n\nThe builpack uses the `deps` and `cache` folders according the implementation purposes,\nso, the first time the buildpack is used it will download all resources, next times \nit will use the cached resources.\n\n\n# Author\n\n(c) Jose Riguera Lopez  \u003cjose.riguera@springernature.com\u003e\nSpringernature Engineering Enablement\n\nMIT License\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspringerpe%2Fcf-cloud-sql-proxy-buildpack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspringerpe%2Fcf-cloud-sql-proxy-buildpack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspringerpe%2Fcf-cloud-sql-proxy-buildpack/lists"}