SMF2 to Discourse Migration Issue

I’ve followed the guides and I’m up to here, but cannot seem to get past this point. I have even created a new user on the MySQL server with a native password and tried but to no avail.

su discourse -c "bundle exec ruby script/import_scripts/smf2.rb /shared/smf2 -t UTC"
Loading existing groups...
Loading existing users...
Loading existing categories...
Loading existing posts...
Loading existing topics...
Traceback (most recent call last):
        7: from script/import_scripts/smf2.rb:701:in `<main>'
        6: from script/import_scripts/smf2.rb:28:in `run'
        5: from script/import_scripts/smf2.rb:28:in `new'
        4: from script/import_scripts/smf2.rb:62:in `initialize'
        3: from script/import_scripts/smf2.rb:274:in `create_db_connection'
        2: from script/import_scripts/smf2.rb:274:in `new'
        1: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `initialize'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `connect': RSA Encryption not supported - caching_sha2_password plugin was built with GnuTLS support (Mysql2::Error)

This seems to be a issue with the script as I can install MySQL client in the container and access the database in the MySQL container via the command line.

OK. So for those of you that come across this I had to do a fair bit to massage this import script into working.

The MySQL docker container is version 8.

This means for some reason the mariadb library that the MySQL template draws in doesn’t work.

What I did differently than https://meta.discourse.org/t/smf2-to-discourse-the-ultimate-guide/90314:

I did not include the MySQL template file in the import docker container config file.

I built the import container, entered into it with ./launcher enter import

Then:

echo "gem 'mysql2'" >> Gemfile
wget https://dev.mysql.com/get/mysql-apt-config_0.8.17-1_all.deb
dpkg -i mysql-apt-config_0.8.17-1_all.deb

This has an interactive prompt and you can select the defaults (MySQL 8 with tools)

Then I installed the normal MySQL 8 library and continued the build:

apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y libmysqlclient-dev
su discourse -c 'bundle config unset deployment'
su discourse -c 'bundle install --no-deployment --path vendor/bundle --jobs 4 --without test development'

Once this was all done the rest was the same, the import is now running.

The Discourse devs may want to adjust the import scripts to account for this, at least it’s now on the forums for others to see if they get stuck like I did.

3 Likes