concept environment in category cloud

appears as: environment, n environment, environments, environments, environment, The environment
Cloud Native Spring in Action

This is an excerpt from Manning's book Cloud Native Spring in Action.

Note

To be compliant with this factor, you can’t have the configuration in the code or tracked in the same codebase. You can use configuration files, but you should store them in a separate repository. The methodology recommends storing configuration as environment variables. By doing so, you can have the same application deployed in different environments, but with different behaviors depending on the environment’s configuration.

Cloud Native Patterns: Designing change-tolerant software

This is an excerpt from Manning's book Cloud Native Patterns: Designing change-tolerant software.

  • Configuration of the cloud-native app poses unique challenges when many instances are deployed and the environments in which they’re running are constantly changing. If you have 100 instances of an app, for example, gone are the days when you could drop a new config into a known filesystem location and restart the app. Add to that the fact that these instances could be moving all over your distributed topology. And applying such old-school practices to the instances as they are moving all over your distributed topology would be sheer madness.
  • Snowflakes— Variability across the software development lifecycle (SDLC) contributes to trouble with initial deployments as well as to a lack of stability after the apps are running. Inconsistencies in both the software artifacts being deployed and the environments being deployed to are the problem.
  • Control the environments into which you’ll deploy the software
  • Let’s take a moment to acknowledge the obvious: there are always differences in environments. In production, your software connects to your live customer database, found at a URL such as http://prod.example.com/cutomerDB; in staging, it connects to a copy of that database that has been cleansed of personally identifiable information and is found at http://staging.example.com/cleansedDB; and during initial development, there may be a mock database that’s accessed at http://localhost/mockDB. Obviously, credentials differ from one environment to the next. How do you account for such differences in the code you’re creating?

    I know you aren’t hardcoding such strings directly into your code (right?). Likely, you’re parameterizing your code and putting these values into some type of a property file. This is a good first step, but often a problem remains: the property files, and hence the parameter values for the different environments, are often compiled into the deployable artifact. For example, in a Java setting, the application.properties file is often included in the JAR or WAR file, which is then deployed into one of the environments. And therein lies the problem. When the environment-specific settings are compiled in, the JAR file that you deploy in the test environment is different from the JAR file that you deploy into production; see figure 2.10.

    Figure 2.10. Even when environment-specific values are organized into property files, including property files in the deployable artifact, you’ll have different artifacts throughout the SDLC.

    As soon as you build different artifacts for different stages in the SDLC, repeatability may be compromised. The discipline for controlling the variability of that software artifact, ensuring that the only difference in the artifacts is the contents of the property files, must now be implanted into the build process itself. Unfortunately, because the JAR files are different, you can no longer compare file hashes to verify that the artifact that you’ve deployed into the staging environment is exactly the same as that which you’ve deployed into production. And if something changes in one of the environments, and one of the property values changes, you must update the property file, which means a new deployable artifact and a new deployment.