# Nodebb to Discourse

**URL:** https://meta.discourse.org/t/nodebb-to-discourse/101423
**Category:** Migration
**Created:** [November 6, 2018, 2:46pm UTC](https://meta.discourse.org/t/nodebb-to-discourse/101423 "2018-11-06T14:46:34Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![michael](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michael/32/487694_2.png) [@michael](https://meta.discourse.org/u/michael)
#### Post date: [November 6, 2018, 2:46pm UTC](https://meta.discourse.org/t/nodebb-to-discourse/101423/1 "2018-11-06T14:46:34Z")

</div>

I need a bit of guidance on migrating from nodebb to Discourse. I saw [this thread](https://meta.discourse.org/t/complete-paid-migration-script-from-nodebb-redis-to-discourse/85749/20) 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.

---

<div class="post-metadata">

### Author: ![eatcodetravel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eatcodetravel/32/94385_2.png) [@eatcodetravel](https://meta.discourse.org/u/eatcodetravel)
#### Post date: [November 6, 2018, 3:29pm UTC](https://meta.discourse.org/t/nodebb-to-discourse/101423/2 "2018-11-06T15:29:13Z")

</div>

Hey @michael,

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

---

<div class="post-metadata">

### Author: ![michael](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michael/32/487694_2.png) [@michael](https://meta.discourse.org/u/michael)
#### Post date: [November 6, 2018, 4:02pm UTC](https://meta.discourse.org/t/nodebb-to-discourse/101423/3 "2018-11-06T16:02:16Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![eatcodetravel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eatcodetravel/32/94385_2.png) [@eatcodetravel](https://meta.discourse.org/u/eatcodetravel)
#### Post date: [November 6, 2018, 4:24pm UTC](https://meta.discourse.org/t/nodebb-to-discourse/101423/4 "2018-11-06T16:24:32Z")

</div>

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/script/import\_scripts/nodebb/nodebb.rb at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/master/script/import_scripts/nodebb/nodebb.rb#L15)

---

<div class="post-metadata">

### Author: ![tehspaceg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tehspaceg/32/119558_2.png) [@tehspaceg](https://meta.discourse.org/u/tehspaceg)
#### Post date: [November 6, 2018, 6:30pm UTC](https://meta.discourse.org/t/nodebb-to-discourse/101423/5 "2018-11-06T18:30:05Z")

</div>

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](https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-ubuntu-for-development/14727)
- 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](https://meta.discourse.org/t/preparing-for-and-undertaking-a-platform-migration/83824), it has some great steps for validation and planning a migration.

---

<div class="post-metadata">

### Author: ![michael](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michael/32/487694_2.png) [@michael](https://meta.discourse.org/u/michael)
#### Post date: [November 6, 2018, 8:09pm UTC](https://meta.discourse.org/t/nodebb-to-discourse/101423/6 "2018-11-06T20:09:43Z")

</div>

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? 🤔

---

<div class="post-metadata">

### Author: ![michael](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michael/32/487694_2.png) [@michael](https://meta.discourse.org/u/michael)
#### Post date: [November 7, 2018, 9:08am UTC](https://meta.discourse.org/t/nodebb-to-discourse/101423/7 "2018-11-07T09:08:17Z")

</div>

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

---

<div class="post-metadata">

### Author: ![michael](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michael/32/487694_2.png) [@michael](https://meta.discourse.org/u/michael)
#### Post date: [November 8, 2018, 12:28pm UTC](https://meta.discourse.org/t/nodebb-to-discourse/101423/8 "2018-11-08T12:28:04Z")

</div>

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

---

<div class="post-metadata">

### Author: ![tehspaceg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tehspaceg/32/119558_2.png) [@tehspaceg](https://meta.discourse.org/u/tehspaceg)
#### Post date: [November 8, 2018, 4:58pm UTC](https://meta.discourse.org/t/nodebb-to-discourse/101423/9 "2018-11-08T16:58:27Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![michael](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michael/32/487694_2.png) [@michael](https://meta.discourse.org/u/michael)
#### Post date: [November 9, 2018, 8:41am UTC](https://meta.discourse.org/t/nodebb-to-discourse/101423/10 "2018-11-09T08:41:42Z")

</div>

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. 😕

---

<div class="post-metadata">

### Author: ![michael](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michael/32/487694_2.png) [@michael](https://meta.discourse.org/u/michael)
#### Post date: [November 14, 2018, 1:56pm UTC](https://meta.discourse.org/t/nodebb-to-discourse/101423/11 "2018-11-14T13:56:20Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [November 14, 2018, 2:02pm UTC](https://meta.discourse.org/t/nodebb-to-discourse/101423/12 "2018-11-14T14:02:53Z")

</div>

> [@michael](#):
>
> Should I be running this within the Docker container?

No, as per instructions you should:

> [@tehspaceg](#):
>
> Setup a dev environment of Discourse per [Beginners Guide to Install Discourse on Ubuntu for Development](https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-ubuntu-for-development/14727)

---

<div class="post-metadata">

### Author: ![michael](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michael/32/487694_2.png) [@michael](https://meta.discourse.org/u/michael)
#### Post date: [November 14, 2018, 4:15pm UTC](https://meta.discourse.org/t/nodebb-to-discourse/101423/13 "2018-11-14T16:15:07Z")

</div>

That was it. I wasn’t aware that Docker couldn’t be used _at all_.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [September 4, 2021, 5:19am UTC](https://meta.discourse.org/t/nodebb-to-discourse/101423/14 "2021-09-04T05:19:49Z")

</div>


