NodebbからDiscourseへ

NodeBB から Discourse への移行について、少しご教示ください。

このスレッドをご覧になり、@eatcodetravel さんがスクリプトを作成されたことを確認しました。しかし、これらのスクリプトがどのように実行されるのかが理解できておりません。インポートを行う際、Discourse が稼働しているサーバーにも Redis をインストールする必要があるのでしょうか?

ご支援いただけますと幸いです。

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

「いいね!」 6

ありがとうございます!

Digital Ocean と Docker を通じて Discourse を実行しています。コンテナ内で script/import_scripts/nodebb/nodebb.rb を編集し、ATTACHMENT_DIR を nodebb があるディレクトリに含めるように変更しました。また、nodebb のディレクトリもコンテナ内に配置しました。

Redis ダンプファイルについてはどうすればよいでしょうか?

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

「いいね!」 1

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.

「いいね!」 5

@eatcodetravel さん、@tehspaceg さん、ありがとうございます。

exec ruby script/import_scripts/nodebb/nodebb.rb を実行すると、以下のようなメッセージが表示されます。

データベースに接続できません。サイト設定を取得できません!(db:create を実行している場合は正常です)

dump.rdb を NodeBB サーバーから Discourse の Docker コンテナの /shared/redis_data へ移動させました。

何か手がかりはありますでしょうか?:thinking:

の推測ですが、おそらく Redis のダンプファイルをインポートしていないと思います。

行き詰まっています。Redis は初心者ですが、多くのことを学びましたが、最後のピースがわかりません。

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)

「いいね!」 2

Redisを停止しようとしましたが、何をしても実行し続けるようです。プロセスを十回も殺しましたが、それでもまだ動いています。:困惑:

再度挑戦してみます。同じエラーが引き続き表示され、以下が含まれています。

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

これは Docker コンテナ内で実行すべきでしょうか?私はこれまで root として実行してきました。また、discourse として実行すると以下のエラーになります。

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

何が間違っているのか分かりません。

No, as per instructions you should:

「いいね!」 3

それだけだった。Dockerが全く使えないとは知らなかった。

「いいね!」 1