Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example script for invoking commands against the Proxy #1056

Open
felixhuttmann opened this issue Dec 18, 2021 · 3 comments
Open

Add example script for invoking commands against the Proxy #1056

felixhuttmann opened this issue Dec 18, 2021 · 3 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@felixhuttmann
Copy link

When trying to run a script or database migration, the user currently has to

  1. start the cloudsql proxy and wait for the port to open or unix domain socket to be created
  2. run the command
  3. stop the cloudsql proxy

The usage would be simplified if the cloudsql proxy offered an exec subcommand that could be used like this:

./cloudsql-proxy exec -- psql --command 'select 1;'

The cloudsql-proxy binary would establish the connection, then run the supplied shell command, and terminate after the termination of the command.

Similar functionality is already offered by the firestore emulator to run automated tests (e.g., firebase emulators:exec "./my-test.sh", see [1]).

Without this, waiting for the cloudsql proxy to become available and killing it reliably afterwards in a typical shell script that runs in a CI/CD pipeline is a significant hassle.

[1] https://firebase.google.com/docs/functions/local-emulator#run_the_emulator_suite

@enocom
Copy link
Member

enocom commented Dec 18, 2021

Thanks for the suggestion. I’ll take a closer look at this in the new year. It seems like a pretty common use case.

@enocom enocom added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Dec 18, 2021
@enocom
Copy link
Member

enocom commented Aug 29, 2022

Thinking some more about this, I totally get the convenience of it. I worry a bit about the security vulnerabilities this might open up. What if this project provided a script that people could use instead?

@enocom enocom added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Aug 31, 2022
@enocom enocom removed their assignment Oct 13, 2022
@enocom enocom changed the title Add exec subcommand Add example script for invoking commands against the Proxy Nov 18, 2022
@JannieT
Copy link

JannieT commented Nov 26, 2022

@enocom would you perhaps have time to look at my CI pipeline while your example is still pending? Hopefully it might help provide a context for a typical use case that contribute to the example script.

@enocom enocom added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. and removed priority: p2 Moderately-important priority. Fix may not be included in next release. labels Mar 17, 2023
@enocom enocom added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Feb 22, 2024
@enocom enocom assigned jackwotherspoon and unassigned enocom May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

5 participants