Lastversion is a small serverless project that I built to teach myself a bit of Go and OpenWhisk along the way. It's making use of OpenWhisk built-in Docker support to run the Go application (lastversion.go) in a container, which is forking the provided (statically linked) git
binary to fetch tags from public Git repositories, then selects the last stable version and returns it in json format
$ curl lastversion.info/go
{
"request": "go",
"result": "1.8"
}
$ curl lastversion.info/skynet
{
"err": "project not available",
"request": "skynet"
}
https
transport is supported:
$ curl https://lastversion.info/kubernetes
{
"request": "kubernetes",
"result": "1.5.3"
}
$ curl https://lastversion.info/lastversion
{
"request": "lastversion",
"result": "0.2.0"
}
git://
is the only transport protocol supportedhttp(s)://lastversion.info/docker
, nor is possible to return anything other then Content-Type: application/json
as response, or provide SSL for a custom domain when hosted by Bluemixlastversion.info
/project url scheme support and SSL termination are provided by a self hosted Nginx, making this a non-100% serverless solution (yet)Fetch the development environment installing OpenWhisk development Vagrant box and set up credentials for wsk
tool as suggested
$ ./build.sh create
# ... edit code ...
$ ./build.sh update
$ ./build.sh run <project_name>
or fetch the api URL and use an http client
$ wsk -i api-experimental list /lastversion
$ curl <https url>/?project=<project_name>
$ ./build.sh delete
Compiled from sources (v2.11.1) with those flags: $ make "CFLAGS=${CFLAGS} -static" NO_OPENSSL=1 NO_CURL=1