Migrate a vBulletin 4 forum to Discourse

No budget for this. But. Maybe.

2 Likes

Anyone seen this problem when running the import script?

Postprocessing postsā€¦
37785 / 48843 ( 77.4%) Killed*

The process was killed before completing. When I load the Forums, the imported messages seem to be there, bit I am worried it didnā€™t gracefully complete and there will be problems.

Any recommendations? Perhaps an out of memory error? Can I simply re-run the script to pick up where it left off or will it try to re-import duplicate data? Thank you.

Rerun the script. It will not duplicate data.

3 Likes

Thank you, @pfaffman! This worked great.

4 Likes

Hi,
First off thank you for this fantastic guide. I appreciate the work thatā€™s been put into this.

For my issue
Iā€™m having trouble with connecting to the database when I run the import script, albeit Iā€™m using Mariadb to house the vbulletin dump rather than mysql. Iā€™ve verified that MariaDB is running, Iā€™m able to import my vbulletin dump into it, and Iā€™ve quadruple checked the username, hostname, and password in the script but still no luck.

I feel as though Iā€™m missing something simple, if someone could point me in the right direction thatā€™d be very helpful

Iā€™m using the following versions

mysql2 0.5.2
mariadb-server-10.3
dicourse master git commit cb8fa46

Full description below

When I try and run

apt-get update && apt-get install libmysqlclient-dev mysql-server-5.7

I get an error

E: Package 'libmysqlclient-dev' has no installation candidate
E: Package 'mysql-server-5.7' has no installation candidate

which makes sense, perhaps those packages have been removed from the repository in this time.

So instead I run

apt-get update && apt-get install mariadb-server-10.3 libmariadbd-dev

Mariadb works as a drop in replacement which is nice because all steps work up until I try to run the migration script at which point I get the error

root@discourse:/src# su discourse -c 'bundle exec ruby script/import_scripts/vbulletin.rb'
root:@localhost wants vb4
Loading existing groups...
Loading existing users...
Loading existing categories...
Loading existing posts...
Loading existing topics...
==================================================
Access denied for user 'root'@'localhost'
Cannot connect in to database.

Hostname: localhost
Username: root
Password: 
database: vb4

Edit the script or set these environment variables:

export DB_HOST="localhost"
export DB_NAME="vbulletin"
export DB_PW=""
export DB_USER="root"
export TABLE_PREFIX="vb_"
export ATTACHMENT_DIR '/path/to/your/attachment/folder'

Exiting.

For permissions

root@discourse:/src# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 59
Server version: 10.3.17-MariaDB-0+deb10u1 Debian 10

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show grants;
+------------------------------------------------------------------------------------------------+
| Grants for root@localhost                                                                      |
+------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED VIA unix_socket WITH GRANT OPTION |
| GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION                                  |
+------------------------------------------------------------------------------------------------+
2 rows in set (0.000 sec)

I have double checked the username and password many times, and even manually set it myself.

2 Likes

I did a little bit more digging and found that the base image change from Ubuntu 16.04 to debian is certainly the culprit for why mysql is no longer available, but still baffled on how to get mysql2 to connect to MariaDB.

https://github.com/discourse/discourse_docker/commit/b95ea6f77a250793dc8e33f5e54571294db543e6#diff-882bf22f18ee0c4eb3af760ec94920e2R3

I submitted a PR a while back that makes the mysql-dep.template.yml use MariaDB. Iā€™ve used it several times.

It looks like you are trying not to use a password? I recommend using a password. The script assumes that there is a password.

2 Likes

Got it. Iā€™ll try setting a password and seeing if that works. From what I gather though the import script should still work with MariaDB. If so Iā€™ll keep troubleshooting. Thank you for the quick help!

@pfaffman That was it! Thank you so much. Once I get my forum in order I can send a pr for a VB3 version I had in case itā€™ll be useful to anyone.

This is also my test instance so Iā€™m ok posting the details, itā€™s going to get torn down :slight_smile:

3 Likes

Thank you all for the help, the migration went mostly well. There were a couple missing attachments here and there but overall this went great.

For those reading in the future I migrated from Vb3.8.7

I needed to make some edits to the sql query in vbulletin.rb, as my database structure didnā€™t exactly match the script but it was pretty close. I decided to give up the custom captions to get things moving.

Github diff: https://github.com/canyon289/discourse/pull/1/files

For the MariaDB installation that replaces mysql I used the following command.

apt-get update && apt-get install mariadb-server-10.3 libmariadbd-dev

and to change my MariaDB password from null to a value this link was the most comprehensive

Again I canā€™t thank the people in this thread enough, and all the contributors to discourse for code and help!

4 Likes

