Is there a convention or place in the deploy manifest to specify environment variables for machines? Or would I have to write a shell script to do this? If I have to do that, do I have to set them in a pre-job hook?
When creating a release, the convention is to set and export only those environment variables that your particular job/process needs and to do so in the job's control script.
For example, the bosh release exports several environment variables like GEM_HOME
and http_proxy
in the control/shell script which starts the director process (ref). The GEM_HOME
statically points to its own package directory, and the http_proxy
is conditionally set based on operator-configured properties from the deployment manifest.
The pre-start
hook is executed in its own process, so any environment variables that your pre-start
script tries to export will not be propagated to other shell scripts that are later executed by bosh or monit.