S3からローカルへのアップロードの移行

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

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

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

「いいね!」 1

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

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

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

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

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

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

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

「いいね!」 1

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

「いいね!」 1

Is there a way to find these hidden settings?

「いいね!」 2

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

このrakeタスクは2.9.0 BETA 8では利用できなくなりました。

S3からローカルへの移行方法について、何かアイデアはありますか?

「いいね!」 1

バックアップに含まれる非表示のサイト設定を有効にし(正確な名前は現在携帯電話で見つけられませんが)、そのバックアップを復元できます。これは、cdckホスティングを離れるときに発生するもので、機能します。別のサーバーに復元する必要があるかもしれません(テストのため anyway に必要になります)。

編集:@Benjamin_Dさん、ありがとうございます!それは include_s3_uploads_in_backups です。

「いいね!」 2

これがそれだと思います。

「いいね!」 4

管理サイトのコントロールの Backup 設定ページにあるオプションではありませんか?また、これは S3 ファイルをダウンロードするのと逆のことではありませんか?

「いいね!」 1

いいえ。

backup_with_uploadsinclude_s3_uploads_in_backups と同じではありません。一方はローカルファイルをバックアップに含めます。もう一方は、バックアップを作成するたびにS3からすべてのファイルをダウンロードします。そして、S3の主な目的は、バックアップを作成する必要がないことです。

「いいね!」 3

これはS3へのバックアップ時にローカルファイルも含まれるということですか?

これは、バックアップに含めるためにS3ストアからファイルをダウンロードします(これはローカルまたはS3上にある可能性があります)。


ここで正しい手順を理解しようとしています。目標は、すべてのファイルをS3からローカルに移行することです。したがって、あなたの言っていることを理解しているとすれば:

  1. Railsコンソールからbackup_with_uploadsを有効にする
  2. バックアップを作成する(ローカルまたはS3)
  3. バックアップを使用して復元する
  4. Railsコンソールからbackup_with_uploadsを無効にする

これで合っていますか?

「いいね!」 1

S3からローカルへの移動に最適なアプローチは何でしょうか? :slight_smile:

  • ファイル(optimized/originalフォルダ)を手動で移動し、DiscourseからS3オプションを無効にした後にポストリベイクを実行する?
  • シャドウ化されたdownload_s3_with_backups管理オプションを使用して、それらのファイルをダウンロードして解凍する?
  • rake uploads:migrate_from_s3
「いいね!」 1