I’m trying to move my Discourse instance to a different server.
I tried using the restore option in the admin dashboard on the destination server but it kept failing with this error:
[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
The exact same app.yml configuration is used for both the existing Discourse instance, as well as the new server I’m trying to move to.
I could not get this to work at all, so I decided to try this guide here: Restore a backup from command line
I got the same error if I used the same app.yml configuration.
So I decided to comment out all of the S3 related stuff, and that seemed to do the trick:
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.
After the restore worked, I decided to uncomment out all of the S3 stuff and run ./launcher rebuild app
.
Then I tried going to my Discourse instance and I noticed that all of the uploads are missing (logo, profile pictures etc)
I then ran:
./launcher enter app
rake posts:rebake
(no errors, said it rebaked 60 something odd posts)
rake posts:rebake_uncooked_posts
(said it rebaked 0 posts)
Even with this, all uploads still aren’t working and return a 404 (or in the case of profile pictures, they show the default profile picture)
From the log above with the restore, it definitely seems like URLs were remapped since it thinks that S3 isn’t being used anymore, but is there a way that I can remap it again after the restore is complete, back to what it’s supposed to be?
Alternatively, is there a way to get it to work with the S3 settings in app.yml? I’m not sure why it’s insisting that the bucket does not exist.
For reference, this is what the S3 config in my app.yml looks like:
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
The bucket used for uploads on the existing Discourse instance and the new Discourse instance are the same, so I expected rebuilding to work and remap the URLs.
I’m not sure where I went wrong here, but I’m hoping someone can point me in the right direction.
Thanks