# Cloudflare R2: Navigeren door installatie en het omgaan met configuratiefouten

**URL:** https://meta.discourse.org/t/cloudflare-r2-navigating-setup-and-handling-configuration-errors/305617
**Category:** Self-hosting
**Tags:** s3
**Created:** [21 april 2024 om 21:13 UTC](https://meta.discourse.org/t/cloudflare-r2-navigating-setup-and-handling-configuration-errors/305617 "2024-04-21T21:13:01Z")
**Posts on this page:** 1
**Showing post:** 28

<div class="post-metadata">

### Author: ![kuaza](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kuaza/32/264151_2.png) [@kuaza](https://meta.discourse.org/u/kuaza)
#### Post date: [1 mei 2024 om 23:32 UTC](https://meta.discourse.org/t/cloudflare-r2-navigating-setup-and-handling-configuration-errors/305617/28 "2024-05-01T23:32:20Z")

</div>

When I apply this, it gives the following error and it does not load, the site cannot be reached:

```plaintext
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && sudo -E -u discourse bundle exec rake s3:upload_assets failed with return #<Process::Status: pid 4803 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "cmd"=>["sudo -E -u discourse bundle exec rake s3:upload_assets", "sudo -E -u discourse bundle exec rake s3:expire_missing_assets"]}
bootstrap failed with exit code 1
**FAILED TO BOOTSTRAP** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.

```

./discourse-doctor I ran this, then recompiled, got the same error.

When I enter the container and run the following codes, I get an error:

`rake uploads:migrate_to_s3`

Error:

```plaintext
rake uploads:migrate_to_s3 --trace
Plugin name is 'DiscourseMatheditor', but plugin directory is named 'discourse-matheditor'
Plugin name is 'discourse-post-voting', but plugin directory is named 'discourse-question-answer'
Plugin name is 'discourse-topic-voting', but plugin directory is named 'discourse-voting'
** Invoke uploads:migrate_to_s3 (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute uploads:migrate_to_s3
Please note that migrating to S3 is currently not reversible!
[CTRL+c] to cancel, [ENTER] to continue

Migrating uploads to S3 for 'default'...
Some uploads were not migrated to the new scheme. Running the migration, this may take a while...
rake aborted!
FileStore::ToS3MigrationError: Some uploads could not be migrated to the new scheme. You need to fix this manually. (FileStore::ToS3MigrationError)
/var/www/discourse/lib/file_store/to_s3_migration.rb:156:in `migrate_to_s3'
/var/www/discourse/lib/file_store/to_s3_migration.rb:59:in `migrate'
/var/www/discourse/lib/tasks/uploads.rake:126:in `migrate_to_s3'
/var/www/discourse/lib/tasks/uploads.rake:106:in `block in migrate_to_s3_all_sites'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rails_multisite-6.0.0/lib/rails_multisite/connection_management/null_instance.rb:49:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rails_multisite-6.0.0/lib/rails_multisite/connection_management/null_instance.rb:36:in `each_connection'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rails_multisite-6.0.0/lib/rails_multisite/connection_management.rb:21:in `each_connection'
/var/www/discourse/lib/tasks/uploads.rake:104:in `migrate_to_s3_all_sites'
/var/www/discourse/lib/tasks/uploads.rake:100:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `block in execute'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `each'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `execute'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:199:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:188:in `invoke'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:188:in `invoke_task'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:138:in `block (2 levels) in top_level'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:138:in `each'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:138:in `block in top_level'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:147:in `run_with_threads'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:132:in `top_level'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:83:in `block in run'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:214:in `standard_exception_handling'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:80:in `run'
bin/rake:13:in `<top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli.rb:451:in `exec'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli.rb:34:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli.rb:28:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/exe/bundle:28:in `block in <top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/exe/bundle:20:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Tasks: TOP => uploads:migrate_to_s3

```

Some similar unresolved issues:

> [@S3 error trying to run rake task](https://meta.discourse.org/t/s3-error-trying-to-run-rake-task/274520):
>
> I installed my Discourse, added my S3 creds and added the relevant S3 code into the hooks When rebuilding, I get this error: FAILED -------------------- Pups::ExecError: cd /var/www/discourse && sudo -E -u discourse bundle exec rake s3:upload\_assets failed with return #\<Process::Status: pid 1532 exit 1\> Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups/exec\_command.rb:117:in `spawn' exec failed with the params {"cd"=\>"$home", "cmd"=\>["sudo -E -u discourse bundle exec…

> [@How to debug S3 uploads](https://meta.discourse.org/t/how-to-debug-s3-uploads/213616):
>
> For a brief moment I had S3 uploads to a bucket working. Then I followed the several posts here to make sure it is all correct and now all uploads go local. I cant see any clues in the error log. How does one go about debugging this complex setup? One post suggests you have to do it with mostly environment variables, but the other does not, and the admin panel seems to have all the S3 parameters necessary. I am basically confused. I have double checked all the values for S3 in the system.

> [@Forum rendered unusable](https://meta.discourse.org/t/forum-rendered-unusable/277535/11):
>
> Mmm, I’d noted previously that someone else had talked about putting stuff in the wrong section, then I went ahead and did the same thing anyway, eek (!) So after reading more carefully, I still seem to have an issue, I have; hooks: after\_code: - exec: cd: $home/plugins cmd: - git clone https://github.com/discourse/docker\_manager.git - git clone https://github.com/discourse/discourse-whos-online - git clone https://github.com/discourse/discou…

> [@Defining DISCOURSE\_S3\_CDN\_URL links to assets in S3 CDN URL](https://meta.discourse.org/t/defining-discourse-s3-cdn-url-links-to-assets-in-s3-cdn-url/116798/42):
>
> What am I supposed to do with this? Edit files this way and then rebuild app ? I don’t understand.

---

_[View the full topic](https://meta.discourse.org/t/cloudflare-r2-navigating-setup-and-handling-configuration-errors/305617)._
