Skip to content

Latest commit

 

History

History
69 lines (52 loc) · 2.1 KB

README.md

File metadata and controls

69 lines (52 loc) · 2.1 KB

Backend initialisation

GitHub go.mod Go version Go Report Card Coverage Status Release

This is intended to be run as an init container. It will make HTTP requests to a configured URL to determine if the service is functional.

Installation

As this is intended to be a docker entrypoint the preferred way to install is using with a dockerfile.

COPY --from=ghcr.io/quantcdn/backend-init:latest /usr/local/bin/backend-init /usr/local/bin/backend-init

This can be run directly from the docker image:

docker run --rm ghcr.io/quantcdn/backend-init:latest --help

Usage

$ backend-init --help                                                                                                                             
usage: backend-init [<flags>]

Flags:
  --help      Show context-sensitive help (also try --help-long and --help-man).
  --url=URL   The backend url.
  --retry=10  Times to retry the backend connection.
  --delay=5   Delay between backend requests.
  --version   Show application version.

For example to execute build and start after a backend connection has been established.

backend-init --url http://localhost build start

Local development

Build

git clone [email protected]:quantcdn/backend-init.git && cd backend-init
go generate ./...
go build -ldflags="-s -w" -o build/backend-init .
go run . -h

Run tests

go test -v ./... -coverprofile=build/coverage.out

View coverage results:

go tool cover -html=build/coverage.out

Documentation

cd docs
npm install
npm run dev