I
observe that the other public MongoDB cookbooks
I found do not use Upstart (init.d instead) I
presume because they are trying to support non-Upstart
platforms and so choose not to use Upstart on Ubuntu.
I think this is more the case that they're trying to avoid
Upstart for exactly the reasons you're encountering: it is
broken by design. From what I gather a number of common
daemons simply cannot work correctly with Upstart, nginx
seeming to be the prime candidate. You're better off
completely avoiding it and going with a traditional init
script. If you're inclined to, some searches into "trying to
get x running with Upstart" and "upstart cannot restart x"
show a very long tail of things Upstart just cannot support in
its present state.
The single biggest problem with Upstart (IMHO, and note
that biggest means "worst in a set of many") is the
short-sighted decision to only express two values for the
number of forks permitted. What makes this worse is the
thinking behind it, which takes a naive and inexperienced view
that daemons should only need to fork twice and so that's all
we'll support.
Out in the real world and away from trying to optimise the
desktop for quick boot times this simply isn't the case with
nginx, sinatra, as you found MongoDB, and countless other
daemons. You might say that these relatively new pieces of
software are running against the grain of a stone-hewn UNIX
convention. I'd say that it is incredibly short-sighted to not
express the number of forks to expect as an integer to allow
anything to be accommodated if it deviates from the norm, as
presumably the daemon author has good reason for doing so.
I find all of the above very puzzling if you consider the
following pieces from Upstart's initial author:
"The only way I was ever going to get Colin to agree that
writing a new init system was a good idea was by promising to
make it backwards compatible with the old one."
It clearly isn't. Combined with the designer and original
author's failed starting assumptions that daemons need only
ever fork twice, insistence that "[traditional init is the]
least understood and maintained [part of the system]. Nobody
actually uses sysvinit's features" (speak for
yourselves!) and willingness to throw away decades of
accumulated knowledge:
"I
firmly believe that sometimes you've just got to ditch the
past and start over from scratch. (The standard library
inside Upstart is called libnih for a reason :p) To steal a
phrase from a favourite author of mine, I am to backwards
compatibility what King Herod was to the Bethlehem Playgroup
Association."
I'm surprised such a system made it into a distribution,
into a server-orientated distribution, and into Fedora.
Reinventing things that you don't understand has to be the
worst part of the modern UNIX ecosystem.