Managing configuration properties for multiple environments

An enterprise level solution always have different environments for different stakeholders like local, dev for developers, UAT/SIT for QAs etc. Then we have a production environment.

Every environment may have different characteristics,  like different email SMTP servers or different database etc. Hybris based projects are no different and have multiple multiple environment based on lifecycle of project.

Now the problem is how to manage configuration for multiple environments. Of course, we can do it manually, where we can have different property files set up on individual server. But this solution is  not modular and efficient.

The approach i am going to present is based on using apache ant to create environment specific file. It will copy properties from one common file and one environment specific file and merge them to create a complete local.properties file.

Follow below steps:

  1. Create below  folder structure inside hybris config directory. 

config

 2. Place your properties in each one of local files as per environment related values. The property which have same values across environment will go to common local property file.

3. Create a build.xml file inside config project and copy below content. 

build

4. Now we have a ant build xml, which will create a environment specific property file. You can run like below, pass the environment name as required. 

antbuild

Now you have a flexible solution to configure your hybris system more efficiently, thanks to open source apache ant.

 

Dynatrace installation : org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted ([before_stop]) for component [StandardService[Catalina]] in state [INITIALIZED]

Are you getting a life cycle exception during server start. This is actually because you followed hybris wiki blindly, without reading instructions carefully.

While installing a dynatrace for your hybris project, you need to add few parameter to tomcat, so that dynatrace agent is loaded. But probably, you overridden all tomcat options.

Solution is to copy tomcat.generaloptions from project.properties of platform extension and add dynatrace properties in the end.

tomcat.generaloptions=-Xmx2G …..-Djava.io.tmpdir=”${HYBRIS_TEMP_DIR}” ${dynatrace.jvm-opts}

Restart cmd and run build again.