惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
量子位
S
SegmentFault 最新的问题
V
Visual Studio Blog
博客园 - 【当耐特】
Apple Machine Learning Research
Apple Machine Learning Research
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
Stack Overflow Blog
Stack Overflow Blog
Vercel News
Vercel News
D
Docker
J
Java Code Geeks
博客园 - 三生石上(FineUI控件)
博客园 - Franky
Recent Announcements
Recent Announcements
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
D
DataBreaches.Net
Y
Y Combinator Blog
云风的 BLOG
云风的 BLOG
V
V2EX

ncc的个人网站

MCSManager 数据备份与迁移实践 Goland Update Delve frp反向代理群晖WebDAV服务器 1panel安装的Mysql版本从5.7升级到8.4.5 备份mc服务器脚本 威联通使用screen报错 Cannot find terminfo entry for 'screen.linux' Brew No Available Formula Gitea迁移和SSH容器直通 QQ邮箱文件夹重新开启通知 将博客从Typecho迁移到Hugo
Act_runner 使用 supervisor 启动无法正常识别到 asdf 设置的...
FGHWETT · 2024-11-11 · via ncc的个人网站

注意

本文最后更新于 2025-04-29,文中内容可能已过时。

一年前,我碰到了使用supervisor启动act_runner工作不正常的问题。那时候,我通过设置supervisor启动时的环境变量解决了这一问题。

Act_runner 使用 supervisor 启动无法正常识别到 asdf 设置的环境问题 155.html

但是这并不优雅,于是在这几天整理服务器时,我重新研究了一下。

由于act_runner依赖命令启动目录下的.runner文件,所以我将二进制文件和对应的启动配置文件全部放在了/opt/app/act_runner文件夹下。对应的配置文件也就配置成了二进制文件所在的目录,使用1panel自动生成的配置如下。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
[program:act_runner]
command                 = /opt/app/act_runner/act_runner daemon
directory               = /opt/app/act_runner
autorestart             = true
startsecs               = 3
stdout_logfile          = /opt/1panel/tools/supervisord/log/act_runner.out.log
stderr_logfile          = /opt/1panel/tools/supervisord/log/act_runner.err.log
stdout_logfile_maxbytes = 2MB
stderr_logfile_maxbytes = 2MB
user                    = root
priority                = 999
numprocs                = 1
process_name            = %(program_name)s_%(process_num)02d

此时,如果使用这个runner执行命令的话就会发现报错了。

1
bash: .cache/act/3aceed1a0da43919/act/workflow/0.sh: No such file or directory

理论上supervisor也是用root权限启动的,所以不会出现文件写入失败的问题。于是,在我对比了两次运行的环境变量之后,我发现直接运行act_runner所跑的任务都是在/root/.cache/...下跑的,而supervisor启动的任务都是在.cache/...下运行的,并且环境变量少了HOME=/root,于是我推测,可能是act_runner用到了这一环境变量。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
[program:act_runner]
command                 = /opt/app/act_runner/act_runner daemon
directory               = /opt/app/act_runner
autorestart             = true
startsecs               = 3
stdout_logfile          = /opt/1panel/tools/supervisord/log/act_runner.out.log
stderr_logfile          = /opt/1panel/tools/supervisord/log/act_runner.err.log
stdout_logfile_maxbytes = 2MB
stderr_logfile_maxbytes = 2MB
user                    = root
priority                = 999
numprocs                = 1
process_name            = %(program_name)s_%(process_num)02d
environment=HOME="/root"

于是,在我设置了环境变量之后,上面的问题也就没出现了。

asdf环境不生效问题

虽然解决了命令执行失败的问题解决了,但是涉及到单独设置的环境变量还是没有。因此,还需要添加对应的环境变量。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
[program:act_runner]
command                 = /opt/app/act_runner/act_runner daemon
directory               = /opt/app/act_runner
autorestart             = true
startsecs               = 3
stdout_logfile          = /opt/1panel/tools/supervisord/log/act_runner.out.log
stderr_logfile          = /opt/1panel/tools/supervisord/log/act_runner.err.log
stdout_logfile_maxbytes = 2MB
stderr_logfile_maxbytes = 2MB
user                    = root
priority                = 999
numprocs                = 1
process_name            = %(program_name)s_%(process_num)02d
environment=HOME="/root",PATH="/root/.asdf/shims:/root/.asdf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",ASDF_DIR="/root/.asdf"

2025-04-29更新:asdf升级到v0.16.0的版本后,所需要的环境变量也需要同时更改一下。

1
environment=HOME="/root",PATH="/root/.asdf/shims:/root/.asdf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/$HOME/bin",ASDF_DATA_DIR="/root/.asdf"