1.9.3 • Published 4 months ago

google-cloud-sql v1.9.3

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
4 months ago

:toc: macro :toc-title: :toclevels: 10

= ⛅ google-cloud-sql

image:https://img.shields.io/github/package-json/v/edosrecki/google-cloud-sql-cli/master?color=blue&label=google-cloud-sql["google-cloud-sql CLI Version"] image:https://img.shields.io/github/actions/workflow/status/edosrecki/google-cloud-sql-cli/continuous-integration.yml["Build Status", link="https://github.com/edosrecki/google-cloud-sql-cli/actions"]

A CLI app which establishes a connection to a private Google Cloud SQL instance and port-forwards it to a local machine.

Connection is established by running a Google Cloud SQL Auth Proxy pod in a Google Kubernetes Engine cluster which runs in the same VPC network as the private Cloud SQL instance. Connection is then port-forwarded to the local machine, where a user can connect to the instance on localhost. Corresponding workload identity has to be configured in the cluster, with service account which has Cloud SQL Client role on the given SQL instance. Configurations in the app can be saved for practical future usage.

The app relies on local gcloud and kubectl commands which have to be configured and authenticated with the proper Google Cloud user and GKE Kubernetes cluster.

image::screenshot.png[]


toc::[]

== Install === Homebrew

source,bash

brew install edosrecki/tools/google-cloud-sql

Update

brew upgrade google-cloud-sql

=== Releases Download a corresponding distribution from https://github.com/edosrecki/google-cloud-sql-cli/releases[Releases] and add the executable to your PATH.

=== Build from source Build the app from source by building and packaging it manually: see Build and Package sections.

== Use === Prerequisites

=== Run

source,bash

Help

google-cloud-sql help

Create (or override existing) configuration

google-cloud-sql configurations create

Run configuration (interactive mode)

google-cloud-sql configurations run

Run configuration (non-interactive mode)

google-cloud-sql configurations run $NAME

HINT: Add alias

alias myDbProd="google-cloud-sql configurations run $NAME"

Connect to the instance on localhost

psql -h localhost -p $LOCAL_PORT -U $USER

Export configurations (and share :-])

cat $(google-cloud-sql configurations path)

== Build

source,bash

npm run clean

npm run build

== Package === Pre-configured Package the app for Node.JS 16 on MacOS, Linux, and Windows.

source,bash

npm run bundle

=== Manual See https://www.npmjs.com/package/pkg#targets[pkg] for details.

source,bash

npx pkg <NODE_RANGE>--

== Deploy To deploy a new version of google-cloud-sql app, manually run a https://github.com/edosrecki/google-cloud-sql-cli/actions/workflows/continuous-deployment.yml["Continuous Deployment"] worklow in GitHub Actions.

== Todo

  • Add snap for Linux
  • Add completions
  • Cache user's running pods, and alert user on next startup if they were not cleaned up on previous app exit.
1.9.3

4 months ago

1.9.2

6 months ago

1.9.1

7 months ago

1.9.0

9 months ago

1.8.2

10 months ago

1.8.1

1 year ago

1.7.3

2 years ago

1.7.2

2 years ago

1.8.0

1 year ago

1.7.5

2 years ago

1.7.4

2 years ago

1.7.1

2 years ago

1.7.0

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.5.4

2 years ago

1.5.2

2 years ago