On Wednesday April 3, 2019, I finished migrating this site from Wordpress to Hugo. An important part of this project was finding a new system for handling blog post comments.
On my personal blog, I am able to use the free and ad-free tier of Disqus, but because vxlabs.com is strictly-speaking a company site (even although 100% of the posts are non-commercial), that won’t work here.
Furthermore, the $9 / month price tag of the lowest Disqus tier is not really justifiable with the relatively small number of comments being handled.
I had to find an alternative, preferably self-hosted solution.
I ended up selecting Isso, for the following reasons:
- Implemented in Python, which I use daily, so I am easily able to understand and modify source if required.
- Like Wordpress, supports moderated commenting without logging in.
- Large enough community and good support in the Hugo world.
In this post, I document how I installed this on WebFaction, my webhoster. My installation makes use of uwsgi, and mounts isso on a sub-path of the same host as the blog.
Create custom web-app.
In webfaction, I created a custom web-application listening on a dedicated port, only open to localhost.
The general idea is to setup a cron-job which will keep uwsgi (with isso)
running behind that dedicated port. That web-app can then be mounted on a
/isso/ of the server.
Any requests to
vxlabs.com/isso/ will be forwarded to the running uwsgi-isso
Setup Python environment using pipenv.
pipenv is a great tool for managing the Python virtual environment required for isso.
Install pipenv in your Python user packages by invoking the following command:
After pipenv has installed, initialise the Python virtual environment in the webapp’s directory as follows:
This will install isso, uwsgi and all of their dependencies into a newly created virtual environment.
Pretty straight-forward, no?
In the web-app’s directory, create the following
Importantly here, I receive an email to moderate every single comment. Clicking on the link in the email, and then confirming via a browser dialog is all that is required to approve the comment.
Import comments from existing blog.
I migrated all comments from the old wordpress blog following the procedure documented in the isso manual.
This scanned the wordpress blog’s full export XML and proceeded to import about a thousand comments in the blink of an eye.
Altough you can run isso directly during development, that’s not recommended for production.
Because I’ve had great experience with uwsgi in the past for running Django and Flask apps in production, I opted to use uwsgi as the application server also in this case.
Start by creating the following file as
isso_vxlabs_uwsgi.ini in the web-app
On WebFaction, there is no direct access to something like systemd or upstart for starting and keeping our uwsgi running, so I made the following bash script which can be added to the user’s local crontab:
Create this as
maybe_run_isso.sh in the web-app’s directory and remember to
make it executable with
chmod +x maybe_run_isso.sh.
Add it to the local crontab with
crontab -e. See the script comment above
for a suitable crontab entry.
For the initial startup, you can just invoke the maybe script. It will start
up and detach from the terminal. Check
uwsgi.log for any relevant messages.
Show Isso comments on your posts.
To show comments, I added the following bit of code to the relevant Hugo template:
Bonus round: Daily space-efficient backup of your isso comments using hard links.
I made the following script to run a daily backup of the comments database.
It uses rsync’s
--link-dest functionality, meaning it will simply hard link
the database backup if it hasn’t changed. The upshot of this is that this will
only take up space if the database has actually changed.
Features I would like to have.
While I am happy with isso as it stands, there are a few features I would like to have, and might consider contributing in the future:
- Only moderate if new email: Ideally, moderation will only be required for new email addresses, with expiry built in. In other words, if a user has made an approved comment within the past month (expiry configurable), new comments are automatically approved with notification to admin.
- Visual transitions during commenting: When a user comments, scroll to the
position of their new comment, and transition / fade it in, with visual
focus queues on the “in moderation queue” text.
isso is a simple but effective solution for blog comments.
Let me know in the comments below if you have any questions or additions!