blob: 2147adb4b627166b02561fa982caed8f337f9b19 [file] [log] [blame]
Serge Bazanski3fd70d82018-10-14 08:12:46 -07001Mirko, the HSWAW microservice helper library
2============================================
3
4Wanna write a Go microservice for HSWAW? Can't be arsed to copy paste code? This is the library for you!
5
6Usage (dev)
7-----------
8
9 package main
10
11 import (
12 "code.hackerspace.pl/q3k/mirko"
13 )
14
15 func main() {
16 m := mirko.New()
17
18 // setup/checks before TCP ports are opened...
19 // ...
20
21 if err := m.Listen(); err != nil {
22 glog.Exitf("Listen(): %v", err)
23 }
24
25 // register your gRPC and http handlers...
26 // (relfection and basic debug http is automatically registered)
27 // pb.RegisterFooServer(m.GRPC(), s)
28 // m.HTTPMux().HandleFunc("/debug/foo", fooHandler)
29
30 if err := m.Serve(); err != nil {
31 glog.Exitf("Serve(): %v", err)
32 }
33
34 // start any other background processing...
35
36 select {}
37 }
38
39Usage (running)
40---------------
41
42The following flags are automatically registered:
43
Serge Bazanski2a6175c2018-10-14 08:49:28 -070044 - `-listen_address` (default: `127.0.0.1:4200`): where to listen for gRPC requests
45 - `-debug_address` (default: `127.0.0.1:4201`): where to listen for debug HTTP requests
Serge Bazanski446c9e12018-10-14 17:06:09 +010046 - `-debug_allow_all` (default: false): whether to allow all IP address (vs. localhost) to connect to debug endpoint
Serge Bazanski3fd70d82018-10-14 08:12:46 -070047
48Since this library also includes [hspki](https://code.hackerspace.pl/q3k/hspki), you also get all the typical `-hspki_{...}` flags included.
49
50The following debug HTTP handlers are installed:
51
52 - `/debug/status`: show the [statusz](https://github.com/q3k/statusz) page
53 - `/debug/requests`: show the [net/trace](https://godoc.org/golang.org/x/net/trace) page (including gRPC traces)
54