我更改了网站的 S3 存储桶,并将所有资源复制到了新存储桶中。所有内容都保持一致,我还确保所有文件至少具有公共可读权限。
for i in $(cat files.txt | awk '{print $4}'); do aws --profile gb_root s3api put-object-acl --bucket gb-www-forum --key $i --acl public-read ; done;
但部分 URL 和图片引用仍基于旧存储桶名称。
例如:Logo 的 URL 设置为:
这指向的是旧存储桶,所有引用都应更新为新存储桶名称。
我已尝试的操作:
重新烘焙(Rebake)
cd /var/discourse
./launcher enter app
rake posts:rebake
该操作成功执行,但没有任何变化。
重映射(Remap,调用失败)
Remap 功能曾被提及,但我似乎无法正确调用它。
root@forum-app:/var/www/discourse# rake --tasks | grep remap
rake posts:remap[find,replace,type,ignore_case] # Remap all posts matching specific string
root@forum-app:/var/www/discourse# rake posts:remap["geek-beacon-www-forum", "gb-www-forum", "string", false]
rake aborted!
Don't know how to build task 'posts:remap[geek-beacon-www-forum,' (See the list of available tasks with `rake --tasks`)
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)