2.1.10 • Published 5 years ago

@informaticon/devops.sql-script-runner v2.1.10

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

SQL script runner

CLI to automatically run scripts in CI/CD environments and to automatically initialize new databases and users.

Currently only availabe for MySQL databases.

Installation

npm i @informaticon/devops.sql-script-runner
./node_modules/.bin/ssr --version

Usage

CLI

ssr --database test --user test --password test

This will connect to the default mysql port on localhost and run the necessary scripts form ./scripts.

Configuration

OptionCLI switchENV variableDefaults
DB database--databaseSSR_DB_DATABASE
DB user--userSSR_DB_USER
DB password--passwordSSR_DB_PASSWORD''
DB host--hostSSR_DB_HOST'localhost'
DB port--portSSR_DB_PORT3306
DB socket path--socket-pathSSR_DB_SOCKET_PATH
GCS proxy--gcs-proxySSR_GCS_PROXY
GCS standalone proxy--gcs-proxy-standaloneSSR_GCS_PROXY_STANDALONE
GCS proxy timeout--gcs-proxy-timeoutSSR_GCS_PROXY_TIMEOUT300000
Script directory--script-dirSSR_SCRIPT_DIRECTORY'./scripts'

CLI switches will be used priror to ENV variables and paths will be resolved relative to the working directory.

You can use a .env file to configure your environment as well.

Initialization

IMPORTANT Make sure you save the generated password!

To initialize a new database and user use the --init option.

The given user must have the privileges to create databases and users.

Please use this option only locally on your system!

ssr --database test --user root --password "YOUR_ROOT_PW" --init

The following lines should be printed on success

Database test created
User test created
PLEASE SAVE YOUR NEW PASSWORD: YOUR_NEW_PASSWORD

Google Cloud SQL

The script runner has built in support for proxying to a Google Cloud SQL database. To use this functionality use --gcs-proxy

ssr --database test_db --user root --password "YOUR_ROOT_PW" --gcs-proxy informaticon-devops:europe-west1:devops --init

Standalone

The proxy can be used in standalone mode as well to use it with any given sql tool.

ssr --gcs-proxy-standalone informaticon-devops:europe-west1:devops

2.1.10

5 years ago

2.1.8

5 years ago

2.1.7

5 years ago

2.1.6

5 years ago

2.1.5

5 years ago

2.1.4

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.0

5 years ago

2.0.1

5 years ago

1.4.6

5 years ago

1.4.5

5 years ago

1.4.4

5 years ago

1.4.3

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.2.3

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago