0

I am struggling with bluemix resetting my environmental values after I deploy from jazz.net

To replicate the error do the following

From bluemix console, console.ng.bluemix.net - Find the application - Go to Runtime -> Environmental Variable - Add a variable enter image description here

Then click save. This will restart the application and use the env variables that you just entered.

Now go to hub.jazz.net, find the git for your project and press the play button at the top to deploy.

enter image description here

You app will restart.

Then if you you go back to the console and check your environmental variables you will see that they have been lost

enter image description here

I believe that this is not normal behaviour and the env variable should persist after deploying from jazz. Even if that is not the fact is there a way to persist them, without hardcoding them.

zirinisp
  • 9,971
  • 5
  • 32
  • 38

1 Answers1

1

Based on the Cloud Foundry documentation this seems to be normal behavior. I would also expect this behavior because with each deploy you essentially have a new application.

Environment variables interact with manifests in the following ways:

  • When you deploy an application for the first time, Cloud Foundry reads the variables described in the environment block of the manifest and adds them to the environment of the container where the application is staged, and the environment of the container where the application is deployed.

  • When you stop and then restart an application, its environment variables persist.

This is the behavior for environment variables defined in manifest files. It also hints at how you could persist the variable, i.e., by setting it via the manifest file. Add a new section/entry:

env:
  PARSE_DASHBOARD_ALLOW_INSECURE_HTTP: 1

This is semi-hardcoded, but not in the app itself.

Another option would be to execute cf set-env commands during the deployment process. This would create and set environment variables from the command line.

Community
  • 1
  • 1
data_henrik
  • 16,724
  • 2
  • 28
  • 49
  • I thought so, as the results were consistent, every time I was deploying env vars were lost. Is there any other way to keep sensitive env variables away from the source code and git? – zirinisp Jan 13 '17 at 12:46
  • You could try to execute a `cf set-env` as part of the deployment process. – data_henrik Jan 13 '17 at 13:56