Import Wordpress comments through Disqus

AI-generated summary

User art seeks assistance migrating WordPress comments to Discourse, noting that direct imports are unsupported and a transition through Disqus is required. After following the 30-minute DigitalOcean installation guide, art attempted to import a Disqus XML file using the thor disqus:import command, which failed as the command no longer exists. A subsequent attempt using thor typepad:import imported zero entries. art then located a recent disqus.rb script and executed it via Ruby, but encountered a LoadError because the nokogiri gem was missing. An attempt to install the gem failed due to a Gem::FilePermissionError. User omfg suggested entering the Docker container as the root user to resolve the permission issue. art confirmed this solution worked, successfully running the import script after gaining the necessary privileges.

Hi,

I try to migrate my WordPress comments to Discourse. I’ve read a lot about that, and I saw I need to transit my comments through Disqus to do that, because imports script don’t work with WP at this time.

I’ve installed Discourse with DigitalOcean and the 30 min install.

Well, inspired by this tutorial, I’ve tried to import my xml from Disqus. First :

$ RAILS_ENV=production bundle exec thor disqus:import --file=irz.xml --post-as=disqus --dry-run
Could not find command "disqus:import".

Ok I understand, this don’t work anymore.

$ cd /var/www/discourse
$ RAILS_ENV=production bundle exec thor typepad:import --file=irz.xml --post-as=art
Importing 0 entries

Well, this don’t work too. So close.

I’ve found another interesting and recent file (update a month ago), disqus.rb. Reading the file, I found how to call it :

$ cd /var/www/discourse/script/import_scripts
$ RAILS_ENV=production ruby disqus.rb --file=irz.xml --post-as=art --dry_run
/usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- nokogiri (LoadError)
	from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from disqus.rb:1:in `<main>'

Perhaps I missed something..

I don’t know if I need to install nogokiri gem ?

$ gem install nokogiri
ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/local/lib/ruby/gems/2.0.0 directory.

If you have another way to do that, I’ll take it.

Enter Docker as “root” and you’ll have the permissions you need.

Yep, thank you @omfg.

This command working :

$ cd /var/www/discourse/script/import_scripts
$ RAILS_ENV=production ruby disqus.rb --file=irz.xml --post_as=art