Migrate a Phorum forum to Discourse

Thanks for the scripts!

However I feel like the manual is quite raw and unclear. I had to refer to e.g. Xenforo migraiton guide to actually understand what do you suggest here. Let me add some missing steps:

  • Have Discourse up and running
  • Create mysqldump from the original Phorum - all clear, all good.
  • Copy database dump into Discourse folder docker cp/path/to/backup/phorum_db.sql.gz app:/shared/phorum_db.sql.gz (assuming app as standard container name)
    And here the missing parts:
  • Actually jump into Discourse Docker container and install MySQL there:
docker exec -it app bash
apt-get update && apt-get upgrade
# pv just for convenience to display progress, lsb-release is required by something
 apt-get install -y lsb-release pv mariadb-server mariadb-client libmariadb-dev
 service mariadb start

Note MySQL installation is a bit more tricky, but Mariadb should work as fine.

Then create a database: mysqlCREATE database phorum.

Then fill it from backup: pv phorum_db.sql.gz | gunzip | mysql phorum (no need in gunzip if your dump is bare sql)

Add MySql support to Ruby:

cd /var/www/discourse/
echo "gem 'mysql2'" >>Gemfile
bundle config unset deployment
bundle install --no-deployment

Modify data in migration script (database credentials, prefix, permalinks):

nano /var/www/discourse/script/import_scripts/phorum.rb

And then back to the original post guide, all good there:

Run the importer with a clean Discourse instance:

git config --global --add safe.directory /var/www/discourse
bundle exec ruby script/import_scripts/phorum.rb

Iа Discourse database is not really clean, better clean it with bundle exec rake db:drop db:create db:migrate beforehand.

If it fails with “PG::ConnectionBad: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: FATAL: Peer authentication failed for user “discourse” (PG::ConnectionBad)”:

  1. If you get the error 'Peer authentication failed for user "discourse"':
  2. Edit the file /etc/postgresql/13/main/pg_hba.conf
  3. change all ‘peer’ to ‘trust’ and save the file
  4. reload postgres server: /etc/init.d/postgresql reload (or maybe psql -U postgres -c "SELECT pg_reload_conf();", but this was failing for me sometimes)

First it runs users migrations which might be relatively slow (~1.2k users/minute as per script output. I had 100k users, so…). Then it creates categories and starts migrating messages and topics (same speed, ~1.2k/minute), but at this point you can already access the website and see how does it look like.

Seems way smoother than I would expect for such an ancient engine like Phorum. It seems there is no migration of Private Messages (PM), but should be not a blocker for me at least.

Thanks again for the script and efforts!