S3 uploads migrations to DigitalOcean S3 Spaces fails

Information

  • Installed Discourse 2.5.0.beta2 [ 8b2e7483b2 ]
  • Default installation on Digital Ocean droplet
  • Fresh ./launcher/app rebuild (just befor starting the process)

Issues

script/discourse not working

This doesn’t allow me

root@clubcorsavenezuela-app:/var/www/discourse# script/discourse
Traceback (most recent call last):
        2: from script/discourse:4:in `<main>'
        1: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- thor (LoadError)

rake uploads:migrate_to_s3 not working

Command used

I first ran the following command as a test

DISCOURSE_S3_ACCESS_KEY_ID="*****redacted****" \
DISCOURSE_S3_SECRET_ACCESS_KEY="*****redacted****" \
DISCOURSE_S3_REGION="us-east-1" \
DISCOURSE_S3_BUCKET="clubcorsavenezuela" \
DISCOURSE_S3_CDN_URL="https://cdn.clubcorsavenezuela.com" \
DRY_RUN=1 rake uploads:migrate_to_s3

Issue

Updating the URLs in the database...
REPLACING '/uploads/default/original/' WITH '//clubcorsavenezuela.nyc3.digitaloceanspaces.com/uploads/original/'
REPLACING 'src="/uploads/default/original/(\dX/(?:[a-f0-9]/)*[a-f0-9]{40}[a-z0-9\.]*)' WITH 'src="//clubcorsavenezuela.nyc3.digitaloceanspaces.com/uploads/original/\1'
REPLACING 'src='/uploads/default/original/(\dX/(?:[a-f0-9]/)*[a-f0-9]{40}[a-z0-9\.]*)' WITH 'src='//clubcorsavenezuela.nyc3.digitaloceanspaces.com/uploads/original/\1'
REPLACING 'href="/uploads/default/original/(\dX/(?:[a-f0-9]/)*[a-f0-9]{40}[a-z0-9\.]*)' WITH 'href="//clubcorsavenezuela.nyc3.digitaloceanspaces.com/uploads/original/\1'
REPLACING 'href='/uploads/default/original/(\dX/(?:[a-f0-9]/)*[a-f0-9]{40}[a-z0-9\.]*)' WITH 'href='//clubcorsavenezuela.nyc3.digitaloceanspaces.com/uploads/original/\1'
REPLACING '\[img\]/uploads/default/original/(\dX/(?:[a-f0-9]/)*[a-f0-9]{40}[a-z0-9\.]*)\[/img\]' WITH '[img]//clubcorsavenezuela.nyc3.digitaloceanspaces.com/uploads/original/\1[/img]'
REMAPPING 'https://clubcorsavenezuela.com/uploads/default/original/' TO 'https://cdn.clubcorsavenezuela.com/original/'
rake aborted!
FileStore::ToS3MigrationError: 2264 of 2271 uploads are not migrated to S3. S3 migration failed for db 'default'.
/var/www/discourse/lib/file_store/to_s3_migration.rb:129:in `raise_or_log'
/var/www/discourse/lib/file_store/to_s3_migration.rb:76:in `migration_successful?'
/var/www/discourse/lib/file_store/to_s3_migration.rb:349:in `migrate_to_s3'
/var/www/discourse/lib/file_store/to_s3_migration.rb:63:in `migrate'
/var/www/discourse/lib/tasks/uploads.rake:239:in `migrate_to_s3'
/var/www/discourse/lib/tasks/uploads.rake:218:in `block in migrate_to_s3_all_sites'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rails_multisite-2.1.1/lib/rails_multisite/connection_management.rb:64:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rails_multisite-2.1.1/lib/rails_multisite/connection_management.rb:74:in `each_connection'
/var/www/discourse/lib/tasks/uploads.rake:216:in `migrate_to_s3_all_sites'
/var/www/discourse/lib/tasks/uploads.rake:212:in `block in <top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => uploads:migrate_to_s3
(See full trace by running task with --trace)

This happens exactly the same with DRY_RUN=0