Self-hosted comments with Nikola

If you've been reading any of the previous tech related posts, you no doubt have noticed by now that I love anything self-hostable. Dropbox, Google Drive, and others are what most people think of for cloud storage, and are good examples of services you can get similar (and often better) functionality by using self-hosted alternatives for. But what about comment systems? If you have messed around with content management systems (CMSs') like Drupal, Wordpress and others, you probably know that they each come with their own home-grown comment systems. Nikola however, doesn't come with one preconfigured right out of the box. While people looking to set up a site quickly might find this a bit annoying. Personally I like the choice - it makes you choose rather than setting up one for you by default and making you change everything out if you really want a different one.

The self-hostable option

While Nikola supports 7 different systems including Disqus, Google plus, and Facebook (which are some of the more popular options I've noticed), among others, my choice was Isso.

Why Isso?

As far as I know, it's the only self-hostable comment system on the list of systems Nikola supports out-of-the-box, though honestly it was the only one I looked into, as it meats my expectations for what I want. Might there be a better self-hostable nikola-integrated comment system out there? Sure. But (for the moment), I'm just content to stick with this.

What it does

It's just your vanilla comment system, consisting of a little section below each post with previous comments and fields for you to add your oh-so-expert thoughts to the discussion, sure to result in the adoration of your fellow fine, upstanding, internet-browsing, troll-hating peers. Or not, whatever the case may be.


The way I set this up is probably a bit unorthodox, but meh... It works.
On the Isso installation page, it lists several ways to install it, among them pip, (which no doubt most faithful pythoneers know about), prebuilt packages for different unix distros, and installing from source. I don't know why I didn't use pip... I guess because I wanted an integrated package that came with a service file and set up a gunicorn / uwsgi stack... You can use pip if you want, but you'll need to install one of the previously mentioned WSGI packages to run this. If your not familiar with what those even are or don't care to know (shame, shame on you), just follow along.

The link that the install page points to for the Debian package appears to be... Well... I don't know what that is... It looks like some sort of hosting provider admin login page... Or something... That's not a problem, however - we have a perfectly working Github link for the project.
For some strange reason, the readme isn't on the main page of the project... If you look carefully, you'll find the link in the short description of the repo, or if your lazy, just click that to get there.

First you need to install  dpkg-dev  package. apt-get install python-all debhelper dpkg-dev Then do quickly a build for your own use (produce only unsigned binary package for your arch): $ dpkg-buildpackage -rfakeroot -uc -b You should then have the resulting package in parent directory.

Following along, I got an error that told me fakeroot wasn't installed when I tried to run the dpkg command. This may not happen on your system, (in which case you already have the required fakeroot package), but if it isn't, a simple

    sudo apt-get install -y fakeroot

Should install it. At this point, I tried the commands again and it built, yay! For some reason it outputs the package in your parent directory, so if you can't find it at first, check there. At this point, I tried to install the resulting package with dpkg-i ./packagename, but was told that I had unmet dependencies. Apparently, the 'python-all' package wasn't enough, so I used apt-get to get all the packages listed. The output included like 'python-configparser', (which I'm pretty sure is part of the standard library) and some others. Once they were installed and I ran dpkg -i ./packagename, it worked like a charm.


The package gives you a WSGI stack to run it (gunicorn, I believe), and a default management script. I'm running Ubuntu 14.04, which uses the old SysV init.d system, so my script was at /etc/init.d/isso. I'm not sure if a different script is used for those of you not using SysV, though if not, Systemd can handle the legacy ones.

In any case...

    sudo service isso start

Should take care of starting it up, no matter what your using. The default port this runs at is 8095 - if you want or need to change that, do so in the service file mentioned above.

Configuring Isso

So you got everything installed and the isso service says it's running... Now what? Tweaking, of course! You'll want to have a look at /etc/isso.conf, which is the default configuration file placed by the debian package. Here's where you can set up comment-system specific things, you might want to have a look at the page that details all the server options for different things you can mess with. You'll definitely want to change the 'host' setting to the path of your site - as the file explains, Isso makes sure it can be accessed before starting up, if the default comments database path isn't what where you want it to be saved, change that here as well. You can also change the comment notification backend, enable moderation (you'll need to approve each comment before it's visible), setup email notification / approval (if moderation is enabled) of new comments, change basic spam prevention stuff, and more. As far as I know, you should not define a server section, as Gunicorn is handling that.


When I set this up, there was a slight yet important change I had to make - for some reason, the default database file (at /var/lib/isso/comments.db), isn't owned by the isso user. To fix it, cd to /var/lib/isso (or wherever you moved it to in the config), and sudo chown isso: ./comments.db. Or, if you feel like typing it all out, from anywhere, do: sudo chown isso: /var/lib/isso/comments.db.

Proxying the comment server

Now that you've set up Isso to your liking, you need to make sure your webserver can access it. You could open port 8095 (the default port the debian package uses) or whatever port you changed it to in the service file (you do have a firewall... Don't you?) But personally I like everything to run on one port, which means using your webserver to proxy requests to isso, using a specific path. I'm using nginx, which makes this easy; I'm not sure of the exact procedure for Apache but I know there's a module for it. At any rate, you'll want to add something like this to your main site configuration file (maybe something like /etc/nginx/sites-available/default):

location /isso { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Script-Name /isso; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://localhost:8095; }

You can also find that block of directives in Isso's documentation.

Once you've pasted that into your site file, save and close the editor and restart Nginx. For some reason, the restart took a few seconds on my system... I'm not sure if it was nginx checking that 8095 was active or something different, but things worked afterwards for me, so I didn't worry about it.

Setting it all up with Nikola

Your just about done, you only need to tell Nikola what comment system to use and where it's located. Open up your for the site that needs comments; in the 'COMMENT_SYSTEM' variable, just type "isso". Lastly, in the 'COMMENT_SYSTEM_ID' variable, provide the path to isso. If you set up your webserver to proxy as in the Nginx example above, your location might look something like "".

That's it!

After saving and closing your site's config file, build and deploy your site again. Now, on each blog entry (the individual page, not on the index), you should see a comment form.