Build a comment system using Isso

Website May 14, 2017

Isso -- a commenting server similar to Disqus

My environment:

  • Debian 8 x64
  • root

Requirements

  • Python 2.6, 2.7 or 3.3+ (+ devel headers)
  • SQLite 3.3.8 or later
  • a working C compile

Isso supports comment in markdown, and uses SQLite as SQL service, the official said comments is not big data, so they choosed the SQLite. As comments was stored in SQLite, we can not setup Master Slave Replication for multiple sync node.

Dependencies

Isso was written in Python, so we install python dependencies firsty

apt install python-dev build-essential -y
apt install python-pip

And upgrade the pip itself

pip install --upgrade pip

Then install sqlite3

apt install sqlite3

if you prefer a newer version of sqlite, just run (recommended)

apt -t jessie-backports install sqlite3

If you have used Debian for a long time, you'll find that both mysql and mongodb put their db data in /var/lib/{name}

Then we just imitate them, use '/var/lib' for storing db data

adduser isso
mkdir /var/lib/isso
chown isso:isso /var/lib/isso -R

And next we are going to make a .conf file

mkdir /etc/isso.d

Configuration

A example config file looks like this, please find details on Official Website. Later I'll give out my config file.

[general]
dbpath = /var/lib/www.example.com.db
name = example
host = https://www.example.com
max-age = 15m
notify = smtp

[moderation]
enabled = false
purge-after = 30d

[server]
listen = http://localhost:8080
reload = off
profile = off

[smtp]
username =
password =
host = smtp.exmail.qq.com
port = 465
security = starttls / ssl / none
to =
from =
timeout = 10

[guard]
enabled = true
ratelimit = 2
direct-reply = 3
reply-to-self = false
require-author = false
require-email = false

[markup]
options = strikethrough, superscript, autolink
allowed-elements =
allowed-attributes =

[hash]
salt = Eech7co8Ohloopo9Ol6baimi
algorithm = pbkdf2

My config file

[general]
dbpath = /var/lib/isso/www.pupboss.com.db
name = homepage
host = https://www.pupboss.com/
       http://localhost:9138/
max-age = 15m
notify = smtp

[server]
listen = http://localhost:9000/

[moderation]
enabled = false

[smtp]
username = no_reply@pupboss.com
password = *************
host = smtp.exmail.qq.com
port = 465
security = ssl
to = me@xxx.com
from = "@{HOME: PUPBOSS};"<no_reply@pupboss.com>
timeout = 10

[guard]
enabled = true
ratelimit = 3
direct-reply = 3
reply-to-self = true
require-author = true
require-email = true

Deployment

After that, we use supervisor for process monitor, and use nginx for proxy, here is my supervisor config file

[program:comment]
command = /usr/local/bin/isso -c /etc/isso.d/homepage.conf run
directory = /var/lib/isso
user = isso
autostart = true
autorestart = true
stdout_logfile = /var/log/supervisor/comment.log
stderr_logfile = /var/log/supervisor/comment_error.log
environment = LANG="en_US.UTF-8"

and nginx config file

server {

    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name comment.pupboss.com;

    include ssl/ecc_pupboss_com.conf;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass http://127.0.0.1:port;
        proxy_read_timeout 3000s;
        proxy_connect_timeout 3000s;
    }
}

server {

    listen 80;
    listen [::]:80;
    server_name comment.pupboss.com;

    return 301 https://$server_name$request_uri;
}

Ok, if you see curl https://comment.example.com return a 404 error, congratulations, hurry up and put the follow lines in your website's comment block

Please note: the values of data-isso-reply-to-self, data-isso-require-author, data-isso-require-email fields, must be same as the config file on server side.

<section id="isso-thread"></section>
<script data-isso="https://comment.pupboss.com/"  
    data-isso-css="true"
    data-isso-lang="en"
    data-isso-reply-to-self="true"
    data-isso-require-author="true"
    data-isso-require-email="true"
    data-isso-max-comments-top="10"
    data-isso-max-comments-nested="5"
    data-isso-reveal-on-click="5"
    data-isso-avatar="true"
    data-isso-avatar-bg="#f0f0f0"
    data-isso-avatar-fg="#9abf88 #5698c4 #e279a3 #9163b6 ..."
    data-isso-vote="true"
    data-vote-levels="[-5,5,15]"
    src="https://comment.pupboss.com/js/embed.min.js"></script>

Tags

Jie Li

🚘 On-road / 📉 US Stock / 💻 Full Stack Engineer / ®️ ENTJ