I have a set of upstart scripts, generated by foreman from a Procfile, to start my web service and async task queue worker. The way foreman generates the scripts is as follows:
where "app-web" and "app-worker" are set to start on starting "app", and "app-web-1" and "app-worker-1" are set to start on starting "app-web" and "app-worker" respectively. As I understand it, this structure is to allow you to easily add further web and worker processes when load increases, while still managing the whole thing from the top-level "app" job.
So, I want to set various environment variables in my jobs. I can of course put them directly into the bottom-level scripts, but it would be better to put them in the top level so they only have to be defined once. I thought I would be able to do this in app.conf by simply using
env FOO=bar export FOO
but this doesn't seem to work: it's fine if I put it in the middle "app-web" job, but if I put in the top-level "app" it doesn't get inherited by the bottom-level "app-web-1". So, my second attempt was to put that in the top-level script, and then try and re-export in the middle one with just
export FOO, but this doesn't work either.
Is it possible to do what I want, or should I simply settle for defining the variables in multiple places?