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=

出力は以下のようになります:

Starting export of =Export=…

Where are the new users all coming from?
Export saved to =Export=-export-2021-08-27-015437.json

Done

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

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

‘外側’ へのコピー

まだ行っていない場合はコンテナから退出します

exit

以下のようなプロンプトが表示されます:

root@yourserver:/var/discourse

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

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

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

これはこのガイドの範囲を超えていますが、以下が役立つかもしれません:

受信インスタンスのコンテナ内へのコピー

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

cd /var/discourse
```\ndocker を再度使用してファイルを他のコンテナにコピーします

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


## コンテンツのインポート
受信インスタンスのコンテナ内に入ります:

./launcher enter app

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

discourse import_=Export= =FileName=

:cake: 完了!

いくつかの未解決の事項を片付ける必要があるかもしれませんが、おそらくすべて完了しているはずです。

## 高度なヒント
### 欠落している 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=

バグは #contribute:bug カテゴリで報告し、機能強化リクエストは #contribute:feature カテゴリでお願いします。

--- 
### 関連トピック
https://meta.discourse.org/t/how-to-merge-two-discourse-sites/95435

---
*Last Reviewed by @SaraDev on [date=2022-07-12 time=17:00:00 timezone="America/Los_Angeles"]*

<div data-theme-toc="true"> </div>
「いいね!」 45
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
Error Importing Categories from a Discourse Instance to Another
How to export user data from a category on a hosted site
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
I wonder how to add hundreds of users into a group? Is there any api?
Adding default sets of topics, categories and users to a new Discourse
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?
Transfering inbox group messages to another instance?
Imported categories are not in parent category
Copy categories / topics
How to download Comments and Topics
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