I just finished a migration, and it gave all 2,000+ topics a category inherited from the vBulletin 4 instance. It will not let me delete this category and set all these migrated posts back to no selected category. ā€œCanā€™t delete this category because it has 2322 topicsā€

Is there a workaround for this?

Either re-migrate or change the category on those topics. With that many you will need to do it from the Ruby command line.

1 Like

Hi,

Iā€™m not sure about the context of this.

Copy the attachments to your Discourse instance (for the path check your VB4 settings).

Can anyone please help?

Hi,

I noticed there is a vBulletin 5 script, however, I canā€™t find any feedback regarding it. Would the information in this topic apply to it as well?

Thank you!

1 Like

The script should work very similarly.

1 Like

Running an import for a vB4 install, but it fails on importing the children categories. Bear with me as Iā€™m Rails/Ruby rookie.

    Traceback (most recent call last):
        20: from script/import_scripts/vbulletin.rb:943:in `<main>'
        19: from /home/vagrant/discourse/script/import_scripts/base.rb:47:in `perform'
        18: from script/import_scripts/vbulletin.rb:84:in `execute'
        17: from script/import_scripts/vbulletin.rb:293:in `import_categories'
        16: from /home/vagrant/discourse/script/import_scripts/base.rb:403:in `create_categories'
        15: from /home/vagrant/discourse/script/import_scripts/base.rb:403:in `each'
        14: from /home/vagrant/discourse/script/import_scripts/base.rb:422:in `block in create_categories'
        13: from /home/vagrant/discourse/script/import_scripts/base.rb:454:in `create_category'
        12: from /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/suppressor.rb:48:in `save!'
        11: from /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/transactions.rb:319:in `save!'
        10: from /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/transactions.rb:366:in `with_transaction_returning_status'
         9: from /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/transactions.rb:212:in `transaction'
         8: from /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:281:in `transaction'
         7: from /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
         6: from /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
         5: from /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
         4: from /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:281:in `block in transaction'
         3: from /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/transactions.rb:375:in `block in with_transaction_returning_status'
         2: from /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/transactions.rb:319:in `block in save!'
         1: from /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/validations.rb:53:in `save!'
/home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/validations.rb:81:in `raise_validation_error': Validation failed: Slug is invalid (ActiveRecord::RecordInvalid)

I added some debug output to troubleshoot. The value for slug in the Category is nil.

The category appears to be valid when it loops through create_categories(children_categories) do |category|. I have it also log opts, import_id, and new_category (immediately before .save!) from def create_category in base.rb. It all appears to be valid per what the functions are expecting.

Has anyone encountered this before?

       37 / 53 ( 69.8%)  [345139 items/min]
category:
{"forumid"=>355, "title"=>"News", "description"=>"RSS Feed", "displayorder"=>6, "parentid"=>205}

Entering create_category...
opts:
{:id=>355, :name=>"News", :position=>6, :description=>"RSS Feed", :parent_category_id=>6}
import_id:
355

new_category:
#<Category id: nil, name: "News", color: "BF1E2E", topic_id: nil, topic_count: 0, created_at: nil, updated_at: nil, user_id: -1, topics_year: 0, topics_month: 0, topics_week: 0, slug: nil, description: nil, text_color: "FFF", read_restricted: false, auto_close_hours: nil, post_count: 0, latest_post_id: nil, latest_topic_id: nil, position: 6, parent_category_id: 6, posts_year: 0, posts_month: 0, posts_week: 0, email_in: nil, email_in_allow_strangers: false, topics_day: 0, posts_day: 0, allow_badges: true, name_lower: nil, auto_close_based_on_last_post: false, topic_template: nil, contains_messages: nil, sort_order: nil, sort_ascending: nil, uploaded_logo_id: nil, uploaded_background_id: nil, topic_featured_link_allowed: true, all_topics_wiki: false, show_subcategory_list: false, num_featured_topics: 3, default_view: nil, subcategory_list_style: "rows_with_featured_topics", default_top_period: "all", mailinglist_mirror: false, minimum_required_tags: 0, navigate_to_first_post_after_read: false, search_priority: 0, allow_global_tags: false, reviewable_by_group_id: nil, required_tag_group_id: nil, min_tags_from_required_group: 1>
    Traceback (most recent call last):
2 Likes

Our developer tried the script but couldnā€™t get very far. Is someone interested in doing it for us on a consulting basis?

2 Likes

Sure, please send me a PM.

2 Likes

Please pardon my ignorance, but how to I send a PM? I didnā€™t find it obvious. Or you can email me directly at abboud at cedrus dot com.

Importing question: some posts in our vBulletin-based forum have links to other posts in the same forum. Do these links get converted when imported? if not, what happens to them? do they get removed?

1 Like

I canā€™t remember whether the current version rewrites them. The script that I have (which I intend to submit a PR for) fixes them.

2 Likes