1

We have a tomcat server up and running. We want our application to run as 5 independent instances on this tomcat server. Each instance needs a different set of command line arguments to run properly.

How can we pass those arguments per instance?

We run the current version of tomcat server. We have a Spring-Boot-Application which needs to run as 5 instances on this tomcat server. This is so that each instance takes care of a single port and on the business-level serves a different environment (dev, test, ...).

We are using different spring profiles per environment and therefore need to pass those to each instance running on tomcat.

Thing is: We cannot figure out how to pass those arguments. There seems like no configuration to do this per instance. We know about the JAVA_OPTS which are used on the entire tomcat.

We thought about declaring those arguments envrionment variables, but: - potential other applications shouldn't know about those configurations. - the configuration is pretty specific per instance and therefore a lot of 'noise' is produced which might be hard to maintain in the future.

As we look for the right place and right way to do that, there is no code yet.

Expected result: 5 instances of the same application are up and running on a tomcat server, each configured individually. Hoped for: A way to alter the config.xmls or alter a batch script to pass command line args.

2 Answers 2

1

You can't give parameters when deploying a war, so that's out of the question.

You'll have to do 5 builds, but then you can set the profiles to be used in application.properties. Shouldn't be too hard to automate, and technically you only need to build once, if you then make copies of the war and replace the property file.

Sign up to request clarification or add additional context in comments.

Comments

0

Update: What we finally came up to: We have an individual context.xml for each instance and each environment. The differenct context.xmls are managed in a repository.

During deployment the respective context.xml is copied next to the war-file. We are pretty happy with this solution, as we were able to automate the entire process and even have a context repository in place.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.