{"id":18663085,"url":"https://github.com/asapdotid/dcc-cloud-sql-proxy","last_synced_at":"2026-02-17T22:01:43.790Z","repository":{"id":209461178,"uuid":"724113518","full_name":"asapdotid/dcc-cloud-sql-proxy","owner":"asapdotid","description":"Docker Compose Google Cloud SQL Proxy","archived":false,"fork":false,"pushed_at":"2025-08-22T10:07:36.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-22T12:29:24.712Z","etag":null,"topics":["cloud-sql","cloud-sql-database","cloud-sql-proxy","connection-pool","database","docker","docker-compose","gcp","google-cloud","mysql","postgresql","sql-proxy"],"latest_commit_sha":null,"homepage":"","language":"Makefile","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/asapdotid.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,"zenodo":null}},"created_at":"2023-11-27T12:29:04.000Z","updated_at":"2025-08-22T10:07:40.000Z","dependencies_parsed_at":"2024-01-12T17:30:56.391Z","dependency_job_id":"74a073e4-b8e6-4fd6-8108-b4e3fa1fa744","html_url":"https://github.com/asapdotid/dcc-cloud-sql-proxy","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"a78089a005d702ec379f49d2b940b87cb62a8c2b"},"previous_names":["asapdotid/dcc-cloud-sql-proxy"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/asapdotid/dcc-cloud-sql-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asapdotid%2Fdcc-cloud-sql-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asapdotid%2Fdcc-cloud-sql-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asapdotid%2Fdcc-cloud-sql-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asapdotid%2Fdcc-cloud-sql-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asapdotid","download_url":"https://codeload.github.com/asapdotid/dcc-cloud-sql-proxy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asapdotid%2Fdcc-cloud-sql-proxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29559961,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T21:50:49.831Z","status":"ssl_error","status_checked_at":"2026-02-17T21:46:15.313Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cloud-sql","cloud-sql-database","cloud-sql-proxy","connection-pool","database","docker","docker-compose","gcp","google-cloud","mysql","postgresql","sql-proxy"],"created_at":"2024-11-07T08:14:59.139Z","updated_at":"2026-02-17T22:01:43.775Z","avatar_url":"https://github.com/asapdotid.png","language":"Makefile","readme":"# Docker Compose Google Cloud SQL Proxy\n\nThe Cloud SQL Auth Proxy is a utility for ensuring secure connections to your Cloud SQL instances. It provides IAM authorization, allowing you to control who can connect to your instance through IAM permissions, and TLS 1.3 encryption, using docker compose.\n\n| Database   | Status | Tested |\n| :--------- | :----: | :----: |\n| MySQL      |  DONE  |   ✅   |\n| PostgreSQL |  DONE  |   ✅   |\n| SQL Server |  TODO  |   -    |\n\n## To Do\n\n-   [x] Connection to database from code [doc](https://github.com/asapdotid/dcc-cloud-sql-proxy?tab=readme-ov-file#connection-using-tcp)\n-   [ ] Add connection using SSL CLient Certificate\n\n## Enable APIs and Services\n\nSQL Proxy connection need `Cloud SQL Admin API` so first of all enable the API [document](https://cloud.google.com/sql/docs/introduction)\n\nPlease go to Google CLoude console, ex: `https://console.cloud.google.com/apis/dashboard?project=your_project` and change `your_project`\n\n## Credentials\n\nThe Cloud SQL Proxy uses a Cloud IAM principal to authorize connections against a Cloud SQL instance. The Proxy sources the credentials using [Application Default Credentials](https://cloud.google.com/docs/authentication/production).\n\nNote: Any IAM principal connecting to a Cloud SQL database will need one of the following IAM roles:\n\n-   Cloud SQL Client (preferred)\n-   Cloud SQL Editor\n-   Cloud SQL Admin\n\nOr one may manually assign the following IAM permissions:\n\n-   cloudsql.instances.connect\n-   cloudsql.instances.get\n\n\u003e Download credentials json (ex: project-file-4234234.json) file and place on `./src/config` don't forget rename file to `credentials.json`\n\n## Additional custom environment\n\nCheck `/src/.env`\n\n| Environment variable    | Description                                                                                    | Default |\n| :---------------------- | :--------------------------------------------------------------------------------------------- | :-----: |\n| `SQL_PROXY_INSTANCE_ID` | Visit the detail page of your Cloud SQL instance in the console (`project:region:instance_db`) |  `\"\"`   |\n| `SQL_PROXY_PORT`        | Port connection to SQL database (default port) ex: `mysql 3306`, `postgres 5432`               |  `\"\"`   |\n| `SQL_HOST_PORT`         | Host connection using `localhost` and port (can change) ex: `mysql 3306`, `postgres 5432`      |  `\"\"`   |\n\n## Run Docker Compose\n\nRunning docker compose using Makefile:\n\n### Initial Docker Network\n\nCreate docker network `secure`\n\n```bash\ndocker network create secure\n```\n\n### Initial Make\n\n```bash\nmake init\n```\n\n### Set Docker Compose Environment variables\n\n```bash\nmake set-env\n```\n\nOpen file on `./src/.env` and edit value of variables.\n\n### Docker Compose Up\n\n```bash\nmake up\n```\n\n### Docker Compose Down\n\n```bash\nmake down\n```\n\n### Make Help\n\n```bash\nmake help\n```\n\n## Connection using TCP\n\nConnection from code to `DATABASE` base of environment variable `SQL_HOST_PORT`:\n\n| Connection | Host                       |      Port       |\n| :--------- | :------------------------- | :-------------: |\n| Code       | `localhost` or `127.0.0.1` | `SQL_HOST_PORT` |\n| Container  | `cloudsql-proxy`           | `SQL_HOST_PORT` |\n\nSample using `nodejs` [read document](https://cloud.google.com/sql/docs/postgres/connect-auth-proxy#expandable-1)\n\n```javascript\nconst Knex = require(\"knex\");\nconst fs = require(\"fs\");\n\n// createTcpPool initializes a TCP connection pool for a Cloud SQL\n// instance of Postgres.\nconst createTcpPool = async (config) =\u003e {\n    // Note: Saving credentials in environment variables is convenient, but not\n    // secure - consider a more secure solution such as\n    // Cloud Secret Manager (https://cloud.google.com/secret-manager) to help\n    // keep secrets safe.\n    const dbConfig = {\n        client: \"pg\",\n        connection: {\n            host: process.env.INSTANCE_HOST, // e.g. '127.0.0.1'\n            port: process.env.DB_PORT, // e.g. '5432'\n            user: process.env.DB_USER, // e.g. 'my-user'\n            password: process.env.DB_PASS, // e.g. 'my-user-password'\n            database: process.env.DB_NAME, // e.g. 'my-database'\n        },\n        // ... Specify additional properties here.\n        ...config,\n    };\n    // Establish a connection to the database.\n    return Knex(dbConfig);\n};\n```\n\n## License\n\nMIT / BSD\n\n## Author Information\n\nThis Code was created at 2023 by [Asapdotid](https://github.com/asapdotid). 🚀\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasapdotid%2Fdcc-cloud-sql-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasapdotid%2Fdcc-cloud-sql-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasapdotid%2Fdcc-cloud-sql-proxy/lists"}