[ClusterLabs] Announcing hawk-apiserver, now in ClusterLabs

Kristoffer Grönlund kgronlund at suse.com
Tue Feb 12 14:00:38 EST 2019


Hello everyone,

I just wanted to send out an email about the hawk-apiserver project
which was moved into the ClusterLabs organization on Github today. This
project is used by us at SUSE for Hawk in our latest releases already,
and is also available in openSUSE for use with Hawk. However, I am
hoping that it can prove to be useful more generally, not just for Hawk
but for other projects that may want to integrate with Pacemaker using
the C API, and also to show what is possible when using the API.

To describe the hawk-apiserver briefly, I'll start by describing the use
case it was designed to cover: Previously, we were using lighttpd as the
web server for Hawk (a Ruby on Rails application), but a while ago the
maintainers of lighttpd decided that since Hawk was the only user of
this project in SLE, they would like to remove it from the next
release. This left Apache as the web server available to us, which has
some interesting issues for Hawk: Mainly, we expect people to run apache
as a resource in the cluster which might result in a confusing mix of
processes on the systems.

At the same time, I had started looking at Go and discovered how easy it
was to write a basic proxying web server in Go. So, as an experiment I
decided to see if I could replace the use of lighttpd with a custom web
server written in Go. Turns out the answer was yes! Once we had our own
web server, I discovered new things we could do with it. So here are
some of the other unique features in hawk-apiserver now:

* SSL certificate termination, and automatic detection and redirection
  from HTTP to HTTPS *on the same port*: Hawk runs on port 7630, and if
  someone accesses that port via HTTP, they will get a redirect to the
  same port but on HTTPS. It's magic.

* Persistent connection to Pacemaker via the C API, enabling instant
  change notification to the web frontend. From the point of view of the
  web frontend, this is a long-lived connection which completes when
  something changes in the CIB. On the backend side, it uses goroutines
  to enable thousands of such long-lived connections with minimal
  overhead.

* Optional exposure of the CIB as a REST API. Right now this is somewhat
  primitive, but we are working on making this a more fully featured
  API.

* Configurable static file serving routes (serve images on /img from
  /srv/http/images for example).

* Configurable proxying of subroutes to other web applications.

The URL to the project is https://github.com/ClusterLabs/hawk-apiserver,
I hope you will find it useful. Comments, issues and contributions are
of course more than welcome.

One final note: hawk-apiserver uses a project called go-pacemaker
located at https://github.com/krig/go-pacemaker. I indend to transfer
this to ClusterLabs as well. go-pacemaker is still somewhat rough around
the edges, and our plan is to work on the C API of pacemaker to make
using and exposing it via Go easier, as well as moving functionality
from crm_mon into the C API so that status information can be made
available in a more convenient format via the API as well.

-- 
// Kristoffer Grönlund
// kgronlund at suse.com


More information about the Users mailing list