1
0
Fork 0
hscloud/go/mirko
q3k 97b5cd7b58 go: re-do the entire thing
This is a mega-change, but attempting to split this up further is
probably not worth the effort.

Summary:

1. Bump up bazel, rules_go, and others.
2. Switch to new go target naming (bye bye go_default_library)
3. Move go deps to go.mod/go.sum, use make gazelle generate from that
4. Bump up Python deps a bit

And also whatever was required to actually get things to work - loads of
small useless changes.

Tested to work on NixOS and Ubuntu 20.04:

   $ bazel build //...
   $ bazel test //...

Change-Id: I8364bdaa1406b9ae4d0385a6b607f3e7989f98a9
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1583
Reviewed-by: q3k <q3k@hackerspace.pl>
2023-09-22 21:50:19 +00:00
..
tests/sql go: re-do the entire thing 2023-09-22 21:50:19 +00:00
BUILD.bazel go: re-do the entire thing 2023-09-22 21:50:19 +00:00
README statusz: fix executable sha256 2018-10-25 23:37:37 +02:00
kubernetes.go go/mirko: move kubernetes clientset state to singleton 2021-05-22 19:16:39 +00:00
mirko.go go/mirko: move kubernetes clientset state to singleton 2021-05-22 19:16:39 +00:00
revproxy.go go/mirko: add GetRemoteHTTPClient 2021-05-23 13:03:19 +02:00
revproxy_test.go go/mirko: add GetRemoteHTTPClient 2021-05-23 13:03:19 +02:00
sql.go bgpwtf/cccampix: draw the rest of the fucking owl 2019-08-11 23:43:25 +02:00
sql_migrations.go go/mirko: add SQL migrations machinery 2019-08-03 23:49:43 +02:00
trace.go go/mirko: fix trace logging 2020-08-16 13:25:40 +00:00

README

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/hscloud/go/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...
        // (you can use m.Context() to get a context that will get
        // canceled when the service is about to shut down)

        <-m.Done()
    }

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

The following flags are automatically registered:

 - `-listen_address` (default: `127.0.0.1:4200`): where to listen for gRPC requests
 - `-debug_address` (default: `127.0.0.1:4201`): where to listen for debug HTTP requests
 - `-debug_allow_all` (default: false): whether to allow all IP address (vs. localhost) to connect to debug endpoint

The following debug HTTP handlers are installed:

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