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 오류를 반환합니다(프로필 사진의 경우 기본 프로필 사진이 표시됩니다).
위의 복구 로그를 보면 S3가 더 이상 사용되지 않는다고 판단하여 URL이 다시 매핑된 것으로 분명해 보입니다. 하지만 복구 완료 후 URL을 원래대로 다시 매핑하는 방법이 있을까요?
대안으로, 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이 다시 매핑되어 작동할 것으로 기대했습니다.
어디서 실수를 했는지 모르겠지만, 올바른 방향으로 안내해 주시면 감사하겠습니다.
감사합니다
