Importing Xenforo to Discourse

import

#1

Hey guys so after trying for a week or so I decided to import the database on docker app which I hoped it will succeed without any issues. TBH I got some issues at first but it turned to be all easy to solve.

Now I would recommend doing this only once before you deploy your production site, after importing everything take a Discourse backup, wipe everything out and install new Discourse instance then restore the imported db.

Ok let’s begin:

  1. First lets backup your old database from your old server, sign in to your Discourse server then:

     ssh USER@XENFORO_SERVER_IP  # Use -p argument to specify custom port
     mysqldump -u XENFORO_DATABASE_USER -p XENFORO_DATABASE_NAME > xen_db.sql
     exit
    
  2. After installing Discourse start the app:

     ./launcher start app
    
  3. Now lets pull the database backup from xenforo server:

     scp USER@XENFORO_SERVER_IP:~/xen_db.sql /var/discourse/shared/standalone/xen_db.sql
    

    If you changed the ssh port use -P argument

     scp -P 2222 USER@XENFORO_SERVER_IP:~/xen_db.sql /var/discourse/shared/standalone/xen_db.sql 
    
  4. Login to docker machine, install and start mysql:

     docker exec -it app bash
     sudo apt-get update
     sudo apt-get upgrade
    

    During the installation you will be asked to set a root password for mysql

     sudo apt-get install mysql-server mysql-client libmysqlclient-dev
     service mysql start
    
  5. Login to mysql and create new database:

     mysql -u root -p
    

    Enter your mysql root password then

     create database xenforo_db;
     exit;
    
  6. Import your xenforo database into the new one:

     mysql -u root -p xenforo_db < /shared/xen_db.sql
     # Enter your mysql root password and wait until it finish
    
  7. Include the gem in discourse Gemfile:

     echo "gem 'mysql2'" >>Gemfile
    
  8. Run bundle install:

     bundle install --no-deployment
    
  9. Edit the importer script and change the following:

    vi /var/www/discourse/script/import_scripts/xenforo.rb
    XENFORO_DB = "xenforo_db"
    @client = Mysql2::Client.new(
      host: "localhost",
      username: "root",
      password: "Your mysql root password",
      database: XENFORO_DB
    )
    
  10. You are set to go now, run the importer:

    RAILS_ENV=production bundle exec ruby script/import_scripts/xenforo.rb

  11. If you get the error 'Peer authentication failed for user "discourse"':

  12. Edit the file /etc/postgresql/9.5/main/pg_hba.conf

  13. change all ‘peer’ to ‘trust’ and save the file

  14. restart postgres server: service postgresql restart

Run the importer again and this time it should work without any problem, be patient this might take a while based on your database size.

Hope this helps someone. :slight_smile:


XenForo Import Failing (config/application.rb:2)
How to convert vBulletin 4 database to Discourse?
Does the XenForo to Discourse Converter also imports password?
Error Trying to Start Import Process - Xenforo to Discourse
XenForo Import Failing (config/application.rb:2)
Import Questions
Questions About Migrating From Xenforo
(RoldanLT) #2

So XenForo attachments wil not be converted into Discourse?


#3

I checked the importer script and it appears it doesn’t have an attachment importing code so that would need a custom modification to the script.

Are you thinking about moving your community to Discourse? :grinning:


(RoldanLT) #4

Yes, XenForo somewhat bored me.


(Erlend Sogge Heggen) #5

If you’d like to have the script also support

  • attachments
  • redirects (see vBulletin redirects for a point of reference)
  • passwords (see discourse-migratepassword – though I’d say this is lower priority since password reset works fine and is often better practice anyhow)

…we recommend posting to our #marketplace offering to pay a developer to work on these improvements. If @Cyb3r is not available for contracting work there’s sure to be others who’d be happy to take this on!


(laogui) #6

There’s an official XenForo importer, but unfortunately, there is no attachments import feature.


(Jay Pfaffman) #7

If you’d like for it to support attachments,and have a budget, you can post in #marketplace.


(Муха) #8

hi, can u help me with converting xenforo to discourse? tnx