4

I am using Supervisord to run my java application, which requires some environment variables for configuration. I am setting the environment variables in /etc/environment

export MANAGER_URL="http://192.xxx.xxx.xxx:8080/manager/"
export MANAGER_URL2="http://192.xxx.xxx.yyy:8081/manager/"

My supervisor/conf.d/myjavaapp.conf looks like:

[supervisord]
nodaemon=false
logfile_maxbytes=100MB
logfile_backups=0

[program:java-app]
command=/usr/bin/java -jar /home/pi/deploy/java-app.jar
stdout_logfile_maxbytes=200MB
stdout_logfile_backups=2
stderr_logfile_maxbytes=100MB
stderr_logfile_backups=0
autostart=true

I know i can set the environment variables for the [java-app] section as:

environment=MANAGER_URL="url1",MANAGER_URL2="url2" 

but that does not work for me as I need to update the variable values using Puppet manifest, which can update the bash environment variables but not the supervisor sub process environment variables.

I tried accessing the shell environment variables using:

environment=MANAGER_URL=%(MANAGER_URL)s,MANAGER_URL2=%(MANAGER_URL2)s

but this resulted in an error saying the strings could not be expanded.

Is there someway I can read the bash environment variables in my supervisor.conf?

Extra Info:
I am running it on raspbian
Supervisord is run at startup by systemd using the script in /etc/init.d/
Puppet agent is also run by Supervisor so it cannot restart the Supervisor service

0

Browse other questions tagged .