別のDiscourseインスタンスへトピックを移動する

別のDiscourseインスタンスに何かを移行する必要がありますか?

トピック、一連のトピック、またはカテゴリ全体をエクスポートするためのコマンドラインツールと、反対側でそれらをインポートするための別のツールがあります。

トピックのエクスポート/インポート

  • 1つ以上のトピックとその返信
  • トピックに投稿したユーザー

カテゴリのエクスポート/インポート

  • カテゴリとそのすべてのサブカテゴリ
  • そのセキュリティ設定
  • セキュリティ設定で言及されているカスタムグループ
    • :warning: グループのいずれかで「メンバーシップリクエスト」が有効になっている場合、クラッシュします。エクスポートのにこれをオフにしてください
  • カテゴリおよびサブカテゴリ内のすべてのトピックと投稿
  • 投稿したすべてのユーザー、およびそれらをグループに割り当てます

開始: IDの特定

まず、エクスポートしたい=Export=のIDを特定します。これは、アクセスに使用したURLの末尾にあります。

  • https://meta.discourse.org/t/how-to-contribute-to-discourse/53797

  • https://meta.discourse.org/t/how-to-contribute-to-discourse/53797/12
    (この場合、トピックの途中にいます - 最初の数字を取得します)

  • https://meta.discourse.org/c/howto/faq/4

カテゴリまたはトピックID

複数のトピック

スペースで区切られたIDを追加することで、複数のトピックを選択できます。これは上記のフィールドで機能します(カテゴリでは機能しないと思います)。

  • 53797 200943 124096

エクスポートスクリプトの実行

このツールは、コンテナ内でrootユーザーとして実行できます。

cd /var/discourse
./launcher enter app

次のコマンドを実行します。

discourse export_=Export= =ID=

出力は次のようなものになるはずです。

=Export=のエクスポートを開始しています…

新しいユーザーはどこから来ているのですか?
エクスポートは =Export=-export-2021-08-27-015437.json に保存されました

完了

エクスポートしたファイルの移動

エクスポートされた.jsonファイルを、エクスポートを実行したアプリケーションコンテナの内部から、受信側のインスタンスのコンテナの内部に移動する必要があります。これにはいくつかの手順が必要です。

「外部」へのコピー

まだ行っていない場合は、コンテナを終了します

exit

次のようなプロンプトが表示されるはずです。

root@yourserver:/var/discourse

dockerを使用してファイルをコンテナの外にコピーします(移動はできないと思います)。

docker cp app:/var/www/discourse/=FileName= .

他のインスタンスへの移動

これはこのガイドの範囲外ですが、そこに至るのに役立つかもしれません。

受信インスタンスのコンテナ内にファイルをコピー

rootとして受信インスタンスにSSHで接続し、Discourseディレクトリに移動します。

cd /var/discourse

dockerをもう一度使用して、ファイルを別のコンテナにコピーします。

docker cp =FileName= app:/var/www/discourse

コンテンツのインポート

受信インスタンスでコンテナに入ります。

./launcher enter app

インポートスクリプトを実行します

discourse import_=Export= =FileName=

:cake: 完了!

いくつかの残りの作業を整理する必要があるかもしれませんが、うまくいけばすべて完了しているはずです。

上級TIPS

欠落しているRuby Gem

複雑なカテゴリインポートを実行すると、インスタンスで ‘Listen’ Rubyが不足していました。
これは、次を実行することで解決されました(コンテナ内のDiscourseユーザーを使用)。

./launcher enter app
su discourse
bundle config --delete without
bundle config --delete with
bundle install
exit
exit

これによりrailsコンソールが壊れたため、その後再構築が必要になりました。

./launcher rebuild app

マルチサイト

マルチサイト環境では、RAILS_DB環境変数を使用します。

RAILS_DB=xxxmoves discourse export_=Export= =ID=
RAILS_DB=dancerehab discourse import_=Export= =FileName=

バグは#bugカテゴリに報告し、機能強化は#featureカテゴリにリクエストしてください。


関連記事


最終確認者 @SaraDev 2022-07-13T00:00:00Z

\u003cdiv data-theme-toc=“true”\u003e \u003c/div\u003e

「いいね!」 44
UI: Topic and Category Export/Import
CLI command to migrate a single category
Moving topics between sites?
Category/Topic export fails with error "database "discourse_development" does not exist"
Easiest way to export a single topic?
Saving a Conversation
Migrate user custom fields to another instance
How to export user data from a category on a hosted site
Error Importing Categories from a Discourse Instance to Another
Import CSV User Activity from one Discourse to Another
How use API to convert topic in discourse1.com to discourse2.com
Can sub-forums of the same instance split up and move to new independent servers (or discourse instances)?
Help migrating category from one instance to another without admin on the source instance
Adding default sets of topics, categories and users to a new Discourse
How to download Comments and Topics
Downloading Content
Can we combine 2 separate discourse sites?
Tracking and resolving a schema drift cause
Merge two Discourse forums into one
Moving topics from a forum on one website to a forum on another website
Transfer topics between forums?
Forum Aquisition
Transfering inbox group messages to another instance?
Imported categories are not in parent category
I wonder how to add hundreds of users into a group? Is there any api?
Selective backups skipping settings and config
Test driving admin/moderation features
Add backup to existing Discourse instance
Merging two Discourse forums
Migrating vBulletin onto existing and live Discourse instance
Migrate topics from one discourse instance to another?
A system where people have to start at lesson 1, and cannot see the other lessons?
How to divide my community into 2 parts