Friday, October 26, 2012

nrsc - Take 2

After getting some good comments on nrsc and reading more. I re-wrote the implementation to append a zip file to the executable and serve resources from there (idea from Carlos Castillo).

The order you do the packing has change, you first "go build" and then run the nrsc script.

Here the nrsc script that packs the zip into the executable. The nrsc API didn't change that much.

Tuesday, October 23, 2012

nrsc - Resource Compiler

IMO one of the nicest things in Go is the "single executable deployment". However this breaks down when you have some templates, css files, ...

For this I created nrsc, it's a resource compiler that will compile your resources to a local nrsc package which you can include in your project. Building your project after running nrsc will embed all the resource in the executable.

To install nrsc just run go get bitbucket.org/tebeka/nrsc

Here's an example on how to use nrsc in your code:

Friday, September 21, 2012

Jenkins/Hudson Integration

The most dominate CI system is Jenkins (was Hudson).

Jenkins has a nice integration with xunit XML output for tests. I wrote a little utility that converts go test -v output to xunit compatible XML called go2xunit. (install with the usual go get bitbucket.org/tebeka/go2xunit).

The view on Jenkins (tests are failing intentionally) is like the below.


When you click on the tests you get



There's a demo directory with an example bash script. The project configuration looks something like the below. Note the "Execute Shell" command and "Publish JUnit tests report" sections.


Happy Testing.

Thursday, September 6, 2012

seamless - now with multiple backends

Updated seamless to support multiple backends (thank you Fabrizio for helping out).

The new API is:
  • /set?backends=host:port,host:port
  • /add?backend=host:port
  • /remove?backend=host:port
  • /get
The front end will round-robin between the backends.

You can install either via go get bitbucket.org/tebeka/seamless or by downloading the binaries.

Friday, August 10, 2012

seamless - always up services in 85 lines of Go

At work we're debating on how to upgrade servers that need to be up all the time. This prompted me to write seamless.

It's a 1 to 1 TCP proxy which lets you switch the backend via an HTTP interface (on a different port than the one being proxied).

Typical workflow will be:
  • Start backend on internal port
  • Start seamless and proxy exposed port to backend
  • When upgrading start new backend on different external port
  • Tell seamless to switch backends
You can install seamless by running:
    go install bitbucket.org/tebeka/seamless

or if you don't have the go runtime, you can download the binaries.
All the code (inspired by Roger Peppe) is just 72 85 lines.

Tuesday, July 3, 2012

timeat

A small command line utility to display the current time at a given location. It's a mash between Google Maps API (JSON) and Geonames (XML).

Saturday, April 28, 2012

Image Repository

Here's a small we app the allows users to upload photos (somewhat like imgur).

Code


Template
/* MIKI: Analytics */