tylerauerbeck / pgping

Ping a PostgreSQL database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ping a PostgreSQL database

build

  • linux binary
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./pgping ./main.go
  • build by platform
go build -o ./pgping ./main.go

pgping usage

Usage of ./pgping:
  -pgDs string
    	postgres datasource (default "postgres://postgres:0000@postgres:5432/meepshop?sslmode=disable")

use pgping at docker-compose.yml

postgres:
  image: postgres:9.6
  ports:
    - "5432:5432"
app:
  image: cwza/app:latest
  links:
    - postgres
  command: > 
    sh -c "
      if [ ! -f ./pgping ]; then wget –q -nv -O pgping https://github.com/cwza/pgping/releases/download/v0.1/pgping; fi
      chmod +x ./pgping
      while ! ./pgping; do
        echo 'Postgres is unavailable.'
        sleep 1
      done
      npm run start"

About

Ping a PostgreSQL database


Languages

Language:Go 85.4%Language:Makefile 14.6%