Isso - Self hosted Disqus

25 Jan 19

Self-hosting is !!fun!!, everyone should do it when possible. I wanted comments on this blog but don’t like disqus, so after a succint search i picked isso as a self hostable alternative. Isso is a python server and provides scripts to integrate into your web pages. The setup instructions on the project’s site are clear enough, I’ll share my notes in this post.

Isso is atually a german pokemon/
Isso is atually a german pokemon

So we’re installing a python server and plan to have it run on the same host as the site it will provide comments to. The project uses SQLite and comes with a few features you can configure such as email notifications, comment RSS feeds, a barebone moderation ui and Gavatar profile pics. It also looks like you can import comment data from other platforms. I will skip all of this and just focus on getting the server to run.

Let’s start with the server setup. I don’t use python that often and have a habbit of breaking my installation for no apparent reason, so let’s try to stick to the instructions on the project’s page. On Ubuntu, following the recommended virtual environment setup then installing from pypi, here are the main lines to follow for convenience :



    
 # Get dependencies if you don't have them already
 sudo apt-get install python-setuptools python-virtualenv python-dev sqlite3 build-essential

 # Create directory, user etc, i use /opt/isso
 # Do the virtualenv thing. You need to use bash
 virtualenv /opt/isso
 source /opt/isso/bin/activate
 
 # Get the server, add executable to path
 pip install isso
 ln -s /opt/isso/bin/isso /usr/local/bin/isso
 
 # Additional python lib to run the server
 pip install gevent
 

Next up is actually configuring the server. Options are described here, default config is there.

It is straightforward for the most part especially if you don’t bother with emails. Let’s say isso and the main site example.com are on the same host, you want to have isso run on some port using gevent then proxy it on a subdomain with your http server. The important parts of the comment server config would be these :



    
[general]
# Site to you want to add comments to
host = http://example.com/
[server]
# Isso runs here
listen = http://localhost:8132/
# And is proxied there
public-endpoint = http://comments.example.com/


Examples in the documentation use nginx so here is my apache host file for convenience.



    
<VirtualHost *:80>
  ServerName comments.example.com
  ProxyPass / http://localhost:8132/
  ProxyPassReverse / http://localhost:8132/
</VirtualHost>


Now before we actually run isso there’s a caveat, as of jan 2019 this github issue still stands and you might get python stacktraces along with error messages like so UnicodeError: The status string must be a native string. Follow the instrutions in the github link, edit this file lib/python2.7/site-packages/isso/wsgi.py at L147 and replace “200 Ok” with b”200 Ok” to fix it. Not sure why this still happens as the issue is from 2017 but whatever, maybe I’m an edge case somehow. Now Isso can be ran isso -c path/to/isso.conf run, maybe setup a quick unit file then all that’s left is to integrate the comments into the site.

The client script is served from the comment server and works from the get go, just import it on your pages like so.



    
  <script data-isso="//comments.example.com/"src="//comments.example.com/js/embed.min.js"></script>


You can configure it by adding data attributes as documented here, i disabled the default css as it displayed white on white on my pages. The last thing is to then append this where you want your comments, and bam you’re set.



    
<div id="comments-box"><section id="isso-thread"></section></div>


It looks like it’s working now, i hope this made for a comfy first post. Please stop feeding comment data into advertisement driven companies :(