A sample Go application, packaged with https://packager.io.
Have a look at the installation instructions on the packages page: https://packager.io/gh/pkgr/example-go-app.
For instance, for Ubuntu 12.04 64bit, you would run:
wget -qO - https://deb.packager.io/key | sudo apt-key add -
echo "deb https://deb.packager.io/gh/pkgr/example-go-app precise master" | sudo tee /etc/apt/sources.list.d/example-go-app.list
sudo apt-get update
sudo apt-get install example-go-app
You can run the app in the foreground:
$ sudo example-go-app run web
2014/09/11 10:29:04 Listening on port 6000...
Or you can generate the upstart or sysvinit scripts so that the app is daemonized and is launched after reboot:
$ sudo example-go-app scale web=1
$ sudo service example-go-app [start/stop/restart/status]
Logs will be available in var/logs/example-go-app
, and you can see them with:
$ sudo example-go-app logs [--tail]
Once the app is running, check it is working by sending an HTTP request:
$ curl http://127.0.0.1:6000/cities.json
"{'cities':'San Francisco, Amsterdam, Berlin, New York'}"
Have a look at the .pkgr.yml
file, add a Procfile
and a .godir
directory, and you should be good to go!