blob: 940db3f8dfae37116a18059858c62ff380704152 [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 Bazanski3fd70d82018-10-14 08:12:46 -070046
47Since this library also includes [hspki](https://code.hackerspace.pl/q3k/hspki), you also get all the typical `-hspki_{...}` flags included.
48
49The following debug HTTP handlers are installed:
50
51 - `/debug/status`: show the [statusz](https://github.com/q3k/statusz) page
52 - `/debug/requests`: show the [net/trace](https://godoc.org/golang.org/x/net/trace) page (including gRPC traces)
53