I created a migration script to import FluxBB database into Discourse. Now I’m going to explain how to do the import process in a step-by-step tutorial.
I tested this migration script with FluxBB v1.5.10 (which is current version now)
What data can be imported?
- Users (including bios/signatures)
- Groups
- Categories
Permissions won’t be imported and all categories will be public. Right permissions must be set manually after the import. - Topics (including sticky/pinned status)
- Posts
- Suspended users
Before starting the migration, set a development environment on your machine (or inside a virtual machine) . See the OS X or Ubuntu installation guide for development.
Discourse requires Ruby 3.4+. To check your Ruby version enter the command below
ruby -v
Mysql
Now we need mysql2 gem for ruby to connect with our old FluxBB database. Run the below commands to install libmysqlclient-dev dependency & mysql2 gem.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libmysqlclient-dev
gem install mysql2
(optional) Importing MySQL dump into localhost
To install MySQL client and import mysql dump file (.sql) to your development machine follow the instructions below
sudo apt-get install mysql-server mysql-client
Create MySQL user, grants and table
mysql -u root -p mysql
mysql> CREATE USER 'fluxbb'@'localhost' IDENTIFIED BY 'fluxbb';
Query OK, 0 rows affected (0.00 sec)
.
mysql> CREATE DATABASE fluxbb;
Query OK, 1 row affected (0.01 sec)
.
mysql> GRANT ALL PRIVILEGES ON fluxbb.* TO 'fluxbb'@'localhost';
Query OK, 0 rows affected (0.00 sec)
.
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
.
mysql> exit
Import your FluxBB database dump file
mysql -u fluxbb -p fluxbb < myfluxbb.sql
BBCode to Markdown
The import script handles BBCode to Markdown conversion automatically. No additional gems are needed for this.
After installing mysql2, go to your Discourse installation path and open Gemfile to edit.
cd ~/discourse
sudo nano Gemfile
Now insert the line below at the end of the file to add the mysql2 gem to Discourse.
gem 'mysql2'
Before running the import script, paste these lines one by one into your shell. (use arrow keys to edit the values)
export FLUXBB_HOST="localhost"
export FLUXBB_DB="fluxbb"
export FLUXBB_USER="root"
export FLUXBB_PW=""
export FLUXBB_PREFIX=""
Now it’s time to run the import script. Run the below command to start migration.
RAILS_ENV=production bundle exec ruby script/import_scripts/fluxbb.rb
Wait until the import is done. You can restart it if it slows down to a crawl.
After all congratulations! Your database successfully migrated from FluxBB to Discourse ![]()
Start your Discourse instance:
bundle exec rails server
Start Sidekiq and let it do its work:
bundle exec sidekiq -q critical,4 -q default,2 -q low
Depending on your forum size this can take a long time. You can monitor the progress at http://localhost:3000/sidekiq
Now take a backup from admin page /admin/backups and import it in your live Discourse website.
Last edited by @JammyDodger 2024-05-27T14:54:39Z
Check document
Perform check on document: