I have installed CouchDB 1.6.1 on a Trusty box via the Apache CouchDB PPA (couchdb/stable
). This all seems to work, except that I cannot start the service using service couchdb start
(similarly for stop). I've got around this by putting the following script in /usr/local/bin
:
#!/bin/bash
export ERL_FLAGS="+A 16"
export ERL_MAX_PORTS=8192
nohup couchdb > /opt/couchdb/log/couch.log 2>&1 &
I have to run this manually (or stop it with kill
). The service
commands say they work, but CouchDB just immediately fails. This is fine, except in the rare event that the machine needs rebooting; it would be nice if CouchDB came up automatically.
On various pages I've found online, there is reference to a bundled init.d
script. In fact, I found a generated init.d
script, which is supposed to be installed along with CouchDB: I tried this, edited appropriately, but the same problem persists.
It seems a lot of the documentation I've found online is very out-of-date (e.g., it references paths that are not valid with the PPA installed version and/or Trusty). What is the current "best way to do this"?
It turns out that the reason starting/stopping CouchDB with Upstart was failing was because the directory it wanted to write to (logs, data, etc.) -- which was different from the installed default -- was not accessible to the
couchdb:couchdb
user. That is, the following fixed the problem:I found this out almost by accident. Obviously as it couldn't write to the logfile it wanted, that was useless. However, the Upstart logs gave a better indication of what had gone wrong!
Anyway, as such, the
init.d
script is an irrelevant red herring. It works as documented, provided it can access everything it needs.