Reputation: 1994
We have a maven Mule ESB application that follows this Mule recommended standard of deploying to multiple environment.
https://docs.mulesoft.com/mule-user-guide/v/3.7/deploying-to-multiple-environments
How do I deploy the same version in the same environment but with different configs?
Real World Problem: I don't have another mule licence ($9000 current price) to run my Jenkins tests on, so I need a way to tell the second instance to use the jenkins-override.properties file.
Any ideas?
What I've tried:
Searching the Web, no luck
Contemplated naming the instance in the app.zip name. like so <app_name>-<version><instance_name>.zip
and extract the instance_name programatically and look for that environment-instance name.
My maven command is currently:
mvn package -DargLine="-DmyEnv=qa"
(just -DmyEnv=qa does not work for some reason, but that's another question)
Upvotes: 3
Views: 1432
Reputation: 2475
If you follow the guidelines in the documentation, your application will contain several properties files that include an "environment" identifier in the name somehow. For example, config-production.properties
, config-qa.properties
, and config-development.properties
. If your goal is to select the appropriate properties to use according to the runtime environment, you have a few options available to you.
Your question implies that you are using maven filtering to replace the ${mule.env}
placeholder with a given environment at build time. While this works, it means that the application you deploy will select the same properties regardless of the environment it is deployed to.
Another option is to use JVM system properties or environment variables. Spring (the mechanism that loads these files) can automatically replace placeholders with the value provided when the java process is started.
One way to achieve this is to provide the JVM system property mule.env
using $MULE_HOME/conf/wrapper.conf
. Simply add a line similar to the following.
wrapper.java.additional.6=-Dmule.env=dev
Be sure to read the comments about additional properties and numbering that are labeled *** IMPORTANT ***
.
This way, you can configure each instance with a different environment, like "production" and "ci", and deploy the same application zip file to both.
Upvotes: 1
Reputation: 16544
Let me understand your question.
You have a mule aplication called app.zip with properties like : prop1 = 100
Now, you need deploy several intances of app.zip with its own settings:
app_1.zip
prop1 = 100
app_2.zip
prop1 = 200
app_3.zip
prop1 = 300
Is this your requirement?
If Yes, MAVEN could be a solution for this requirement.
If Not, I think that a solution with queues and decoupling your inbounds could be works.
I await your response, if you want I could give you an example configuration with maven or a queue basic configuration example.
Regards.
Upvotes: 0
Reputation: 2039
Running maven will use myEnv to configure a properties file for a selected environment only if you configure your Maven build to do so. But this will have the problem that you will use different packaged application. What you can do is to make the application lookup a properties file with the app name in it. Something like ${app.name}.env.properties, and of course you need to deploy the application with the original name and with a different name.
Upvotes: 0