This weekend I made the ambitious move to using
Discourse.org for my blog and also
upgrading Octopress to the latest version which
supports Jekyll 2.0. Here's my notes, so that you can evaluate if you
want to do either of these, as well as how to do this efficiently.
What motivated me to update Octopress? The main reason was that
Octopress finally got upgraded from a beta
version of Jekyll to Jekyll 2.x.
What motivated me to migrate comments to Discourse?
I already wanted to create a forum for my website, so integrating
blog comments seemed worth pursuing. This is what BoingBoing uses
for its blog articles. Click on the
"Discuss" link below any BoingBoing article and get taken to the
Discourse topic for that article.
I wanted to be able to have more engaging conversations with my
programmer friends on the topics which I'm blogging about.
Since I assumed that this problem would be pretty specific to my
Octopress site, I guessed that the issue was related to a rogue Jekyll
I moved all my plugins that were not part of standard Octopress into a
/plugins_removed directory, and then added back my plugins one at a
time. That helped me narrow down the issue to the
jekyll_alias_generator plugin, which sets up redirects when you change
the URL of a published blog articles.
Once you configure your Discourse site to import your blog articles,
you'll have to wait a bit for the rake task to run. It's great being
able to kickstart the content of the forum with one's blog articles!
The configuration of Discourse for blogging is super easy.
Configure the following settings, taking note that:
The urls are to your blog and include the subdomain, like
The embeddable host does not include http://
The feed polling URL does include http://
I added a category called "Blog".
I created a user called "disqus" for users not found in the Disqus
Octopress Discourse Comments Setup
Remove or comment out your Disqus setup in your /_config.yml file:
# Disqus Comments# Removed as support for Discourse comments added# disqus_short_name: railsonmaui# disqus_show_comment_count: true
Note, I first commented it out, because I toggled this on and off as
I was ensuring that the comment migration worked correctly, and none
Add the plugin contained in
to your /plugins directory. This plugin will append a DIV to your
posts like this:
That should bring you to the Discussions tab. Then click the Export
sub-tab. It should look like this:
You'll have to wait a few minutes for the creation email. I then
saved the file to my ~/Downloads directory.
Ssh to your docker instance
Get into your docker instance.
root@forum:~# cd /var/discourse/
root@forum:/var/discourse# ./launcher ssh app
You'll see this message:
Welcome to Discourse Docker
Use: railsundefined rake or discourse to execute commands in production
Sudo to discourse:
root@forum:~# sudo -iu discourse
discourse@forum:~$ cd /var/www/discourse
discourse@forum:/var/www/discourse$ bundle exec thor list
Then you need to copy the XML file you downloaded from Disqus that
contains an archive of your comments. The easiest way to do this is
to scp the file from some place accessible on the Internet. What I
did was to scp the file from my local machine to my Digital Ocean
machine, and then from my Digital Ocean machine to the Docker
container. Here's an example:
On your local machine, with the XML file (XXX.XXX.XXX.XXX is the ip
of your droplet):
That puts the file railsonmaui-disqus.xml in the current directory.
Run the thor command:
discourse@forum:/var/www/discourse$ bundle exec thor disqus:import --file=railsonmaui-disqus.xml --post-as=disqus --dry-run
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:898:in `rescue in connect': FATAL: database "discourse_development" does not exist (ActiveRecord::NoDatabaseError)
Run `$ bin/rake db:create db:migrate` to create your database
from /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `connect'
The problem is that we need to specify the environment, as is
standard with Rails apps:
This creates the comments and the users. Creating the users
surprised me as I didn't know that the Disqus export contained the
users' email addresses. So this script ends up triggering
activation emails to all those users!
This is all pretty neat! Not only did I get my new forum populated
with some content, but I also created users who commented on my posts in
the past. I'm hoping I can engage in more meaningful discussions
regarding the technologies that I blog about with my own forum. Please
do sign-up for the forum so you can
comment and receive periodic updates of what gets posted! Or just sign
up when you want to post a comment. :-)
CEO at ShakaCode
Share this article
Are you looking for a software development partner who can
develop modern, high-performance web apps and sites?