Can't start PHPBB3 Importer


#1

Hi there! I’m having some trouble with the guides, here’s my dilemma:

So, here it says:

Usage:
Edit the bbpress3.rb file to change the MySQL connection info (PHPBB_DB, and Mysql2::Client.new(…)) so it connects to a local copy of the phpBB database.

Ok, done. It’s a remote copy, but it doesn’t matter. After a few other passages we can read:

Run the import, from the discourse project directory:
ruby script/import_scripts/phpbb3.rb bbcode-to-md

This doesn’t seem to work. The shell says:

Usage of PHPBB3 Importer:
bundle exec ruby phpbb3.rb path/to/settings.yml

So, I think I’m missing something. There’s an example settings file in script/import_scripts/phpbb3/settings.yml, so I need to edit that one too? What about the bbcode-to-md conversion?

I was thinking about a ruby script/import_scripts/phpbb3.rb path/to/settings.yml bbcode-to-md, but would that work? What does the guide mean then?

If it can help, I’m using the docker installation.


(Gerhard Schlager) #2

Please follow the instructions in

The other one is quite old and doesn’t work anymore.
@codinghorror Can we hide the old topic?


#3

Oh, ok, thanks for the quick reply!

I’m still having issues though. I’m following those instructions and I managed to do everything until the last step. When i run ruby phpbb3.rb phpbb3/settings.yml I get this error:

/usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in ‘require’: cannot load such file – ruby-bbcode-to-md (LoadError)

from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in 'require’
from phpbb3.rb:21:in 'module:PhpBB3’
from phpbb3.rb:12:in 'module:ImportScripts’
from phpbb3.rb:11:in ‘main’

Maybe I did something wrong when installing the dependencies?

EDIT: Yes I did. Solved with this. Thanks!


(Gerhard Schlager) #4

Oh, I see you figured it out yourself. :thumbsup:

The Howto is wrong. I’ll update it. I didn’t test it with ruby-bbcode-to-md lately…


(Neil Lalonde) #5

I added a note to my old topic that redirects people to @gerhard’s latest and greatest howto doc.


#6

Sorry if I keep bothering but I just cannot get this to work.

So, looks like I can establish a connection to the remote database, I have edited the settings.yml, but when I run the import script I get this error:

var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb:655:in ‘initialize’: FATAL: Peer authentication failed for user “discourse”. (PG::ConnectionBad)

I browsed the Internet but I cannot find a workaround.


(Gerhard Schlager) #7

Are you still trying to import within the Docker container or did you follow the Howto and are doing this in a development environment? If you are using the latter, did you replace the username discourse with your system username?


#8

I’m still trying to import within the Docker container. Sorry for the late reply but I tried to figure things out by myself but I can’t seem to succeed.


(Gerhard Schlager) #9

This is untested, but something like this should work.

Enter the Discourse Docker container

/var/discourse/launcher enter app

and execute this:

apt-get update
apt-get install libmysqlclient-dev nano -y

git clone https://github.com/nlalonde/ruby-bbcode-to-md.git /tmp/ruby-bbcode-to-md
cd /tmp/ruby-bbcode-to-md
gem build ruby-bbcode-to-md.gemspec
gem install ruby-bbcode-to-md-*.gem

echo "gem 'mysql2'" >> /var/www/discourse/Gemfile
echo "gem 'ruby-bbcode-to-md', path: '/tmp/ruby-bbcode-to-md'" >> /var/www/discourse/Gemfile

cd /var/www/discourse
bundle install --no-deployment --path vendor/bundle

su - discourse
cd /var/www/discourse/script/import_scripts

nano phpbb3/settings.yml
RAILS_ENV=production bundle exec ruby phpbb3.rb phpbb3/settings.yml

#10

Well this actually worked and started the Importer! :slight_smile: Thanks.

However, when it arrives at “Creating Users” it aborts with a 4k+ lines long error (I can’t even display its beginning by scrolling).

At the end it says

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries. Bug reports are welcome.

Aborted (Core dumped)

While I think this is a standard message, maybe it could help you.


Core dump when running the MyBB import script
(Gerhard Schlager) #11

That’s a known problem. The fix for it is still waiting to get merged.
https://github.com/discourse/discourse/pull/3823

@neil This error comes up quite often lately. Could you please merge my PRs for the phpBB3 importer? It can’t get worse than it is now. :wink:


(Neil Lalonde) #12

Merged! Thanks for the fixes @gerhard.


#13

Thanks for the fix and the merge! :smile:

So, I updated Discourse and the Importer actually started (w00t!). When importing avatars I get this error:

creating users
1/11830 (0.0%) /var/www/discourse/script/import_scripts/phpbb3/importers/avatar_importer.rb:27:in ‘import_avatar’: undefined method ‘persisted?’ for nil:NilClass (NoMethodError)

However, if I set all avatar flags to false in settings.yml this error doesn’t occur; I can live without avatars, so this is not a problem for me (but maybe it could be a bug that you may want to fix?). Without importing avatars the import actually starts but it gets stuck at 1000 users. I think it’s a hosting provider limitation (I think it’s 1000 queries/min or so), this means I can’t use the online database and have to setup my own. Ok.

I created a MySql DB outside the Docker container, created a user with all privileges and imported the db dump. Fine. I replaced the settings.yml data with the new ones, If I set localhost as host, I get this error:

Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2) (Mysql2::Error)

If I set 127.0.0.1 as host, I get

Can’t connect to MySQL server on ‘127.0.0.1’ (111) (Mysql2::Error)

I tried with this solution but it’s for the old script and it doesn’t work anymore (or I’m missing some passages). I reverted every modified file to the original version after this last failure.


(Gerhard Schlager) #14

Did you copy all files and images from your phpBB into the Docker container and set the phpbb_base_dir in the settings.yml accordingly? I’m quite sure you didn’t…

How about this one? It’s the first result in my Google search…

My suggestion, if you still can’t get it to work: Try to exactly follow the Howto by installing a development environment or wait until I finish my Docker based importer.


(Neil Lalonde) #15

Or setup MySQL inside the docker container. That’s what I always do. :blush:


#16

I solved by exposing the db to the internet and accessing it from the public IP. Gross, I know, but it worked.

Thank you all for the support.


(bluej100) #17

This worked! Thanks so much. And heh, yup, I also exposed my db to the internet.