Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chapsuk/mserv
https://github.com/chapsuk/mserv
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/chapsuk/mserv
- Owner: chapsuk
- License: mit
- Created: 2018-05-03T13:45:57.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-04T11:09:37.000Z (almost 5 years ago)
- Last Synced: 2024-06-20T00:01:03.807Z (7 months ago)
- Language: Go
- Size: 43 KB
- Stars: 0
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mserv
[![Build Status](https://travis-ci.org/chapsuk/mserv.svg?branch=master)](https://travis-ci.org/chapsuk/mserv)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fchapsuk%2Fmserv.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fchapsuk%2Fmserv?ref=badge_shield)Package for grouping many servers (http, grpc, ...) and start|stop by single command.
Aims to simplify startup process and controll group of servers.## Example
*Start 3 http servers: pprof, prometheus, api.*
```go
// set skipErros option for not critical component
srv1 := mserv.NewHTTPServer(&http.Server{Addr: "8080", http.DefaultServeMux}, mserv.HTTPSkipErrors(true))
srv2 := mserv.NewHTTPServer(&http.Server{Addr: "8081", promhttp.Handler()})
// set shutdown timeout
srv3 := mserv.NewHTTPServer(&http.Server{Addr: "8082", api()}, mserv.HTTPShutdownTimeout(5*time.Second))// the servers order is keeped at startup
srvs := mserv.New(srv1, srv2, srv3)
err := srvs.Start()
// ... do work ...
err := srvs.Stop()
```