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

推荐订阅源

美团技术团队
D
DataBreaches.Net
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
Docker
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Check Point Blog
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
IT之家
IT之家
月光博客
月光博客
U
Unit 42
K
Kaspersky official blog
T
Threatpost
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
GbyAI
GbyAI
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
云风的 BLOG
云风的 BLOG
酷 壳 – CoolShell
酷 壳 – CoolShell
I
InfoQ
Engineering at Meta
Engineering at Meta
Recorded Future
Recorded Future
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security @ Cisco Blogs
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
Security Archives - TechRepublic
Security Archives - TechRepublic
Webroot Blog
Webroot Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Schneier on Security
S
Secure Thoughts
The Register - Security
The Register - Security
B
Blog RSS Feed
The Last Watchdog
The Last Watchdog
P
Palo Alto Networks Blog
爱范儿
爱范儿
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
L
LINUX DO - 热门话题
C
Cisco Blogs
Spread Privacy
Spread Privacy
F
Full Disclosure
博客园 - 聂微东
T
The Blog of Author Tim Ferriss

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"