又是中断系统运行的一次升级。
现在 Discourse 升级通常没个 10 多分钟都完成不了。
又是中断系统运行的一次升级。
现在 Discourse 升级通常没个 10 多分钟都完成不了。
我还是国内服务器部署 那个机器屏蔽全部国外ip 每次更新麻烦死了。
github需要镜像 ruby-gem需要镜像 前端资源不能用预编译的。
我大概 3个月更新一次。
另外 站长 你的有些帖子怎么是 2009 年发布。
哈哈。
本来整个社区的建立时间在 09 年的,那个时候还用的是 Discuz。
几年前不是因为 Discuz 不更新了,然后把一些老的内容全部迁移到了 Discourse 上。
但一些老的帖子缺东西,或者附件已经读不出来了。
所以我现在是先选择 Active 进行排序。
对于一些老的帖子,或者没有什么营养的内容就对内容进行更新到最新的,然后把内容回复下就可以提升到当前了。
但内容最早发布的时间也是可以改的,只是懒得改了,所以会看到这些内容最早发布在 2009 年。
如果查看下内容的版本历史,就可以看到这些内容更新之前的老内容是什么。
如果想去掉这个时间戳,Discourse 也可以做,通过修改时间戳就行。
只是懒得修改了。
国内加速方案,无需vpn,带宽拉满
web.china.template.yml
hooks:
before_code:
- exec:
cmd:
- su discourse -c 'git config --global url."https://ghfast.top/https://github.com/".insteadOf "https://github.com/"'
after_code:
- exec:
cmd:
- |-
cd /var/www/discourse
su discourse -c '
set -o errexit
target="/var/www/discourse/script/assemble_ember_build.rb"
old="https://get.discourse.org/discourse-assets"
new="https://ghfast.top/https://github.com/discourse/discourse-assets/releases/download"
grep -q "$old" "$target"
sed -i "s#${old}#${new}#g" "$target"
grep -q "$new" "$target"
grep -Fq "url = \"#{PRE_BUILD_ROOT}/#{version_string}/#{resolved_ember_env}.tar.gz\"" "$target"
sed -i "s|url = \"#{PRE_BUILD_ROOT}/#{version_string}/#{resolved_ember_env}.tar.gz\"|url = \"#{PRE_BUILD_ROOT}/v#{version_string}/#{resolved_ember_env}.tar.gz\"|g" "$target"
grep -Fq "url = \"#{PRE_BUILD_ROOT}/v#{version_string}/#{resolved_ember_env}.tar.gz\"" "$target"
if grep -q "$old" "$target"; then
echo "ERROR: old prebuilt assets URL still present in $target" >&2
exit 1
fi
if grep -Fq "url = \"#{PRE_BUILD_ROOT}/#{version_string}/#{resolved_ember_env}.tar.gz\"" "$target"; then
echo "ERROR: old prebuilt assets URL expression still present in $target" >&2
exit 1
fi
'
before_web:
- exec:
cmd:
- su discourse -c 'gem sources --add https://mirrors.tuna.tsinghua.edu.cn/rubygems/ --remove https://rubygems.org/'
- su discourse -c 'gem sources --add https://mirrors.tuna.tsinghua.edu.cn/rubygems/ --remove https://api.rubygems.org/'
before_yarn:
- exec:
cmd:
- su discourse -c 'pnpm config set registry https://registry.npmmirror.com --global'
before_bundle_exec:
- exec:
cmd:
- su discourse -c 'bundle config mirror.https://rubygems.org https://mirrors.tuna.tsinghua.edu.cn/rubygems'
- su discourse -c 'bundle config mirror.https://api.rubygems.org https://mirrors.tuna.tsinghua.edu.cn/rubygems'
- cd /var/www/discourse && su discourse -c 'bundle config set frozen false' && su discourse -c 'bundle update diffy' && su discourse -c 'bundle config set frozen true'
web_only.yml
hooks:
after_code:
- exec:
cd: $home/plugins
cmd:
- git clone https://ghfast.top/https://github.com/discourse/docker_manager.git
# - git clone https://ghfast.top/https://github.com/discourse/discourse-graphviz.git
# - git clone https://ghfast.top/https://github.com/discourse/discourse-math.git
#- git clone https://ghfast.top/https://github.com/discourse/discourse-gamification.git
#- git clone https://ghfast.top/https://github.com/discourse/discourse-translator.git
# - git clone https://ghfast.top/https://github.com/discourse/discourse-cakeday.git
- git clone https://ghfast.top/https://github.com/discourse/discourse-saved-searches.git
3-5分钟升级,./launcher bootstrap web_only,不停服更新
update.sh
sudo ../launcher destroy web_only
sudo ../launcher start web_only
中国加速doctor,我会定期同步增加最新版本
launcher,130行处修改
image="registry.cn-wulanchabu.aliyuncs.com/docker-hub-china/discourse-base:2.0.20260209-1300"
国内机部署的时候 你是yaml里面加了代理 还是直接给服务器开tun呢 其实很麻烦
感谢 回头我试试效果咋样
我这个vps是阻断所有外国ip的,所以ghfast都连不上 ![]()
![]()
![]()
现在确实是双容器,可以不停服更新。
但是每次更新我都得开一个临时的,网络正常的服务器,搭一个xget来自建github镜像。
docker镜像是用的 docker.io/discourse/base 项目中国可用镜像列表 | 高速可靠的 Docker 镜像资源 这个网站,是华为云的oss,速度飞快。
感谢您的方法,学到了加速discourse-assets和清华的rubygems,我之前用的https://gems.ruby-china.com/gems 维护的不及时。
我是yaml里面加了代理,然后在另一台服务器自建github镜像,更新结束就关机。