3 Replies Latest reply on Jun 7, 2016 1:38 AM by nickarls

    Two properties files for two instance of same application

    armahdi

      We have a deployment topology that sometimes we deploy the application for test environment and prod environment on the same jboss server but in their own context. Now we are migrating to Wildfly. In Jboss we would have two contexts each having its own deploy folder and we would put the config.properties in their own respective deploy folders. Now in Wildfly, we have an issue.

      1) the location of the config.properties is in the jboss-deployment-structure.xml which is inside the WEB-INF folder. if we deploy the same war file in two different Wildfly contexts then both of them will look into the same place for the config.properties, but one is test and one is DR or Prod.

      for this we will have to package the war again differently for the prod and the test and supply a different module for the properties file.

      2) we could supply these properties in the system properties in the standalone.xml but the war application is actually configured to look for classpath:config.properties.

       

      What should we do in such a scenario. The idea of a properties file is that properties are externalized so that it can change depending on environment, but now the reference of it (jboss-deployment-structure.xml) is now part of the war/ear itself. Is there a way we can provide the jboss deployment structure external to the war so that it can be provided in the context.

        • 1. Re: Two properties files for two instance of same application
          nickarls

          If you have Test.war and Prod.war, won't you still have to set the context root in jboss-web.xml? And if your config file is on the root classpath of the WARs, each one would pick up their own one, right? You can have multiple deployment-scanners in WF but personally, I would just go the simple way with separate maven profiles, properties and filtering for the XML- and properties files...

          • 2. Re: Two properties files for two instance of same application
            armahdi

            Well the property files are not in root of the wars, As per convention in wildfly, you supply properties files in module directory and supply that module name in jboss-deployment-structure.xml which is standard per application and does not change from test to prod. These property files remain pretty much the same over different version of the same application in the same environment test or prod. So they are externalized in modules and they are picked up by wildfly and loaded whenever they are mentioned in a jboss-deployment-structure.xml.

            • 3. Re: Two properties files for two instance of same application
              nickarls

              Hmm, well in that case two slots in a module might be an approach. Of course the jboss-deployment-structure.xml would still have to be filtered. You can have multiple module roots in WF, too, I think but they are probably per instance.