-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supervisor won't start using %(ENV_env_var_here)s in environment #599
Comments
This error indicates that the This expansion should be supported since 2d6ca34, which will be released in Supervisor 3.2. I added a test for this specific case in 3fe078a. Since it is passing, I am going to close this issue. |
Hey @mnaberez, looking at the supervisord release log, the last release was 3.1.3 on 2014-10-28. Do you know when 3.2 might release? Separately, do you know any workarounds in the short-term to pass non-hardcoded environment variables into the environment of a supervisord process? EDIT: in my particular scenario I discovered that by running |
I've got the same problem. Mainly I use supervisor in amazon elastic beanstalk |
So is 3.2 still coming out? |
I actually tried to release it a few days ago, but found another significant problem just before uploading the package. I'll probably release it next week if I don't find anything else broken. |
mrcoles comment on Sep 24
The same holds for me. This is the only way I got (custom) environment variables to work in a supervisor program (3.0b2, 3.2). Using -n, I no longer have to specify the environment= variable in the .conf file. |
Supervisor 3.2.0 (November 30, 2015) supports using |
3.3.1 and same issue... |
Seeing the same issue in 3.3.1 |
For the commenters above saying that Supervisor version:
Minimal
Create an environment variable
Run
As you can see above, the environment when Please see Subprocess Environment for more information about how Supervisor handles environment variables. |
@mnaberez I am getting -
and yes I have the same version and have exported the variable as well. PS - I am using supervisor as a service. Can that be an issue? |
The environment variable must exist in the environment from which the |
I am running in to the same issue: My supervisor version is: supervisor:all/bionic 3.3.1-1.1 uptodate |
Hi @mnaberez, |
No version of
The above shows that on 4.1.0, Looking again at the error message:
The only variables present in the environment at the time |
Facing the same issue, on supervisor 4.1.0. |
The syntax for an environment variable called supervisor/supervisor/skel/sample.conf Lines 7 to 8 in 602d6f5
Note also that the variable must be present in the environment before |
Tried this, still getting the same error. |
Here's what I tried to reproduce this.
Above,
Based on the above, Supervisor 4.1.0 is behaving as expected. |
@mnaberez I was using systemd to start supervisor as a service.
supervisord[3105685]: Error: Format string 'SERVER_ID=%(ENV_SERVER_ID)s' for 'supervisord.environment' contains names ('ENV_SERVER_ID') which cannot be expanded. Available names: ENV_INVOCATION_ID, ENV_JOURNAL_STREAM, ENV_LANG, ENV_PATH
Something weird is happening between systemd and supervisord. |
The Supervisor project itself does not provide any integration with systemd or other init systems. However, the information above and on this page applies to any installation, so hopefully it will be helpful. The Supervisor developers do not have enough bandwidth to assist with troubleshooting individual installations, sorry. |
I appreciate you answering. Thanks. |
Facing the same issue, @nagri could you please share your resolution here? |
I gave up the idea of using the variable. I manipulated the conf file and feeded the value directly into the conf file like this "environment=SERVER_ID=" and then restarted supervisor. |
Hey folks I'm trying to run a node process via supervisord (supervisor-3.0-0.1.a8.fc13.noarch) and I've noticed some strange behaviour.
Supervisor won't start when %(ENV_VAR)s is set. The config, sensitive info redacted:
[program:node-studio] environment=PATH="/data/shared/blender:/data/shared/bin:%(ENV_PATH)s" numprocs=1 command=/usr/bin/node /data/web/studio/current/app.js directory=/data/web/studio/current
When running 'supervisorctl update':
supervisorctl update
error: <class 'xmlrpclib.Fault'>, <Fault 92: 'CANT_REREAD: Format string PATH="/data/shared/blender:/data/shared/bin:%(ENV_PATH)s" for \'environment\' contains names which cannot be expanded'>: file: /usr/lib/python2.6/site-packages/supervisor/supervisorctl.py line: 933
However, if I set the path manually based on 'echo $PATH':
environment=PATH="/data/shared/blender:/data/shared/bin:/data/rvm/gems/ruby-2.0.0-p576/bin:/data/rvm/gems/ruby-2.0.0-p576@global/bin:/data/rvm/rubies/ruby-2.0.0-p576/bin:/usr/pgsql-9.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/data/rvm/bin"
Supervisord starts successfully as expected. If I modify the config again with environment as:
environment=PATH="/data/shared/blender:/data/shared/bin:%(ENV_PATH)s"
The path is now correct for the process, as grabbed from /proc/$PID/environ. The correct $PATH variable is only present when the PATH= variable is set to $PATH manually, then to %(ENV_PATH)s.
The text was updated successfully, but these errors were encountered: