Supervisor / supervisor

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

cannot used env for autostart? #1592

Closed zhangguanzhang closed 1 year ago

zhangguanzhang commented 1 year ago

on centos7

$ yum install -y python3-pip
$ pip3 install  supervisor==4.2.4

Support expansions of ENV_* vars in all options in https://github.com/Supervisor/supervisor/commit/2d6ca34582a8a07a5dd96ae45ef62cd58a459f4f

[program:xxx-demo]
environment=DEMO_AUTO_START=true
command=bash /xxx.sh demo
directory=/opt/%(ENV_PROJECT)s
autostart=%(ENV_DEMO_AUTO_START)s
error: <class 'xmlrpc.client.Fault'>, <Fault 92: "CANT_REREAD: Format string '%(ENV_DEMO_AUTO_START)s' for 'program:xxx-demo.autostart' contains names ('ENV_DEMO_AUTO_START') which cannot be expanded. 
Available names: ENV_LANG, ENV_LD_LIBRARY_PATH, ENV_PATH, group_name, here, host_node_name, program_name in section 'program:xxx-demo' (file: '/etc/supervisor/conf.d/app.conf')">: file: xmlrpc/client.py line: 656
mnaberez commented 1 year ago

pip3 install supervisor==4.2.4

The source code for this release is tagged 4.2.4 in this repository.

mnaberez commented 1 year ago

error: <class 'xmlrpc.client.Fault'>, <Fault 92: "CANT_REREAD: Format string '%(ENV_DEMO_AUTO_START)s' for 'program:xxx-demo.autostart' contains names ('ENV_DEMO_AUTO_START') which cannot be expanded. Available names: ENV_LANG, ENV_LD_LIBRARY_PATH, ENV_PATH, group_name, here, host_node_name, program_name in section 'program:xxx-demo' (file: '/etc/supervisor/conf.d/app.conf')">: file: xmlrpc/client.py line: 656

There appears to be no variable DEMO_AUTO_START in the environment from which supervisord was started. If the variable were present in the environment, it would have been listed under Available names: in message above.

Environment variables must be present in the environment at the time supervisord is started.

zhangguanzhang commented 1 year ago

pip3 install supervisor==4.2.4

The source code for this release is tagged 4.2.4 in this repository.

I changed the describe