Nodebb إلى Discourse

أحتاج إلى بعض التوجيه بشأن الترحيل من NodeBB إلى Discourse. لقد رأيت هذا الموضوع ولاحظت أن @eatcodetravel هو من أنشأ السكريبت. أنا غير قادر على فهم كيفية تنفيذ هذه السكريبتات. هل أحتاج إلى تثبيت Redis على الخادم الذي يعمل عليه Discourse أيضًا من أجل الاستيراد؟

أقدر مساعدتكم.

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 إعجابات

شكرًا لك!

أنا أشغّل Discourse عبر Digital Ocean و Docker. قمت بتعديل الملف 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 إلى حاوية Docker الخاصة بـ Discourse في المسار /shared/redis_data.

هل لديك أي أفكار؟ :thinking:

تخمين عشوائي هنا. أعتقد أنه لا يقوم باستيراد ملف تفريغ ريديس.

أنا في حيرة من أمري. أنا جديد في 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 لكنه يبدو أنه يستمر في التشغيل بغض النظر عما أفعله. لقد قمت بقتل العملية عشرات المرات لكنها لا تزال تعمل. :مشوش:

عدتُ لمحاولة ذلك مرة أخرى. تظهر نفس الخطأ حتى الآن ويتضمن ما يلي:

\u003e FATAL: فشل المصادقة النظيرية لمستخدم “discourse” (PG::ConnectionBad)

هل يجب أن أعمل هذا داخل حاوية Docker؟ هذا ما كنت أفعله بصفتي root. جربت أيضًا بصفتي discourse مما أدى إلى:

\u003e FATAL: قاعدة البيانات “discourse_development” غير موجودة (ActiveRecord::NoDatabaseError)

لست متأكدًا مما قد أكون أفعله خطأ.

No, as per instructions you should:

3 إعجابات

هذا كل شيء. لم أكن على علم بأن Docker لا يمكن استخدامه على الإطلاق.

إعجاب واحد (1)