mattes / gce-cloudsql-proxy-action Goto Github PK
View Code? Open in Web Editor NEWGithub action which will start a Google Cloud SQL Proxy as Docker container.
License: The Unlicense
Github action which will start a Google Cloud SQL Proxy as Docker container.
License: The Unlicense
Add new github action input creds_base64: [bool]
to detect if the provided creds
should be base64 decoded or not.
I just tried connecting to multiple dbs but I am getting an error saying
docker: Error response from daemon: Conflict. The container name "/gce-cloudsql-proxy" is already in use by container "fa8e929a09fe5d01a6b80a73a35898e9a2c7a928447dcce915db3328551fed80". You have to remove (or rename) that container to be able to reuse that name.
Could you let me know how to connect to multiple db's at the same time? Thank you so much for this wonderful project.
This is my action and it doesn't work. Getting:
Run psql "host=127.0.0.1 port=5432 sslmode=disable dbname=testdb user=postgres"
psql: error: connection to server at "127.0.0.1", port 5432 failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
Error: Process completed with exit code 2.
What am I missing?
name: proxy-test
on:
workflow_dispatch:
jobs:
scheduled-job:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "16"
- uses: mattes/gce-cloudsql-proxy-action@v1
with:
creds: ${{ secrets.GCP_CREDENTIALS }}
instance: myproj-1234:europe-west1:instance_name
- name: Install postgresql-client
run: sudo apt-get install -y postgresql-client
- run: psql "host=127.0.0.1 port=5432 sslmode=disable dbname=testdb user=postgres"
Hi-
When I use GCP cloud_sql_proxy, I connect to it like this using SQLalchemy:
CLOUD_SQL_SOCKET_DIR = "/tmp/cloudsql"
CLOUD_SQL_CONNECTION_NAME = some-gcp-project:us-central1:my-db
DB_QUERY = {"unix_socket": "{}/{}".format(CLOUD_SQL_SOCKET_DIR, CLOUD_SQL_CONNECTION_NAME)}
app.config['SQLALCHEMY_DATABASE_URI'] = sqlalchemy.engine.url.URL(
drivername="mysql+pymysql",
username=DB_USER,
password=DB_USER,
database=DB_NAME,
query=DB_QUERY,
)
but this action uses '/tmp' as it's directory
I guess this is more of a Github Action question, but in order to connect using the /tmp directory later in the job, what should CLOUD_SQL_SOCKET_DIR be?
Does the secret variable name have to be GOOGLE_APPLICATION_CREDENTIALS
or can it be different?
When I use a different secret name I get error - invalid json file "/tmp/gce-cloudsql-proxy/key.json": unexpected end of JSON input
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.