Nodebb to Discourse


(Michael) #1

I need a bit of guidance on migrating from nodebb to Discourse. I saw this thread and saw that @eatcodetravel created the script. I’m failing to understand how these scripts are executed. Do I need to install Redis on the server that Discourse is running as well for the import?

Appreciate the help.


(Orlando Del Aguila) #2

Hey @MichaelT,

You need redis to run discourse. The nodebb importer is only available if you use redis as your nodebb database. Here is how I would do the migration.

  1. Setup a discourse environment (it can be your machine or an instance in the cloud)
  2. Change the nodebb importer configuration (take a look at the code, there’s comments on what you need to replace)
  3. Run the importer with bundle exec ruby script/import_scripts/nodebb/nodebb.rb from the discourse folder
  4. (Optional) make a backup of discourse and restore it where you need it

The importer will connect to your nodebb redis database and copy everything over discourse, the time it takes is related to the amount of data you have. Also, you need to wait for discourse to finish processing jobs before you do the backup, go to /sidekiq route as an admin and you will see the pending/completed jobs

Hope it helps


(Michael) #3

Thank you!

I have Discourse running via Digital Ocean + Docker. I edited script/import_scripts/nodebb/nodebb.rb within the container and edited ATTACHMENT_DIR to include the directory where I have nodebb. I put the nodebb directory inside the container as well.

What about the Redis dump file?


(Orlando Del Aguila) #4

Oh I see there’s no comment in the redis connection parameters, I’ll open a PR for that

Here’s where you put the connection parameters for nodebb redis discourse/nodebb.rb at master · discourse/discourse · GitHub


(Geran Smith) #5

Here are the quick steps I took when I first ran the importer when it was under development. I can also attest to it working wonderfully.

  • Setup a dev environment of Discourse per Beginners Guide to Install Discourse on Ubuntu for Development
  • Stopped redis
  • Copied the dump.rdb file from NodeBB and overwrote the redis dump file that exists
  • Copied the uploads directory from NodeBB to the dev box
  • Edited the nodebb.rb file to point to the copied uploads directory
  • Ran the importer bundle exec ruby script/import_scripts/nodebb/nodebb.rb

I do recommend taking a look at Preparing for and undertaking a platform migration, it has some great steps for validation and planning a migration.


(Michael) #6

Thanks @eatcodetravel and @tehspaceg

After running exec ruby script/import_scripts/nodebb/nodebb.rb I get the follow:

No connection to db, unable to retrieve site settings! (normal when running db:create)

I moved dump.rdb from the NodeBB server to my Discourse Docker container in /shared/redis_data.

Any ideas? :thinking:


(Michael) #7

A wild guess here. I think it’s not importing the redis dump file.


(Michael) #8

I’m stumped. I’m new to Redis and certainly learned a lot but can’t figure out this last piece of the puzzle.


(Geran Smith) #9

I neglected to write down the actual paths to files, I just had those notes from when I did it.

Are you using a dev environment outside of the Docker image? it might make it easier ensure redis is stopped when you replace the dump.rdb file.

Edit: I wrote this before finishing coffee. So the reason I suggest that you need to have redis stopped is that I don’t think it will read from the dump file until after it has been stopped (redis stores the database in memory and periodically writes to the dump.rdb file)


(Michael) #10

I’ve tried to stop Redis but it seems to continue to run no matter what I do. I’ve killed the process a dozen times but it still runs. :confused:


(Michael) #11

I’m back to trying this again. The same error comes up still and includes this

FATAL: Peer authentication failed for user “discourse” (PG::ConnectionBad)

Should I be running this within the Docker container? That’s what I’ve been doing as root. I’ve also tried as `discourse which results in

FATAL: database “discourse_development” does not exist (ActiveRecord::NoDatabaseError)

Not sure what I could be doing wrong.


(Rafael dos Santos Silva) #12

No, as per instructions you should:


(Michael) #13

That was it. I wasn’t aware that Docker couldn’t be used at all.