Created
April 4, 2025 18:41
-
-
Save broestls/abcec30ac059199c83a7fe43c821e994 to your computer and use it in GitHub Desktop.
GCP Cloud SQL Proxy systemd config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Place this file in /etc/systemd/system | |
# Also, place a credential file in a safe place that has been granted | |
# the appropriate permissions in GCP for connection (granting Cloud SQL | |
# Client should be sufficient). | |
[Install] | |
WantedBy=multi-user.target | |
[Unit] | |
Description=Google Cloud Compute Engine SQL Proxy | |
Requires=network.target | |
After=network.target | |
[Service] | |
Type=simple | |
# This directory will get created to hold runtime data for the service | |
RuntimeDirectory=cloud_sql_proxy | |
# WorkingDirectory should be the folder that contains the cloud_sql_proxy executable | |
WorkingDirectory=/usr/local/bin | |
# ExecStart needs to have a couple things - path to the executable, a directory to hold the run files, | |
# a comma-separated list of instances to connect to, and a credential file that only needs the Cloud SQL Client permissions | |
ExecStart=/usr/local/bin/cloud_sql_proxy -dir=/var/run/cloud-sql-proxy -instances=bru-trm-1764-prod:us-east4:bru-trm-1764-sql-master=tcp:5432 -credential_file=/var/local/cloud-sql-proxy/cloudsql-management-35cc-71105adea7d8.json | |
Restart=always | |
RestartSec=1 | |
StartLimitBurst=5 | |
StartLimitIntervalSec=10 | |
StandardOutput=journal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment