15 comments

[ 4.0 ms ] story [ 28.3 ms ] thread
Can anyone with experience on this share what are their preferred (http) Go deployment option?
So far, copy the binary to the server, add it as a service in upstart, and start the service.

When updating the application, copy the binary to the server and restart the service.

Could you share an example upstart configuration?
See the upstart documentation for examples. There are no special requirements for running a Go program with upstart.
I would recommend Supervisord (http://supervisord.org/).

To update app: Copy new binary, "supervisorctl restart myapp", done.

This will probably result in dropped requests if you aren't using a reverse proxy or load balancer in the middle.

For simple stuff I've been doing `nohub ./go-binary &`
I have a git repository on the server & push to that repository. On the server, I just pull, compile the binary and use upstart (service xyz restart) to restart the binary. Not nice, because I kill all connections. I'll switch to something more elaborate when I'll have more users on the web service.
If you're interested in zero down time for a go service, then check out goagain [1], inspired by Unicorn. It uses simple fd passing to restart itself, passing the listening socket.

[1]: https://github.com/rcrowley/goagain

Thanks for the pointer! I remember seeing this, but I forgot about it. Glad to have it back.