GithubHelp home page GithubHelp logo

sebastiaanpasterkamp / gobernate Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 150 KB

Gobernate provides an easy HTTP Handler containing all end-points required to run a golang service in Kubernetes.

License: MIT License

Dockerfile 7.94% Go 92.06%
kubernetes prometheus graceful-shutdown golang-package

gobernate's Introduction

Build Status

Package gobernate provides an easy HTTP Handler containing all end-points required to run a golang service in Kubernetes. This code is roughly based on: https://blog.gopheracademy.com/advent-2017/kubernetes-ready-service/

To use the gobernate package to Kubernetes enable your service simply use:

import (
	"fmt"
	"net/http"

	"github.com/SebastiaanPasterkamp/gobernate"
)

func main() {
	g := gobernate.New("8080", "example", "1.0.0", "commit-sha", "build-time")

	shutdown := g.Launch()

	g.Router.HandleFunc("/hello", func(w http.ResponseWriter, _ *http.Request) {
		fmt.Fprint(w, "Hello! Your request was processed.")
	})

	g.Ready()
	<-shutdown
}

The gobernate http service provides:

  • GET /version to return a JSON structure with the service.
  • GET /health to return http.StatusOK to indicate the (web) service is running.
  • GET /readiness to signal when the service is ready. Expects Ready() to be called before signaling http.StatusOK, and will report if the service is already shutting down.
  • GET /metrics to return Prometheus formatted metric data.

To do

  • Option to add a custom readiness callback.
  • Constructor with configuration struct.
  • Built in OpenTelemetry support.

gobernate's People

Contributors

sebastiaanpasterkamp avatar renovate-bot avatar

Watchers

 avatar  avatar Adam Chalkley avatar

gobernate's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
Dockerfile
  • golang 1.18-stretch
droneci
.drone.yml
  • golang 1.18-stretch
  • golang 1.18-stretch
github-actions
.github/workflows/codeql-analysis.yml
  • actions/checkout v3
  • github/codeql-action v2
  • github/codeql-action v2
  • github/codeql-action v2
gomod
go.mod
  • go 1.13
  • github.com/gorilla/mux v1.8.0
  • github.com/prometheus/client_golang v1.12.2
  • github.com/sirupsen/logrus v1.8.1

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.