需要将您的 Discourse 安装移动到另一个(本地)目录吗?让我们开始吧!
配置新目录
确保新目录已按需要正确挂载/连接。然后创建 Discourse 将所在的文件夹。
cd /new/discourse/location
mkdir -p shared/standalone
复制现有文件到新位置
从此刻起,您的站点将处于离线状态。
停止容器以确保在传输过程中不会对文件进行任何更改。
cd /var/discourse
./launcher stop app
将文件复制到新位置
rsync -avzh /var/discourse/shared/standalone/ /new/discourse/location/shared/standalone
更新 app.yml 并重建
修改您的 app.yml,使 Discourse 从新位置运行。
当前配置:
## The Docker container is stateless; all data is stored in /shared
volumes:
- volume:
host: /var/discourse/shared/standalone
guest: /shared
- volume:
host: /var/discourse/shared/standalone/log/var-log
guest: /var/log
更新后的配置:
## The Docker container is stateless; all data is stored in /shared
volumes:
- volume:
host: /new/discourse/location/shared/standalone
guest: /shared
- volume:
host: /new/discourse/location/shared/standalone/log/var-log
guest: /var/log
重建 Discourse
cd /var/discourse
sudo ./launcher rebuild app
您的站点现在将恢复在线。
测试更改
打开您的站点并确认所有内容显示正常。确保所有内容(包括上传的文件)均正常显示。
删除旧位置的文件
一旦确认一切运行正常,请删除旧的 Discourse 文件以释放空间。
cd /var/discourse
sudo rm -r shared/standalone