1、将 /build/c_files/etc/supervisord.d/yii-cmc-console-user-sync.ini、/build/c_files/etc/supervisord.d/yii-config-column-user-sync.ini 剪切至 /build/c_files/tmp/yii-cmc-console-user-sync.ini、/build/c_files/tmp/yii-config-column-user-sync.ini,如图1
2、编辑 /build/c_files/config/init/console_init.sh,代码如下,如图2
env | grep PCS_API_CFG_CONSOLE || export PCS_API_CFG_CONSOLE="false" if [[ $PCS_API_CFG_CONSOLE == "true" ]] then /cp /tmp/yii-cmc-console-user-sync.ini /etc/supervisord.d/ echo "复制 yii-cmc-console-user-sync.ini 至 /etc/supervisord.d/" /cp /tmp/yii-config-column-user-sync.ini /etc/supervisord.d/ echo "复制 yii-config-column-user-sync.ini 至 /etc/supervisord.d/" elif [[ $PCS_API_CFG_CONSOLE == "false" ]] then echo "copy without console" else echo "please set environment variable PCS_API_CFG_CONSOLE true or false" fi
3、编辑 /build/README.md,控制台命令是否执行(单机部署时,需设置为 true;集群部署时,仅需一台机器设置为 true,其他机器皆设置为 false),true:是;false:否,默认:false
Rancher 环境变量(已设置默认值,可无需设置) PCS_API_CFG_CONSOLE=false # 控制台命令是否执行(单机部署时,需设置为 true;集群部署时,仅需一台机器设置为 true,其他机器皆设置为 false),true:是;false:否,默认:false
4、容器升级时,设置环境变量 PCS_API_CFG_CONSOLE=true1,查看升级日志
2019/9/29 下午2:51:31PCS_API_CFG_CONSOLE=true1 2019/9/29 下午2:51:31please set environment variable PCS_API_CFG_CONSOLE true or false
5、容器升级后,设置环境变量 PCS_API_CFG_CONSOLE=true1,查看 supervisord 运行状态,PHP 命令行脚本 cmc-console-user/sync、config-column-user/sync 皆未运行,符合预期
[root@ccb936b43173 /]# ps aux|grep superviosrd root 533 0.0 0.0 10696 992 pts/2 S+ 14:50 0:00 grep --color=auto superviosrd [root@3bcad2636ae5 /]# supervisorctl status cronolog RUNNING pid 436, uptime 0:01:47 nginx RUNNING pid 433, uptime 0:01:47 php-fpm RUNNING pid 434, uptime 0:01:47 report_client RUNNING pid 435, uptime 0:01:47
6、容器升级时,未设置环境变量 PCS_API_CFG_CONSOLE,或者设置环境变量 PCS_API_CFG_CONSOLE=false,查看升级日志,如图3
2019/9/29 下午2:49:26copy without console
7、容器升级后,未设置环境变量 PCS_API_CFG_CONSOLE,或者设置环境变量 PCS_API_CFG_CONSOLE=false,查看 supervisord 运行状态,PHP 命令行脚本 cmc-console-user/sync、config-column-user/sync 皆未运行,符合预期
[root@ccb936b43173 /]# ps aux|grep superviosrd root 533 0.0 0.0 10696 992 pts/2 S+ 14:50 0:00 grep --color=auto superviosrd [root@ccb936b43173 /]# supervisorctl status cronolog RUNNING pid 436, uptime 0:01:02 nginx RUNNING pid 433, uptime 0:01:02 php-fpm RUNNING pid 434, uptime 0:01:02 report_client RUNNING pid 435, uptime 0:01:02
8、容器升级时,设置环境变量 PCS_API_CFG_CONSOLE=true,查看升级日志,如图4
2019/9/29 下午2:54:53PCS_API_CFG_CONSOLE=true 2019/9/29 下午2:54:53复制 yii-cmc-console-user-sync.ini 至 /etc/supervisord.d/ 2019/9/29 下午2:54:53复制 yii-config-column-user-sync.ini 至 /etc/supervisord.d/
9、容器升级后,设置环境变量 PCS_API_CFG_CONSOLE=true,查看 supervisord 运行状态,PHP 命令行脚本 cmc-console-user/sync、config-column-user/sync 皆已运行,符合预期,如图5
[root@9fdfba4524e6 /]# ps aux|grep superviosrd root 550 0.0 0.0 10696 992 pts/2 R+ 14:46 0:00 grep --color=auto superviosrd [root@9fdfba4524e6 /]# supervisorctl status cronolog RUNNING pid 441, uptime 0:02:01 nginx RUNNING pid 436, uptime 0:02:01 php-fpm RUNNING pid 435, uptime 0:02:01 report_client RUNNING pid 438, uptime 0:02:01 yii-cmc-console-user-sync RUNNING pid 515, uptime 0:00:57 yii-config-column-user-sync RUNNING pid 514, uptime 0:00:58
10、建议查看网址:http://www.shuijingwanwq.com/2019/09/29/3525/ ,替换 /tmp 为 /mcloud,修复 Bug :Missing the temporary folder to store the uploaded file
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/250481.html