Supervisor / supervisor

Supervisor process control system for Unix (supervisord)
http://supervisord.org
Other
8.33k stars 1.23k forks source link

Supervisor 4.2.5 not setting env vars #1641

Closed tisoportes closed 2 months ago

tisoportes commented 2 months ago

Why supervisor is not setting correctly env vars?

Here current context:

Settings privilege: root

os: cat /etc/issue Debian GNU/Linux 10 \n \l

python3 --version Python 3.7.3

supervisord --version 4.2.5

current program conf:

cat /etc/supervisor/conf.d/cavl-api.conf
[program:cavl-api]
priority = 1
environment=VERBOSE_LOGGING="true",JWT_SECRET="sUPERSecretPasswordObviousFake="
directory = /opt/cavl/api-crud
command = /opt/cavl/api-crud/cavl-api
stdout_logfile = /var/log/cavl-api.out.log
stderr_logfile = /var/log/cavl-api.err.log
redirect_stderr = True
autorestart = True
autostart = True

Whenever it is checked with the export command there is neither env var. Also rechecked vars with classic echo and no VERBOSE_LOGGING neither JWT_SECRET

I've read Official doc subprocess and tried to set vars in supervisor's conf but also not working. None env var setted. Even more restarted supervisor but got the same issue. So far I am forced to set the variable from console manually :/ .

mnaberez commented 2 months ago

Minimal supervisord.conf file with the exact environment= line from above:

[supervisord]
loglevel = debug

[program:bash]
environment=VERBOSE_LOGGING="true",JWT_SECRET="sUPERSecretPasswordObviousFake="
command = /bin/bash -c "env | grep -E 'VERBOSE_LOGGING|JWT_SECRET'"
startsecs = 0 
autorestart = false 

Start supervisord in the foreground with that config:

$ supervisord --version
4.2.5

$ supervisord -n -c supervisord.conf
2024-04-10 13:42:30,386 INFO Increased RLIMIT_NOFILE limit to 1024
2024-04-10 13:42:30,387 INFO supervisord started with pid 20712
2024-04-10 13:42:31,392 INFO spawned: 'bash' with pid 20713
2024-04-10 13:42:31,407 DEBG 'bash' stdout output:
JWT_SECRET=sUPERSecretPasswordObviousFake=
VERBOSE_LOGGING=true

2024-04-10 13:42:31,407 INFO success: bash entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-04-10 13:42:31,408 DEBG fd 7 closed, stopped monitoring <POutputDispatcher at 4349039376 for <Subprocess at 4349040272 with name bash in state RUNNING> (stdout)>
2024-04-10 13:42:31,408 DEBG fd 9 closed, stopped monitoring <POutputDispatcher at 4349069456 for <Subprocess at 4349040272 with name bash in state RUNNING> (stderr)>
2024-04-10 13:42:31,408 INFO exited: bash (exit status 0; expected)
2024-04-10 13:42:31,408 DEBG received SIGCHLD indicating a child quit

The output from env shows that supervisord set the environment variables from the config file. Since I can't reproduce the problem, I am going to close this issue.