-
Setup Go cross-compile using Dave Cheney's instructions & package.
-
Copy the
myapp.conf
file to/etc/init/myapp.conf
. Change the name of the service to whatever you want to call it. -
Change the name parameter in
myapp.conf
to your application's name. -
Change the
script
/end script
block to whatever you need to startup your app.
To start your service:
$ sudo service myapp start
To stop your service:
$ sudo service myapp stop
You can find STDOUT automatically logged to /var/log/upstart/myapp.log
.
When you deploy, you'll need to stop the service, copy over the binary, and then start the service again.
You can use goxc and create a deb file but I think that's overkill since it's a single binary.
I usually create a data directory under /var/lib/myapp
and I store my configuration under /etc/myapp/
.