Migrate a bbPress WordPress plugin forum to Discourse

It sounds like it.

And my vbulletin import script, which does handle non-linked attachments, doesn’t look for them in that table, so you’ll need some custom code to deal with that, even after I get around to submitting a PR with my script.

EDIT: and it also means that I think that even if they were linked in-post they still wouldn’t work, since they aren’t where the script expects them in the database.

1 Like

Good news! I don’t know exactly how the import script handles it but it does! After making the files accessible to the import container and digging a bit in the script I found that it works. The only problem I had was that the file name which I tested it on contained an ä and thus some weird encoding shit prevented the script from finding the file actually. After fixing the filename the import worked and the attachment appeared at the post!

Thanks a lot for all the tips! :beers:

1 Like

Awesome! Glad the magic worked for you! (Oh! I and I see now that I was looking at the vBulletin script and not bbPress, hence my confusion. That explains why I couldn’t find the table!)

1 Like

Hi
I got an error after launching the IMPORT bundle exec command:

Using unicorn 5.5.1
Using webmock 3.7.6
Using webpush 1.0.0
Using yaml-lint 0.0.10
Bundle complete! 130 Gemfile dependencies, 214 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Traceback (most recent call last):
        31: from scripts/import_scripts/bbpress.rb:4:in `<main>'
        30: from scripts/import_scripts/bbpress.rb:4:in `require'
        29: from /var/discourse/scripts/import_scripts/base.rb:16:in `<top (required)>'
        28: from /var/discourse/scripts/import_scripts/base.rb:16:in `require_relative'
        27: from /var/discourse/config/environment.rb:7:in `<top (required)>'
        26: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/railtie.rb:190:in `method_missing'
        25: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/railtie.rb:190:in `public_send'
        24: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/application.rb:363:in `initialize!'
        23: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/initializable.rb:60:in `run_initializers'
        22: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
        21: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
        20: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
        19: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `call'
        18: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each'
        17: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
        16: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
        15: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        14: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
        13: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/initializable.rb:61:in `block in run_initializers'
        12: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/initializable.rb:32:in `run'
        11: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/initializable.rb:32:in `instance_exec'
        10: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/application/bootstrap.rb:73:in `block in <module:Bootstrap>'
         9: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
         8: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
         7: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
         6: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
         5: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
         4: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
         3: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/ember-rails-0.18.5/lib/ember/rails/engine.rb:19:in `block in <class:Engine>'
         2: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in `load_missing_constant'
         1: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
/home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in `block in load_missing_constant': uninitialized constant Sprockets::Engines (NameError)
        32: from scripts/import_scripts/bbpress.rb:4:in `<main>'
        31: from scripts/import_scripts/bbpress.rb:4:in `require'
        30: from /var/discourse/scripts/import_scripts/base.rb:16:in `<top (required)>'
        29: from /var/discourse/scripts/import_scripts/base.rb:16:in `require_relative'
        28: from /var/discourse/config/environment.rb:7:in `<top (required)>'
        27: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/railtie.rb:190:in `method_missing'
        26: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/railtie.rb:190:in `public_send'
        25: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/application.rb:363:in `initialize!'
        24: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/initializable.rb:60:in `run_initializers'
        23: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
        22: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
        21: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
        20: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `call'
        19: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each'
        18: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
        17: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
        16: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        15: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
        14: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/initializable.rb:61:in `block in run_initializers'
        13: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/initializable.rb:32:in `run'
        12: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/initializable.rb:32:in `instance_exec'
        11: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/application/bootstrap.rb:73:in `block in <module:Bootstrap>'
        10: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
         9: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
         8: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
         7: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
         6: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
         5: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
         4: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/ember-rails-0.18.5/lib/ember/rails/engine.rb:19:in `block in <class:Engine>'
         3: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:58:in `load_missing_constant'
         2: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `rescue in load_missing_constant'
         1: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache'
/home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `block in load_missing_constant': uninitialized constant Sprockets::Engines (NameError)
root@sd-114000:/var/discourse# ~

Any idea please ?
Thank you :wink:

Thanks for this tutorial, @vinothkannans!

I’m stuck modifying bbpress.rb

After running sudo nano script/import_scripts/bbpress.rb it opens the file editor, but when I tray and save, it says there’s no such file or directory:

image

It’s a totally fresh install.

Many thanks,

Jake

In the above guide, I used /var/discourse directory to install the Discourse development environment. If you installed it in a different location then make sure to cd to that directory (‘~/discourse’ in most cases) instead of the above before running the sudo nano script/import_scripts/bbpress.rb command.

3 Likes

Hi,

I don’t see “script” path in /var/discourse folder.

  • I tried from DigitalOcean’s new Discourse Marketplace fresh instance.
  • I tried from Discourse Docker official install.

This is what /var/discourse/scripts/ looks like:


Best regards

That’s right.

You’ll need to set up a development environment or follow instructions in other import topics about how you might run the import script inside of a production container.

Finally found How to use the bbpress import script - or any other import script with mysql dependency - developers - Discourse Meta for missing part.

Thanks

1 Like

@vinothkannans I’m trying to migrate from WPForo to Discourse and the script/code is beyond my capability. Would you (or anyone else) be able to help me with this? Thanks.

You might have better luck posting in marketplace. There are a number of people who monitor that category who can help.

2 Likes

Though we also have the migration category too for specific migration questions. :+1:

3 Likes

I’m getting the following error when I follow the guide and get to the point where I run the import script. I installed discourse as per these instructions

myuser@tmp-discourse:~/discourse$ IMPORT=1 bundle && IMPORT=1 bundle exec ruby script/import_scripts/bbpress.rb

[!] There was an error parsing `Gemfile`: You cannot specify the same gem twice with different version requirements.
You specified: sqlite3 (~> 1.3, >= 1.3.13) and sqlite3 (>= 0). Bundler cannot continue.

 #  from /home/myuser/discourse/Gemfile:251
 #  -------------------------------------------
 #  group :generic_import, optional: true do
 >    gem "sqlite3"
 #    gem "redcarpet"
 #  -------------------------------------------

I got it workingby changing this in the Gemfile

# NOTE: in import mode the version of sqlite can matter a lot, so we stick it to a specific one
#gem "sqlite3", "~> 1.3", ">= 1.3.13"
  gem "sqlite3"

I also needed to install this package in my Ubuntu 22.04 LTS install

sudo apt install freetds-dev