https://github.com/chapsuk/mserv
https://github.com/chapsuk/mserv
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/chapsuk/mserv
- Owner: chapsuk
- License: mit
- Created: 2018-05-03T13:45:57.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-03-04T11:09:37.000Z (over 5 years ago)
- Last Synced: 2025-04-04T00:51:12.657Z (3 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
[](https://travis-ci.org/chapsuk/mserv)
[](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()
```