Flarum To Discourse Migration

Hello there. Today I tried to move a site using Flarum to Discourse.
I have successfully installed the Discourse development environment on my Win 10 computer via WSL2.

  • I installed Mysql 5.7 version in development environment.

  • I have successfully imported the database into the development environment.

  • I installed mysql2 with the command gem install mysql2

  • I added the following to the end of the Gemfile with the sudo nano Gemfile command.

gem 'mysql2'

FLARUM_HOST ||= ENV['FLARUM_HOST'] || "localhost"
FLARUM_DB ||= ENV['FLARUM_DB'] || "flarum"
BATCH_SIZE ||= 1000
FLARUM_USER ||= ENV['FLARUM_USER'] || "mekici"
FLARUM_PW ||= ENV['FLARUM_PW'] || "mypass"

now bundle install followed by the following command:

bundle exec ruby ​​script/import_scripts/flarum_import.rb

and the error I get:

Loading existing groups...
Loading existing users...
Loading existing categories...
Loading existing posts...
Loading existing topics...
Traceback (most recent call last):
        5: from script/import_scripts/flarum_import.rb:162:in `<main>'
        4: from script/import_scripts/flarum_import.rb:162:in `new'
        3: from script/import_scripts/flarum_import.rb:20:in `initialize'
        2: from script/import_scripts/flarum_import.rb:20:in `new'
        1: from /home/mekici/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `initialize'
/home/mekici/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `connect': Unknown MySQL server host 'db_host' (0) (Mysql2::Error::ConnectionError)

What am I doing wrong. It’s strange that it gives the MySQL connection error because the MySQL server is active and running. Am I doing something wrong?


These things need to be set either by editing the flarum_import.rb script, not in the Gemfile.

This was your clue that it wasn’t using your desired settings:


How long will it take to process the 400 MB flarum database? This is the third day and it is still going on. Where can I see the rest in Sidekiq?

The Flarum site had 16K discussion and 415K posts. Sidekiq is currently processing id 14857.

1 Like

I don’t know how to guess. If you have more cpu that’s not getting used you can search here and figure out how to run more processes.

1 Like

I’ve migrated a flarum site to Discourse. When trying to open the sql.gz file of the database backup and the log.txt.zip file in the image, I get the archive corrupt error. What could this be due to?

1 Like

That’s not the database backup. That’s a log of making the backup. You’ll need to visit /admin/backups or download directly from /var/discourse/shared/standalone/backups/default.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.