Migrando cargas desde S3 a local

I want to migrate my files from s3 back to local. I’m manually transferring all files from s3 to uploads folder. Then should be changing the base url of upload links, back to forum base url, sufficient to do the job done?

2 Me gusta

Why aren’t you using the built-in rake task? afaik it’s called uploads:migrate_from_s3

cd /var/discourse
./launcher enter app
rake uploads:migrate_from_s3

Then disable the enable s3 uploads site setting:

And finally rebake:

rake posts:rebake
4 Me gusta

Because my s3 is minio and I’m not sure if this function is compatible with it or not.

1 me gusta

I tried this and after it was done, I didnt see any change in uploads. Still uploads are served from s3. btw the rake task was wierd to me. It ended so fast while I have thousnds of s3 uploads. It shouldve taked a while.

1 me gusta

I have all my uploads transferred to local manually. Is there something that I can do to change all of the links in database and posts directly? I don’t need to use this rake task.

1 me gusta

Did you figure this out? I’m also looking to migrate all assets (everything except backups) from S3 back to the local. Is there an easy way to do this?

3 Me gusta

I too am looking for similar option. But I read somewhere on this very site, that for this to work correctly, some big problems are to be sorted first. So, for the time being, they recommend not to shift S3 to local.

Though I’m also anxiously waiting for the solution to this problem.

4 Me gusta

There is a hidden site setting called something like “download S3 uploads to local on backup”. I think you can use that and restore to another server (or maybe your server if you change settings with shadowed site settings in environment variables). This is what cdck does when you close an account and I’ve never had trouble restoring one of their backups.

5 Me gusta

I did commanded that setting in Rails console SiteSetting.include_s3_uploads_in_backups = true. But it still didn’t (seem to) have any effect. The backup still was the same size (approx 375 MB, even when my uploads are around 700 MB to 1GB).

If by ‘Shadowed site settings’ you mean all the S3 site settings in Disco Web UI, then I do have all those settings filled in those fields.

2 Me gusta

I’m also looking to migrate my uploads from S3 to local (separate VPS). Is there a documented procedure for this?

1 me gusta

Not really. I’d try using the setting I described above

1 me gusta

Is there a way to find these hidden settings?

2 Me gusta

The one that you might need in context of this discussion is mentioned above. You can see them all in site_settings.yml in the Discourse source.

3 Me gusta

Esta tarea de rake ya no está disponible en 2.9.0 BETA 8

¿Alguien tiene ideas sobre cómo migrar de S3 a local?

1 me gusta

Puedes activar la configuración oculta del sitio llamada algo así como download_s3_with_backups (no es exactamente así, pero no la encuentro ahora en mi teléfono) y luego restaurar esa copia de seguridad. Eso es lo que sucede cuando dejas el alojamiento de cdck, y funciona. Es posible que necesites restaurar en un servidor diferente (y de todos modos lo harías para probar).

Editar: ¡gracias @Benjamin_D! es include_s3_uploads_in_backups

2 Me gusta

Creo que es esto:

4 Me gusta

¿No está esa opción disponible en la página de Configuración en los controles del sitio web de administración, en la página de Configuración de Copia de seguridad? ¿Y no es esto lo opuesto a descargar los archivos de S3?

1 me gusta

No.

backup_with_uploads no es lo mismo que include_s3_uploads_in_backups. Uno incluye archivos locales en la copia de seguridad. El otro descarga cada archivo de s3 cada vez que se realiza una copia de seguridad. Y el propósito de s3 es que no necesites hacer copias de seguridad de él.

3 Me gusta

Entonces, ¿esto incluye archivos locales al hacer una copia de seguridad en S3?

Esto descarga archivos de la tienda S3 para incluirlos en la copia de seguridad (que podría ser local o en S3).


Estoy tratando de entender los pasos correctos aquí, el objetivo es migrar todos los archivos de S3 a local, así que si entiendo lo que dices:

  1. Habilita backup_with_uploads desde la consola de Rails
  2. Crea una copia de seguridad (local o en S3)
  3. Restaura usando la copia de seguridad
  4. Deshabilita backup_with_uploads desde la consola de Rails

¿Es correcto?

1 me gusta

Entonces, ¿cuál es el mejor enfoque para pasar de S3 a local? :slight_smile:

  • ¿Mover manualmente los archivos (carpetas optimizadas/originales) y hacer un post-rebake después de deshabilitar la opción S3 de Discourse?
  • ¿Usar la opción de administrador download_s3_with_backups en sombra, descargar y descomprimir esos archivos?
  • ¿rake uploads:migrate_from_s3?
1 me gusta