All Projects → crawshaw → Littleboss

crawshaw / Littleboss

Licence: isc
littleboss: supervisor construction kit

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Littleboss

init
Lightweight BSD-style init tools
Stars: ✭ 25 (-95.99%)
Mutual labels:  supervisor
fastapi douyin
更新 2.0 版本,使用 Python WEB 高性能异步框架 FastAPI 制作的抖音无水印解析下载,采用前后端分离思想!
Stars: ✭ 58 (-90.71%)
Mutual labels:  supervisor
Ergo
a Framework for creating mesh networks using technologies and design patterns of Erlang/OTP in Golang
Stars: ✭ 376 (-39.74%)
Mutual labels:  supervisor
supervisor-rs
Lite Rust version of supervisor, inspired by python version
Stars: ✭ 34 (-94.55%)
Mutual labels:  supervisor
docker-examples
Configuration files for typical service running in Docker.
Stars: ✭ 18 (-97.12%)
Mutual labels:  supervisor
superdiscoverer
A Supervisor backed service discoverer for automatic service-discovery.
Stars: ✭ 15 (-97.6%)
Mutual labels:  supervisor
nyx
Lean linux and OSX process monitoring written in C
Stars: ✭ 24 (-96.15%)
Mutual labels:  supervisor
Roadrunner
🤯 High-performance PHP application server, load-balancer and process manager written in Golang
Stars: ✭ 6,122 (+881.09%)
Mutual labels:  supervisor
aiohttp skeleton
Skeleton for aiohttp site
Stars: ✭ 19 (-96.96%)
Mutual labels:  supervisor
Autoops
linux资产管理,cmdb,django, webssh,运维管理平台,数据库操作平台 本项目已停止开发!因长时间未对代码进行维护,可能会造成项目在不同环境上无法部署、运行BUG等问题,请知晓!项目仅供参考!
Stars: ✭ 340 (-45.51%)
Mutual labels:  supervisor
Tplan
😃 T计划 是一个集成了任务队列、进程管理、爬虫部署、服务可视化监控、数据展示、在线编码、远程部署的通用系统。
Stars: ✭ 59 (-90.54%)
Mutual labels:  supervisor
minisv
Simple supervisor for easy multi-binary service deploy
Stars: ✭ 26 (-95.83%)
Mutual labels:  supervisor
exo
A process manager & log viewer for dev
Stars: ✭ 296 (-52.56%)
Mutual labels:  supervisor
docker-python-gunicorn-nginx
Docker image with Python3, Gunicorn and Nginx managed with Supervisor
Stars: ✭ 42 (-93.27%)
Mutual labels:  supervisor
S6
The s6 supervision suite.
Stars: ✭ 452 (-27.56%)
Mutual labels:  supervisor
docker-symfony
Docker Symfony (PHP-FPM - NGINX - MySQL - MailHog - Redis - RabbitMQ)
Stars: ✭ 32 (-94.87%)
Mutual labels:  supervisor
epazote
🌿 Automated HTTP (microservices) supervisor
Stars: ✭ 34 (-94.55%)
Mutual labels:  supervisor
Gosuv
Deprecated!!! Process managerment writtern by golang, inspired by python-supervisor
Stars: ✭ 618 (-0.96%)
Mutual labels:  supervisor
Cesi
CeSI is a web interface for managing multiple supervisors from the same place.
Stars: ✭ 500 (-19.87%)
Mutual labels:  supervisor
Finit
Fast init for Linux systems. Cookies included
Stars: ✭ 293 (-53.04%)
Mutual labels:  supervisor

littleboss: self-supervising Go binaries

A Go package, littleboss lets you turn your program into a a self-supervising binary. It starts itself as a child process, monitors its life cycle, reloads it if it exits, and can be instructed to replace it with a new binary.

The supervisor can open sockets for you and share them across reloads of your program, ensuring no connections are dropped.

You can install it with:

go get crawshaw.io/littleboss

Make a program use littleboss by modifying the main function:

func main() {
	lb := littleboss.New("service-name")
	lb.Run(func(ctx context.Context) {
		// main goes here, exit when <-ctx.Done()
	})
}

The service name is used to identify which program the supervisor will control.

Usage

By default the supervisor is bypassed and the program executes directly. A flag, -littleboss, is added to the binary. It can be used to start a supervised binary and manage it:

$ mybin &                     # binary runs directly, no child process
$ mybin -littleboss=start &   # supervisor is created
$ mybin2 -littleboss=reload   # child is replaced by new mybin2 process
$ mybin -littleboss=stop      # supervisor and child are shut down

Configuration

Supervisor options are baked into the binary. The littleboss struct type contains fields that can be set before calling the Run method to configure the supervisor. Options include reloading the previous binary if a reload fails, controlling how long an exiting program has to turn down its connections, and specifying exactly what flags control and are passed by littleboss.

An HTTP server example

func main() {
	lb := littleboss.New("myblog")
	flagHTTPS := lb.Listener("https", "tcp", ":443", "address")
	lb.Run(func(ctx context.Context) {
		httpMain(ctx, flagHTTPS.Listener())
	})
}

func httpMain(ctx context.Context, ln net.Listener) {
	srv := &http.Server{
		ReadTimeout:  10 * time.Second,
		WriteTimeout: 10 * time.Second,
		IdleTimeout:  60 * time.Second,
		Handler:      blogHandler,
	}
	go func() {
		if err := srv.ServeTLS(ln, "certfile", "keyfile"); err != nil {
			if err == http.ErrServerClosed {
				return
			}
			log.Fatal(err)
		}
	}()

	<-ctx.Done()
	srv.Shutdown(ctx)
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].