# Rake uploads:migrate\_to\_s3 runs forever

**URL:** <https://meta.discourse.org/t/rake-uploads-migrate-to-s3-runs-forever/147245>\
**Category:** Self-hosting\
**Tags:** s3\
**Created:** [April 8, 2020, 10:45am UTC](https://meta.discourse.org/t/rake-uploads-migrate-to-s3-runs-forever/147245 "2020-04-08T10:45:11Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [April 8, 2020, 6:27pm UTC](https://meta.discourse.org/t/rake-uploads-migrate-to-s3-runs-forever/147245/2 "2020-04-08T18:27:47Z")

</div>

I can confirm this.

I built a new image with `DISCOURSE_S3_XXX` variables set to enable S3 uploads when the original database was migrated. I would think that this would put all images on S3 from the get-go, but, alas, restoring that backup fails when it tries to migrate to S3.

I then tried to `rake uploads:migrate_to_s3` (with all ENV set in the command line before it) and get the infinite loop described in the OP.

I then tried doing a command line restore with all of the `DISCOURSE_S3` settings in the command line.

I thought that maybe then I could do a backup and restore, but no. Restore from the web interface fails. Restore from the command line, without passing all of the S3 parameters also fails.

So, it appears that if you want to restore a backup that has uploads in S3, you need to do it from the command line **and** pass the S3 settings on the command line with the restore.

Not being able to restore a backup that has S3 uploads from the UX seems like a bug.

---

_[View the full topic](https://meta.discourse.org/t/rake-uploads-migrate-to-s3-runs-forever/147245)._
