復元後にアップロードが見つかりません

Discourse インスタンスを別のサーバーに移行しようとしています。

移行先のサーバーで管理ダッシュボードの復元オプションを使用しましたが、このエラーで失敗し続けました。

[2022-04-23 21:59:00] Remapping uploads...
[2022-04-23 21:59:00] Restoring uploads, this may take a while...
[2022-04-23 21:59:00] EXCEPTION: Aws::S3::Errors::NoSuchBucket

既存の Discourse インスタンスと移行先の新しいサーバーで、まったく同じ app.yml 設定が使用されています。

これをまったく機能させることができなかったため、こちらのガイドを試すことにしました: Restore a backup from the command line

同じ app.yml 設定を使用しても、同じエラーが発生しました。

そこで、S3 関連のすべてのものをコメントアウトしたところ、うまくいったようです。

Reconnecting to the database...
Reloading site settings...
Disabling outgoing emails for non-staff users...
Disabling readonly mode...
Clearing category cache...
Reloading translations...
Remapping uploads...
Remapping '//bucket.nyc3.digitaloceanspaces.com/' to '/uploads/default/'
optimized_images=480
uploads=35
user_histories=13
Remapping 'https://cdnurl.com/' to 'https://forumurl.com/uploads/default/'
post_revisions=2
posts=4
topic_links=4
Remapping 'cdnurl.com' to 'forumurl.com'
topic_links=4
Restoring uploads, this may take a while...
Posts will be rebaked by a background job in sidekiq. You will see missing images until that has completed.
You can expedite the process by manually running "rake posts:rebake_uncooked_posts"
Clearing emoji cache...
Clear theme cache
Executing the after_restore_hook...
Cleaning stuff up...
Dropping functions from the discourse_functions schema...
Removing tmp '/var/www/discourse/tmp/restores/default/2022-04-23-234852' directory...
Unpausing sidekiq...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[SUCCESS]
Restore done.

復元が成功した後、S3 のすべてのコメントアウトを解除し、./launcher rebuild app を実行しました。

その後、Discourse インスタンスにアクセスしようとしましたが、すべてのアップロード(ロゴ、プロフィール写真など)が失われていることに気づきました。

その後、以下を実行しました。

./launcher enter app

rake posts:rebake (エラーなし、60件以上の投稿をリベイクしたと表示されました)

rake posts:rebake_uncooked_posts (0件の投稿をリベイクしたと表示されました)

これでも、すべてのアップロードは引き続き機能せず、404 エラーが返されます(プロフィール写真の場合は、デフォルトのプロフィール写真が表示されます)。

上記のログから、復元時に URL がリマップされたことは明らかです。S3 がもはや使用されていないと考えているようですが、復元完了後に S3 に再度リマップする方法はありますか?

あるいは、app.yml の S3 設定で機能させる方法はありますか? バケットが存在しないと主張する理由がわかりません。

参考までに、app.yml の S3 設定は次のとおりです。

  DISCOURSE_USE_S3: true
  DISCOURSE_S3_REGION: nyc3
  DISCOURSE_S3_ENDPOINT: https://nyc3.digitaloceanspaces.com
  DISCOURSE_S3_ACCESS_KEY_ID: KEY
  DISCOURSE_S3_SECRET_ACCESS_KEY: ACCESS_KEY
  DISCOURSE_S3_CDN_URL: https://forumcdn.com
  DISCOURSE_S3_BUCKET: upload-bucket
  DISCOURSE_S3_BACKUP_BUCKET: backup-bucket
  DISCOURSE_BACKUP_LOCATION: s3

既存の Discourse インスタンスと新しい Discourse インスタンスで使用されているバケットは同じなので、再構築によって URL がリマップされることを期待していました。

どこで間違ったのかわかりませんが、誰かが正しい方向を示してくれることを願っています。

よろしくお願いします。

私の経験上、うまくいくのはS3を無効化し、バックアップ、リストアしてから再度S3を有効化することです。

「いいね!」 2

ダッシュボードではS3へのアップロードが無効になっているようですが、S3へのアップロードは正常に機能しています。

これは、app.ymlで無効にしてから./launcher rebuild appを実行し、その後バックアップと復元を行う必要があるということでしょうか?

よろしくお願いします。

/var/discourse フォルダをコピーして再構築することで解決しました。

組み込みのバックアップ/復元が機能すればよかったのですが、セルフホストを選択した以上、仕方ないですね :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.