-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker upgrade #1993
docker upgrade #1993
Conversation
xiagw
commented
Jul 17, 2023
- auto upgrade with docker
- fix file mode
- fix file permission
- add docker-coompose.yml
docker-compose.yml 里的宿主机路径写错了。 关于 使用docker里的代码来升级旧代码,你的思路蛮好的,我知道你是想通过纯命令行来实现升级。我一开始也是这么想的,但是当时没这么做是觉得麻烦。 Dockerfile里的版本号,其实并不是showdoc真正的版本号。它应该说,只是docker这个运行环境的版本号,比如叫 2.4 。但showdoc代码程序的版本号已经去到3.2了,这个版本号写在 composer.json 文件的 version字段。 这里更重要的是,更新的逻辑。 你应该能看到 ,我更新逻辑是写在了一个php脚本里 https://github.com/xiagw/showdoc/blob/docker-upgrade/server/Application/Api/Controller/UpdateController.class.php#L22 |
解释下为什么我说 docker-compose.yml 里的宿主机路径写错了。 宿主机路径,虽然说理论上是什么路径都行,但出于兼容历史的原因,我都统一写 /showdoc_data/html 。 这样的安装方式,还可以无缝复用官方的一键安装脚本来操作 https://www.showdoc.com.cn/help/828455960655160 |
如果要沟通这些东西的话,感觉有蛮多需要改的,包括你这些目录结构,架构问题,不过还是算了,没那么多时间搞,你若需要也可以慢慢来
|
建议路径变更一下,不要用这种非POSIX规范路径 /showdoc_data/ |
假如结构调整的话,建议顶级只需三个文件夹即可。因为已经使用了 thinkphp。
install/ 置于 thinkphp/public |
thinkphp 版本太久,建议升级。 |
当前的目录结构一直是我心病,想改掉好多年了。 |
/showdoc_data/ 这个路径,暂时更改不了了。以前决定得太草率,以至于后面都要兼容历史 你再做两个改动吧, |
非 docker 安装也不需要, |
语言字串 已经有了。 |
我说一个场景吧,比如说那些只会用宝塔面板,把showdoc丢进php运行环境的那些人。我还是得把web/ 和 vendor 放上来的 |
你那个 docker-compose.yml ,这个路径还是不太对。应该是 /showdo_data/html:/var/www/html 如果你宿主机真的无法改路径,可以通过 软连接的方式 达到路径变换的效果。 |
这个是没问题的,你可以测试一下,都兼容了你说的。 |
rsync -a --exclude='Sqlite/' --exclude='Public/Uploads/' $showdoc_html_dir/ $web_dir/ | ||
## revert lang if lang=en | ||
if grep -q 'lang:.*en' $web_dir/web/index.html; then | ||
sed -i -e "/lang:.*zh-cn.*/s//lang: 'zh-cn'/" $web_dir/web/index.html $web_dir/web_src/index.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
增加语言字符串替换 这个语言
## upgrade (通过 Dockerfile 的环境变量 变更版本) | ||
version_json=$(grep -o '"version":.*"' $file_json | awk '{print $2}') | ||
version_json="${version_json//\"/}" | ||
if [ -f $file_ver ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一是,版本的更新 ,改为判断 composer.json这个文件里的version字段。先不用Dockerfile的版本号