Find a file
2018-10-14 08:16:33 -07:00
Gopkg.lock godepify 2018-10-14 08:16:33 -07:00
Gopkg.toml godepify 2018-10-14 08:16:33 -07:00
mirko.go initial commit 2018-10-14 08:12:46 -07:00
README initial commit 2018-10-14 08:12:46 -07:00

Mirko, the HSWAW microservice helper library
============================================

Wanna write a Go microservice for HSWAW? Can't be arsed to copy paste code? This is the library for you!

Usage (dev)
-----------

    package main

    import (
        "code.hackerspace.pl/q3k/mirko"
    )

    func main() {
        m := mirko.New()

        // setup/checks before TCP ports are opened...
        // ...

        if err := m.Listen(); err != nil {
            glog.Exitf("Listen(): %v", err)
        }

        // register your gRPC and http handlers...
        // (relfection and basic debug http is automatically registered)
        // pb.RegisterFooServer(m.GRPC(), s)
        // m.HTTPMux().HandleFunc("/debug/foo", fooHandler)

        if err := m.Serve(); err != nil {
            glog.Exitf("Serve(): %v", err)
        }

        // start any other background processing...

        select {}
    }

Usage (running)
---------------

The following flags are automatically registered:

 - `-listen_address` (default: `127.0.0.1:42000`): where to listen for gRPC requests
 - `-debug_address` (default: `127.0.0.1:42001`): where to listen for debug HTTP requests

Since this library also includes [hspki](https://code.hackerspace.pl/q3k/hspki), you also get all the typical `-hspki_{...}` flags included.

The following debug HTTP handlers are installed:

 - `/debug/status`: show the [statusz](https://github.com/q3k/statusz) page
 - `/debug/requests`: show the [net/trace](https://godoc.org/golang.org/x/net/trace) page (including gRPC traces)