Discourseインスタンス間でのカテゴリインポートエラー

こんにちは、Discourseチーム!

ステージング環境から本番環境にカテゴリをエクスポートしようとした際にエラーが発生しました。コンテキストとして、ステージングには公開したいトピックが多数ありますが、コピー&ペーストでは時間がかかります。

こちらのチュートリアルに基づいて discourse import_category category-export-2022-02-14-042606.json を実行した際に発生したエラーは以下の通りです。

Starting import from category-export-2022-02-14-042606.json...
Importing users...
Importing groups...
bundler: failed to load command: script/discourse (script/discourse)
Traceback (most recent call last):
    42: from /usr/local/bin/bundle:25:in `<main>'
    41: from /usr/local/bin/bundle:25:in `load'
    40: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/exe/bundle:36:in `<top (required)>'
    39: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
    38: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/exe/bundle:48:in `block in <top (required)>'
    37: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/cli.rb:25:in `start'
    36: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
    35: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/cli.rb:31:in `dispatch'
    34: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
    33: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
    32: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
    31: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/cli.rb:484:in `exec'
    30: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/cli/exec.rb:23:in `run'
    29: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/cli/exec.rb:58:in `kernel_load'
    28: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.4/lib/bundler/cli/exec.rb:58:in `load'
    27: from script/discourse:290:in `<top (required)>'
    26: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
    25: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    24: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
    23: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
    22: from script/discourse:243:in `import_category'
    21: from /var/www/discourse/lib/import_export.rb:15:in `import'
    20: from /var/www/discourse/lib/import_export/importer.rb:25:in `perform'
    19: from /var/www/discourse/lib/import_export/importer.rb:61:in `import_groups'
    18: from /var/www/discourse/lib/import_export/importer.rb:61:in `each'
    17: from /var/www/discourse/lib/import_export/importer.rb:65:in `block in import_groups'
    16: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/persistence.rb:55:in `create!'
    15: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/suppressor.rb:48:in `save!'
    14: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/transactions.rb:302:in `save!'
    13: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/transactions.rb:350:in `with_transaction_returning_status'
    12: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `transaction'
    11: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
    10: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
     9: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
     8: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
     7: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
     6: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
     5: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
     4: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
     3: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/transactions.rb:354:in `block in with_transaction_returning_status'
     2: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/transactions.rb:302:in `block in save!'
     1: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/validations.rb:53:in `save!'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/validations.rb:80:in `raise_validation_error': Validation failed: You cannot allow membership requests for a group without any owners. (ActiveRecord::RecordInvalid)

カテゴリのみをエクスポートしたいのですが、グループについて何が問題になっているのか分かりません。

何か助けていただけると大変助かります!

Cheers,
Tim

この問題を経験したことがある人が他にいないか、ただ確認のために上げます。

スクリプトはすべてをインポートしようとしていると思います。

JSONからグループを編集するか、スクリプトを変更してグループをスキップできるかどうかを確認できます。

Hi @pfaffman

ご返信ありがとうございます!

「すべて」とはどういう意味でしょうか?それを試してみて、JSONからグループを編集します。チュートリアルはカテゴリ/トピック専用だと思っていたので、それ以上のものは期待していませんでした。

テストしたら報告します!

それは危険な兆候です。ユーザーなしではトピックを作成できません。そして、それは延々と続きます。