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

feat: add support for wait command #2041

Merged
merged 3 commits into from
Nov 27, 2023
Merged

feat: add support for wait command #2041

merged 3 commits into from
Nov 27, 2023

Conversation

enocom
Copy link
Member

@enocom enocom commented Nov 21, 2023

To help ensure the Proxy is up and ready, this commit adds a wait command with an optional --max flag to set the maximum time to wait.

By default when invoking this command:

./cloud-sql-proxy wait

The Proxy will wait up to the maximum time for the /startup endpoint to respond. This command requires that the Proxy be started in another process with the HTTP health check enabled. If an alternate health check port or address is used, as in:

./cloud-sql-proxy <INSTANCE_CONNECTION_NAME> \
  --http-address 0.0.0.0 \
  --http-port 9191

Then the wait command must also be told to use the same custom values:

./cloud-sql-proxy wait \
  --http-address 0.0.0.0 \
  --http-port 9191

By default the wait command will wait 30 seconds. To alter this value, use:

./cloud-sql-proxy wait --max 10s

Fixes #1117

To help ensure the Proxy is up and ready, this commit adds a wait
command with an optional `--max` flag to set the maximum time to wait.

By default when invoking this command:

./cloud-sql-proxy wait

The Proxy will wait up to the maximum time for the /startup endpoint to
respond. This command requires that the Proxy be started in another
process with the HTTP health check enabled. If an alternate health
check port or address is used, as in:

./cloud-sql-proxy <INSTANCE_CONNECTION_NAME> --http-address 0.0.0.0 \
  --http-port 9191

Then the wait command must also be told to use the same custom values:

./cloud-sql-proxy wait --http-address 0.0.0.0 \
  --http-port 9191

By default the wait command will wait 30 seconds. To alter this value,
use:

./cloud-sql-proxy wait --max 10s

Fixes #1117
cmd/root.go Outdated

Sometimes it is necessary to wait for the Proxy to start.

To help ensure the Proxy is up and ready, the Proxy includes adds a wait
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To help ensure the Proxy is up and ready, the Proxy includes adds a wait
To help ensure the Proxy is up and ready, the Proxy includes a wait

cmd/root.go Outdated
To help ensure the Proxy is up and ready, the Proxy includes adds a wait
subcommand with an optional --max flag to set the maximum time to wait.

By default when invoking this command:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is slightly confusing ... reads a little funny

Copy link
Collaborator

@jackwotherspoon jackwotherspoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@hessjcg hessjcg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vvxxvvxx
Copy link

Hi @enocom , is this feature also added in cloud-sql-proxy v1?

@jackwotherspoon
Copy link
Collaborator

Hi @enocom , is this feature also added in cloud-sql-proxy v1?

@vvxxvvxx The wait command is not supported in the v1 version of the Cloud SQL Proxy.

We highly recommend upgrading to v2 to take advantage of new features as v1 is mostly in maintenance mode (bug fixes and dep updates only).

You can check out the migration guide for more detailed steps to do so.

If there is anything holding you back from migrating, please let us know 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add command for use in "PostStart" hook that delays until proxy has started
4 participants