Configure Isso to work with multiple sites using Gunicorn and Nginx

Isso is a lightweight commenting server similar to Disqus. It allows anonymous comments, maintains identity and is simple to administrate. It uses JavaScript and cross-origin ressource sharing for easy integration into (static) websites.

It is a web application written in Python. You can install it following this documentation: http://posativ.org/isso/docs/install. In this article, I will show how I configured Gunicorn and Nginx to make Isso work for multiple sites.

  1. First create a isso configuration file for each site in which you want to have the commenting system. Here is an example for site1, located in /etc/isso/site1.conf:
[general]
name = site1
dbpath = /etc/isso/site1.comments
host = http://site1.tld/
notify = smtp
[moderation]
enabled = false
[smtp]
host = 127.0.0.1
port = 25
to = isso@site1.tld
from = isso@site1.tld
[guard]
enabled = true
ratelimit = 1
direct-reply = 3
reply-to-self = false
  1. Make sure that the dedicated user that will run Isso is able to read this configuration file and also able to write a new sqlite file to store the comments.
  2. Install Gunicorn. Example for Debian:
apt-get install gunicorn
  1. Test your configuration manually, using Gunicorn.
export ISSO_SETTINGS='/etc/isso/site1.conf;/etc/isso/site2.conf'
gunicorn isso.dispatch -b localhost:8080

If no error, proceed to next step.

  1. Configure Gunicorn. Here is an example configuration file located in /etc/gunicorn.d/isso.conf:
CONFIG = {
    'environment': {
        'ISSO_SETTINGS': '/etc/isso/site1.conf;/etc/isso/site2.conf',
    },
     'working_dir': '/etc/isso',
     'user': 'isso',
     'group': 'isso',
    'args': (
        '-b localhost:8080',
        'isso.dispatch',
    ),
}

As you can see, we tell Gunicorn we want to run Isso with a dedicated user/group, in a specific working directory. We also initialize an environment variable that set the settings files for 2 Isso sites I configured. Finally, we want Isso to listen on localhost port 8080.

  1. You can now restart Gunicorn.
/etc/init.d/gunicorn restart
[ ok ] Stopping Gunicorn workers: [isso.conf].
[ ok ] Starting Gunicorn workers: [isso.conf].
  1. Test Isso without Nginx in front of it. A curl localhost:8080 should show the sites you configured:
curl localhost:8080
/site1
/site2
  1. Configure Nginx.
server {
        listen 80;
        listen 443 ssl spdy;
        server_name site1.tld;
        root /var/www/site1.tld/;
        index index.html;
        access_log  /var/log/nginx/site1.tld_access.log;
        error_log  /var/log/nginx/site1.tld_error.log;
        location /comments {
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Script-Name /comments;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_pass http://127.0.0.1:8080;
        }
}

Using this configuration, the commenting system can be loaded with site1.tld/comments/site1/js/embed.min.js for site1 where site1 is the name you configured in your Isso config file. Of course, you can do differently and change the Nginx location to / to access you commenting system through site1.tld/site1/js/embed.min.js.

  1. Reload Nginx.
  2. Now enjoy the awesomeness of this open-source commenting server :)