7 ms·
Building our first app in Go
- thibaut_barrere 13y agoCan anyone with experience on this share what are their preferred (http) Go deployment option?
- MindTwister 13y agoSo 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.
- simonw 13y agoCould you share an example upstart configuration?
- realrocker 13y agoSorry for the self-plug: https://coderwall.com/p/iekaog https://coderwall.com/p/iekaog. Too big to post here.
- simonw 13y agoThanks, very handy.
- MindTwister 13y agoSaves me the trouble ^^ I actually think i got the inspiration for mine from that post.
- borton 13y agoSee the upstart documentation for examples. There are no special requirements for running a Go program with upstart.
- andreros 13y agoI would recommend Supervisord (http://supervisord.org/ 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.
- flenter 13y agoAnother Go article currently also on the front page uses heroku as the deployment platform: Build, test and deploy a Go application to Heroku (https://news.ycombinator.com/item?id=6294921 https://news.ycombinator.com/item?id=6294921)
- silasb 13y agoFor simple stuff I've been doing `nohub ./go-binary &`
- VeejayRampay 13y agoSmall typo, I guess it should read nohup.
- pearkes 13y agoIf you're using Puppet and like upstart, check out geetarista's go deployment workflow, simple and straight forward. Locally compile go binary for target platform, upload to S3 (with a makefile + s3cmd), puppet runs, downloads version from s3 with shell script, unpacks, puts in bin, upstart starts and keeps service running. https://github.com/geetarista/go-boilerplate https://github.com/geetarista/go-boilerplate https://github.com/geetarista/puppet-go-boilerplate https://github.com/geetarista/puppet-go-boilerplate
- patrickg 13y agoI 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.
- jessevdk 13y agoIf 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 https://github.com/rcrowley/goagain
- patrickg 13y agoThanks for the pointer! I remember seeing this, but I forgot about it. Glad to have it back.