zirinisp
zirinisp

Reputation: 10301

Bluemix Environmental Values lost after deploy from jazz.net

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.

Upvotes: 0

Views: 113

Answers (1)

data_henrik
data_henrik

Reputation: 17156

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.

Upvotes: 1

Related Questions