Giter Club home page Giter Club logo

cloudsql-proxy-is-up's Introduction

cloudsql-proxy-is-up

Built on top of envoy-preflight.

cloudsql-proxy-is-up is a simple wrapper application which makes it easier to run applications which depend on Cloud SQL Proxy as a sidecar container for Cloud SQL access. It ensures that your application doesn't start until Cloud SQL Proxy is ready, and that Cloud SQL Proxy shuts down when the application exits. It is best used as a prefix to your existing Docker entrypoint. It executes any argument passed to it, doing a simple path lookup:

cloudsql-proxy-is-up echo "hi"
cloudsql-proxy-is-up /bin/ls -a
CMD [ \
  "/cloudsql-proxy-is-up", \
  "/usr/bin/java", \
  "-server", \
  "-Xms256m", \
  "-Xmx256m", \
  "-jar", \
  "/srv/some/artifact/application.jar" \
]

The cloudsql-proxy-is-up wrapper won't do anything unless you provide the CLOUDSQL_PROXY_API environment variable. This makes local development of your app easy.

If you do provide the CLOUDSQL_PROXY_API environment variable, cloudsql-proxy-is-up will poll the proxy indefinitely with backoff, waiting for Cloud SQL Proxy to report itself as live. Only then will it execute the command provided as an argument, so that your app can immediately start accessing the Cloud SQL.

All signals are passed to the underlying application. Be warned that SIGKILL cannot be passed, so this can leave behind a orphaned process.

When the application exits, as long as it does so with exit code 0, cloudsql-proxy-is-up will instruct Cloud SQL Proxy to shut down immediately.

Environment variables

Variable Purpose
CLOUDSQL_PROXY_API This is the path to Cloud SQL Proxy port, in the format 127.0.0.1:3306. If provided, cloudsql-proxy-is-up will poll this port until it opens. If provided and local (127.0.0.1 or localhost), then Cloud SQL Proxy will be instructed to shut down if the application exits cleanly.
START_WITHOUT_CLOUDSQL_PROXY_API If provided and set to true, cloudsql-proxy-is-up will not wait for Cloud SQL Proxy to be LIVE before starting the main application. However, it will still instruct Cloud SQL Proxy to exit.

cloudsql-proxy-is-up's People

Contributors

dmitri-lerko avatar husseinferas avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.