Skip to content

Сompatible with squad health/readiness controller

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

moeryomenko/healing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Healing Go Reference

Healing is package contains a liveness and readiness controllers, compatible with squad package. Also contains postgresql and mysql pools with readiness checker.

Usage

package main

import (
	"context"
	"time"

	"github.com/moeryomenko/healing"
	"github.com/moeryomenko/healing/checkers"
	"github.com/moeryomenko/squad"
)

func main() {
	ctx := context.Background()

	// create health/readiness controller.
	h := healing.New(8081 // health controller port.
		healing.WithCheckPeriod(3 * time.Second),
		healing.WithReadinessTimeout(time.Second),
		healing.WithReadyEndpoint("/readz"),
	)

	// add pool readiness controller to readiness group.
	h.AddReadyChecker("pgx", checkers.PgxReadinessProber(pool))

	// create squad group runner.
	s := squad.NewSquad(squad.WithSiganlHandler())

	// run health/readiness controller in squad group.
	s.RunGracefully(h.Heartbeat, h.Stop)

	...

	s.Wait()
}

License

Healing is primarily distributed under the terms of both the MIT license and Apache License (Version 2.0).

See LICENSE-APACHE and/or LICENSE-MIT for details.

About

Сompatible with squad health/readiness controller

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages