I recently upgraded my version of Ubuntu to 15.04. In the process, I found out that my init system had changed from Upstart to systemd. While having something as fundamental as the init system management was a bit annoying, it isn’t as bad as some folks are making it out on the Web. Here are some of the things I learned as worked with systemd in fixing my CouchDB server. Part of this is based on this excellent guide on using systemd for Upstart users. The other part is just experimentation on my part.
Checking the Status of All Services
sudo systemctl status
Hint: feel to grep through the output to find anything
Sidenote
At first I could not find the CouchDB service. I had to uninstall the package and purge the packages and then reinstall it:
sudo aptitude purge couchdb
sudo aptitude install couchdb
After that the service showed up in the systemd services, rather than just having an Upstart service.
Checking the Status of a Service
sudo systemctl status $MY_SERVICE
Starting and Stopping a Service
sudo systemctl [start|stop|restart] $MY_SERVICE
Logging Service Activity
This was an interesting thing in systemd. Normally one has to look at the Upstart log at /var/log/upstart/$JOB.log
. systemd provides its own logging mechanism, so to see the log of a service you have to use the journalctl
utility.
sudo journalctl -u $MY_SERVICE
The output behaves just like one would expect from less.
Overall Impressions
Once I got over my initial head scratching of how to use systemd, it was not bad. Rather it feels different, but not in a bad way honestly. I might look into this more closely and see if I prefer using something like systemd over supervisord for controlling even WSGI apps.
The one disappointing thing that I discovered related to my experiments with systemd, or rather specifically with CouchDB in Ubuntu 15.04. There doesn’t seem to be a way to configure CouchDB to have admin users with passwords for some reason I can’t quite fathom. In the meantime, I guess I’ll have to stick to running CouchDB from a Docker container until I can resolve the issue natively.