Migrating from SMF to Discourse


#1

Greetings,

I’m planing to migrate from SMF 2.0.9 to Discourse. I already have discourse running and everything is working fine. So my question is it possible to “RESET” discourse to look like i installed it fresh. And then migrate to Discourse from SMF?

EDIT: Also i have Woltlab 4.0.8 forum running (Also i can migrate to phpbb or any other that is required for the simpliest migration) ty


(Jens Maier) #2

No, unfortunately there is no reset feature. You may need to reinstall Discourse and manually copy the things you wish to keep, i.e. your design, customizations, category settings and such.

Migrating SMF2 to Discourse is quite possible, but because it involves interacting with the Linux console and since there are a few technological barriers to bridge, the process can be somewhat finicky. Basically:

  1. setup Discourse,
  2. make a backup,
  3. copy your old SMF2 forum to your new server under /var/discourse/shared/standalone/smf,
  4. install the mysql2 gem in the container and run the importer:
cd /var/discourse && ./launcher enter app
apt-get update && apt-get install libmysqlclient-dev
su - discourse
gem install mysql2
cd /var/www/discourse/script/import_scripts
ruby smf2.rb /shared/smf -h $myql_server -t $php_timezone

In the last command, replace $mysql_server with the hostname or IP address of SMF2’s database server. This server must be reachable over the internet; if direct access isn’t possible (due to a firewall, for instance), you can try to tunnel the connection through SSH (see TCP FORWARDING in man ssh). If you can’t connect to your old server via SSH, you may need to temporarily install MySQL on the new Discourse server and import an SQL dump.

Finally, $php_timezone is the default timezone used by PHP on your old server. You can skip this setting (also remove the -t switch in this case), but imported timestamps may be slightly off.


#3

Thanks @elberet for replying. I decided that i’ll start clean and just copy the important topics from last site. I’ve bulked all email and sent invite codes to users so no problems. Also changing host in containers/app.yml name from lets say

www.oldname.rs” --> “www.newname.rs” should be simple right? just modify app.yml and after my isp change ip from newname.rs to this discourse i can then modify it and rebuild it correct? there shouldnt be much problems with it?


(Jens Maier) #4

You may need to run a script inside the container that rewrites internal links embedded in posts, but that’s it. There’s also a howto about changing the domain name. :slight_smile:


(Kane York) #5

Yes, actually - remove the postgres folders in /var/discourse/shared/standalone, then rebuild the container. That will wipe out your database.


#6

Thanks guys, appreciate all help. Definelty best support of any project i’ve meet so far. Cheers!


(Mirko) #7

running production site example.com and want to import SMF from mysmf.com
i copied SMF files to /var/discourse/shared/standalone/smf
followed instructions and come to line
ruby smf2.rb /shared/smf -h $myql_server -t $php_timezone

i run
RAILS_ENV=production ruby smf2.rb /var/discourse/shared/standalone/smf
and get error
Cannot load SMF settings: No such file or directory @ rb_sysopen - /var/discourse/shared/standalone/smf/Settings.php
but the file exista

anyway not sure how that would import DB.

does anyone knows what I am doing wrong?


#8

Does this mean that I have to install the mysql server inside the docker or in the server?


(Daniele Scasciafratte) #9

For who us wondering about how to use the script:

  • The path is required to parse the Settings.php file and get the database connection parameters. In my case I imported the db locally and updated that file and created a folder with only this file
  • For timezone you have to write in that syntax: Europe/Rome as example and UTC
  • Add many ram to your vm. I forgot it to do it and now is important 45000 user with the default parameters
  • Don’t forget to install your discourse in your installation
  • Tweak a little bit the MySQL settings for more cache and more connections because with an huge db the connection can stop and you have to start again
  • The script reconize the already stuff imported so in case of crash you can execute again
  • I made a patched version of mysql2 to avoid invalid month/date GitHub - Mte90/mysql2: [Patched] A modern, simple and very fast Mysql library for Ruby - binding to libmysql