cf restart-app-instance and environment variables #cf


Preetam Palwe
 
Edited

Hello everyone !

I am observing that the new environment variable set to my application using cf set-env is not getting reflected in the container even after cf restart-app-instance is done. Why is it so?

To give a brief context - I have an Java Spring Boot application which is deployed on PCF. I am setting a new env var using cf set-env. In order to reflect the env var in the application I understand that application restart is essential. (I don't need restage as my env var is not getting used in the buildpack.)
But cf restart as per documentation create downtime. Hence I decided to scale my application to minimum 2 instances and then used cf restart-app-instance one by one for the 2 instances. (It's kind of rolling restart)
I was expecting that the env var will get reflected in each instance but it has not happened. I checked this by both means - printing env vars in my application and doing cf ssh -i on each instance. In both cases I was not able to see the new env var.

What could be wrong or am I missing something here?

Versions I am using areĀ 
CLI version 6.32.0+0191c33d9.2017-09-26
PCF version 1.12
Note - I did observed that cf restart reflected the env variables as expected. (only cf restart-app-instance failed to do that - why?)

Appreciate any help on this - Many Thanks !
~Preetam

Join cf-dev@lists.cloudfoundry.org to automatically receive all group messages.