Wait until database connection can be successfully established
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
CSRBot 87df8da555 chore(deps): update module github.com/sijms/go-ora/v2 to v2.5.13 1 day ago
cmd fix: update go sums 4 months ago
pkg/dbwait fix(oracle): select 1 from dual 2 months ago
.dockerignore Initial Commit 1 year ago
.drone.yml fix(drone): remove github push 2 months ago
.editorconfig Initial Commit 1 year ago
.gitattributes Initial Commit 1 year ago
.gitignore Initial Commit 1 year ago
.golangci.yml Initial Commit 1 year ago
.markdownlint.yaml Initial Commit 1 year ago
Dockerfile chore(deps): update dependency docker.io/library/alpine to v3.16 5 months ago
LICENSE Initial Commit 1 year ago
Makefile Initial Commit 1 year ago
README.md Initial Commit 1 year ago
go.mod chore(deps): update module github.com/sijms/go-ora/v2 to v2.5.13 1 day ago
go.sum chore(deps): update module github.com/sijms/go-ora/v2 to v2.5.13 1 day ago
main.go fix: update go sums 4 months ago
manifest.tmpl fix(ci): adapt .drone.yml to latest version 1 year ago
renovate.json fix(renovate): enable automerge for droneci manager 10 months ago

README.md

db-wait

Build Status Docker Pulls

With db-wait is it possible to wait in CI/CD environments until a database connection can be established and SQL queries are possible.

This is very useful for example when a database is started for an integration test and it needs time to start and initialize all schemes before the test connects to it.

Usage

As argument db-wait expects a database URI. This can be different depending on the backend. Currently only oracle and postgres are supported. The supported URI patterns can be found in the respective library or directly in the documentation of the database backend.

For example:

# postgres
db-wait postgres://user:password@localhost:5432/postgres?sslmode=disable

# oracle
db-wait oracle://user:password@localhost:1521/xe

More about URI Pattern is documented here for oracle and postgres.

Installation

There are two ways to install db-wait. Directly via go or via make in combination with git and go. The advantage of the second option is that the binary is installed with all the additional files that the developer specifies.

# go
$ go install git.cryptic.systems/volker.raschek/db-wait

# git, make, go
$ git clone https://git.cryptic.systems/volker.raschek/db-wait.git && \
  cd db-wait && \
  make install PREFIX=/usr

Usage as container image

Alternatively can be db-wait used as container image. A local installation is not necessary.

# postgres
$ docker run --rm --network host docker.io/volkerraschek/db-wait:latest \
    postgres://user:password@localhost:5432/postgres?sslmode=disable

# oracle
$ docker run --rm --network host docker.io/volkerraschek/db-wait:latest \
    oracle://user:password@localhost:1521/xe