# Migrate to minio

**URL:** https://meta.discourse.org/t/migrate-to-minio/111830
**Category:** Bug
**Created:** [March 17, 2019, 10:06am UTC](https://meta.discourse.org/t/migrate-to-minio/111830 "2019-03-17T10:06:21Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![zh99998](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zh99998/32/100179_2.png) [@zh99998](https://meta.discourse.org/u/zh99998)
#### Post date: [March 17, 2019, 10:06am UTC](https://meta.discourse.org/t/migrate-to-minio/111830/1 "2019-03-17T10:06:21Z")

</div>

I configured minio as image upload storage, it works well for new uploads, but I can’t migrate olds into that.

```plaintext
root@9c9267547230:/var/www/discourse# rake uploads:migrate_to_s3
Migrating uploads to S3 for 'default'...
Some uploads were not migrated to the new scheme. Please run these commands in the rails console

SiteSetting.migrate_to_new_scheme = true
Jobs::MigrateUploadScheme.new.execute(nil)

```

when I execute `Jobs::MigrateUploadScheme.new.execute(nil)` first time, it takes several hours and returned some exception, but seems finally success.

 ![image](https://global.discourse-cdn.com/meta/original/3X/a/f/af699b6d3a487c11f4fb96ccfac3b3e1a77196b4.jpeg)

I execute it second time, it returns an empty array `[]`.

 ![image](https://global.discourse-cdn.com/meta/original/3X/c/1/c1d0a49b162fc326ecc3286cd92c95438a711eba.png)

and then I try to `rake uploads:migrate_to_s3` again, it still says `Some uploads were not migrated to the new scheme.`

 ![image](https://global.discourse-cdn.com/meta/original/3X/4/7/47ea9e84243ff76005ca000f737bf2a7551c5675.jpeg)

---

<div class="post-metadata">

### Author: ![zh99998](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zh99998/32/100179_2.png) [@zh99998](https://meta.discourse.org/u/zh99998)
#### Post date: [March 17, 2019, 11:02am UTC](https://meta.discourse.org/t/migrate-to-minio/111830/2 "2019-03-17T11:02:23Z")

</div>

they’re site icons.

 ![image](https://global.discourse-cdn.com/meta/original/3X/f/b/fb76923b53fb626cef7c74ff8dd2e88b9f0c6d79.jpeg)

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [March 17, 2019, 3:07pm UTC](https://meta.discourse.org/t/migrate-to-minio/111830/3 "2019-03-17T15:07:34Z")

</div>

This is a known issue, already reported in the following topic:

> [@S3 migrations from/to minio problems](https://meta.discourse.org/t/s3-migrations-from-to-minio-problems/97333):
>
> I recently tried to configure my discourse to use minio according to this topic: [https://meta.discourse.org/t/setting-up-backup-and-image-uploads-to-minio-s3/95123](https://meta.discourse.org/t/setting-up-backup-and-image-uploads-to-minio-s3/95123) lets say my discourse domain is example.com and my minio endpoint is minio.example.com and my bucket name is test. I faced the following problems 1- Migration from local to minio. I did this cd /var/discourse ./launcher enter app rake uploads:migrate\_to\_s3 rake posts:rebake It seems all files are migrated to minio however all li…

It’s been a long time since it was promised to be fixed. However unfortunately it’s not fixed yet.

---

<div class="post-metadata">

### Author: ![zh99998](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zh99998/32/100179_2.png) [@zh99998](https://meta.discourse.org/u/zh99998)
#### Post date: [March 17, 2019, 3:09pm UTC](https://meta.discourse.org/t/migrate-to-minio/111830/4 "2019-03-17T15:09:00Z")

</div>

is there any known work-around solution?

---

<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: [March 17, 2019, 3:10pm UTC](https://meta.discourse.org/t/migrate-to-minio/111830/5 "2019-03-17T15:10:17Z")

</div>

I’m currently having a similar problem with Spaces.

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [March 17, 2019, 3:15pm UTC](https://meta.discourse.org/t/migrate-to-minio/111830/6 "2019-03-17T15:15:59Z")

</div>

I think It should be possible to manually transfer upload files from local to minio by minio client (mc). Then update links by a rake task. However I didn’t try it cause I cant risk it on my community.

In your case if its only a handful of site icons, maybe just upload them manually and update links in your dashboard.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [March 18, 2019, 2:29am UTC](https://meta.discourse.org/t/migrate-to-minio/111830/7 "2019-03-18T02:29:18Z")

</div>

So this is ultimately CORS related as well, @pfaffman?

---

<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: [March 18, 2019, 10:37am UTC](https://meta.discourse.org/t/migrate-to-minio/111830/8 "2019-03-18T10:37:50Z")

</div>

The problem that I think he was referring to is that `migrate_to_s3` won’t run unless everything has been changed to the new scheme but the default/stock images are in the old scheme. And the process that updates them didn’t touch the stock images. (and if you run an update they get recreated)

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [March 18, 2019, 10:53am UTC](https://meta.discourse.org/t/migrate-to-minio/111830/9 "2019-03-18T10:53:08Z")

</div>

Can you update to latest and run the rake task again?

I [fixed the rake task](https://github.com/discourse/discourse/commit/9dbca41152e6f32aa45539ec50f499885b78edd8) to only check for uploads made by users otherwise it wouldn’t run.

---

<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: [March 18, 2019, 11:01am UTC](https://meta.discourse.org/t/migrate-to-minio/111830/10 "2019-03-18T11:01:09Z")

</div>

Oooh! `. by_users`! I didn’t know about that one. I’ll try to have a look, though it seems pretty clear they should fix it.

I suspect my task is still running.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [March 18, 2019, 11:02am UTC](https://meta.discourse.org/t/migrate-to-minio/111830/11 "2019-03-18T11:02:26Z")

</div>

> [@pfaffman](#):
>
> I didn’t know about that one.

That’s because it’s new-ish. Was added in

[https://github.com/discourse/discourse/commit/b0c8fdd7da20fc4eeb30575050360fbf47ec4c8f](https://github.com/discourse/discourse/commit/b0c8fdd7da20fc4eeb30575050360fbf47ec4c8f)

---

<div class="post-metadata">

### Author: ![zh99998](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zh99998/32/100179_2.png) [@zh99998](https://meta.discourse.org/u/zh99998)
#### Post date: [March 18, 2019, 11:16am UTC](https://meta.discourse.org/t/migrate-to-minio/111830/12 "2019-03-18T11:16:30Z")

</div>

ooh sorry I have already migrated it manually and can’t do this again.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [March 18, 2019, 11:17am UTC](https://meta.discourse.org/t/migrate-to-minio/111830/13 "2019-03-18T11:17:04Z")

</div>


