Mybb.rb imports nothing

I have 2 droplet on Digital Ocean. One for my main site. (Mybb) One for Discourse. I am working my Discourse droplet now.

I did these things:

Create droplet.
Install Discourse.
Create admin user, use install wizard.
Create database backup from the Mybb.
Install mysql server 5.7 for Discourse’s droplet.
Create database for Discourse’s droplet.
Transfer old database to new like that. (Discourse’s droplet)
mysql -uroot -p oldddb < newdb.sql
Check database, it’s ok. The operation is successful. The tables are transferred.

After, I followed the procedures @precessor mentioned:
cd /var/discourse/
./launcher enter app
apt-get update
apt-get install libmysqlclient-dev nano
gem install mysql2
su - discourse
cd /var/www/discourse/script/import_scripts
bundle install

nano mybb.rb
RAILS_ENV=production ruby mybb.rb

And I got the output I shared…

Perhaps you installed mysql on the machine and not in the container where discourse is running?

1 Like

Are you setting the DB variables as shell environment variables? Before running the script, you should run the export commands in your shell.

1 Like

Here is mybb.rb file. Are you talking about this?

I install like that. Should i install mysql 5.7 in the container with su - discourse command?

I’m still not able to solve the problem. I did install Discourse as the guide, twice. I tried again and again. I must be making a mistake somewhere but where?

It’s still not clear to me what you’re actually doing: where are you installing mysql? I installed MySQL inside the container not in the host (or droplet, as you call it). Here is what I do to import from mybb:

From the host (droplet) enter the container:

$ sudo -s
# cd /var/discourse/discourse_docker
# ./launcher enter app

install mysql and mysql gems in the container

# apt-get install   libmysqlclient-dev mc mysql-server -y

and once that’s done

 # gem install mysql2

Start mysql and import database

# service mysql start
# mysqladmin create mybb -p

Copy the database dump from the host (droplet) to the shared container volume in /var/discourse/discourse_docker/shared/standalone/log/var-log/ and from the container, import it:

# gunzip -c /var/log/$DUMPFILE.sql.gz | mysql -D mybb -p

change $DUMPFILE with whatever you called the sql dump from mybb.

Run the import scripts as discourse user

Still from inside the container, switch to user discourse

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

$ export DB_HOST="localhost"
$ export DB_PW="1234"
$ export DB_USER="root"
$ export DB_NAME="mybb"
$ export BASE="" #leave this empty unless your mybb forum was originally in a subdirectory 

Now you’re ready to run the script;

$ time RAILS_ENV=production ruby mybb.rb | tee ../../log/`date +%Y-%m-%d-%N`-import.log 

If you still can’t get the importer to run, make sure you provide us a full list of the steps you took and exactly what messages you get when things fail. And there is no reason to use embed screenshots of a terminal session: you can copy and paste text here, and format it nicely.

2 Likes

This topic was automatically closed after 2985 days. New replies are no longer allowed.