Skip to content

quantcdn/backend-init

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 git@github.com: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