I have a web service written in Golang that I need to fire up using Upstart.
I can run the service executable (named word) on port 5555 from within it's directory manually like so:
PORT=5555 ./word
Then curl -i http://127.0.0.1:5555/api/word
returns the correct response (which is some JSON).
Now, I need to run this service via Upstart. I've written this script (called word.conf):
start on runlevel [2345]
stop on runlevel [!2345]
chdir /home/word
setgid word
setuid word
export PORT=5555
exec ./word
I run it via sudo start word
status word
then tells me that the service is running and I see no errors in the Upstart error logs.
When trying to hit the service again via curl -i http://127.0.0.1:5555/api/word
I get a curl: (7) couldn't connect to host
error.
This seems like it has to be some sort of permissions issue, but I can't pinpoint it.
I tried removing the setgid
and setuid
and running with no luck. I do have a user called word
.
I'm on Ubuntu 12.04.3.
Any ideas?