Can Discourse migrate what is already in in locally when it is connected to S3 storage?

Discourse’s backup is a zip archive

After unzipping one is the database and the other is the upload files (uploads)

When using S3 storage, this Uploads will not appear in the backup file, but will be stored in the object storage.

Each backup only backs up the database, unless some setting option is turned on to allow backups of S3 stored Uploads

Question time

May I ask if I have used local storage for a while at this point, the Uploads inside the backup file are already huge*

Can I manually overwrite >>>>>>>> with the Uploads from the backup file to the Uploads in the S3 storage?

Do they display properly for image files that were originally already referenced in the topic?

(Discourse is differentiated by random names for how images are stored, e.g. upload://ob9K7RhMbch2b2oTnJNi0bYCNPi.png)


Discourse的备份是一个压缩包

解压之后一个是数据库,另一个是上传文件(uploads)

使用S3储存以后,这个Uploads将不会出现在备份文件当中,而是储存在对象储存

每次备份都只会备份数据库除非开启某个设置选项,允许备份S3储存的Uploads

提问环节

请问,如果我此时使用了本地储存一段时间了,备份文件里面的Uploads已经很庞大了

我能否手动将备份文件里的Uploads覆盖>>>>>>>>到S3储存里的Uploads?

对于原本已经被话题引用的图片文件,他们能正常显示吗?

(Discourse对于图片储存方式是通过随机的名字来区分的,例如upload://ob9K7RhMbch2b2oTnJNi0bYCNPi.png)

前端是根据cooked的内容来获取图片地址的,也就是说如果你只是把文件复制到了S3里,浏览器依然会尝试冲本地存储的URL里下载图片

要把本地存储的内容迁移到S3,最简单的方法是执行迁移脚本rake uploads:migrate_to_s3


The frontend retrieves images based on the cooked content, meaning that if you only copy the files to S3, the browser will still attempt to fetch images from the local storage URLs.

The simplest way to migrate content from local storage to S3 is to run the migration script rake uploads:migrate_to_s3.

3 Likes

What is rake uploads:migrate_to_s3?

You may refer to