Dynamic Configuration on TC startup

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamic Configuration on TC startup

Jerry Malcolm
The server solution I am developing is split across multiple Amazon Web
Services EC2 instances.  They all use the same TC WAR images.  But each
server handles a different portion of the functionality....
aaa.mydomain.com is called for one set of function, and bbb.mydomain.com
is called for another set of function.  This is not load balancing the
same server.  It's two separate TC "hosts" with two different server
names, but the same code base.

It hugely simplifies maintenance if I can create one EC2 server image
(AWS AMI) and clone it to both aaa.mydomain and bbb.mydomain servers. 
But the one issue is the TC configuration.  The TC host name on aaa
needs to be configured as aaa.mydomain.com and bbb TC host name needs to
be configured as bbb.mydomain.com.

I figure the brute force method is to clone the AMI to both and then
scp/ftp one TC config directory to aaa and a different TC config
directory to bbb.  That will work.  But in my mind it's not elegant, and
until I write automation scripts, it requires manual intervention.

This may be a short thread if you say that's the way to do it. Fine. 
But I do want to ask if there's any better ways to do this that I'm not
aware of, such as using RDNS or something at TC boot to identify if I'm
aaa or bbb based on my ip address and then boot the appropriate Tomcat
config accordingly.  Ok, maybe I'm just blue skying....  But I would
like a few opinions from people a lot closer to this area than I am.

One other fly in the ointment is that a few of the hosts currently have
light activity, but may grow.  So in a couple of cases, I have multiple
virtual TC hosts (ccc.mydomain, ddd.mydomain, and eee.mydomain) on one
single EC2 instance allowing for the capability to split any one of
those out to its own EC2 instance in the future as needed.

So EC2-a has aaa, EC2-b has bbb, and EC2-c has ccc, ddd, and eee hosts. 
But again, all of TC hosts run the same WAR packages.

Thanks.

Jerry


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Configuration on TC startup

Martynas Jusevičius
I think this is where you need to wrap your apps into Docker images :)

See this base image for example:
https://hub.docker.com/r/atomgraph/letsencrypt-tomcat
It configures server.xml by using an XSLT stylesheet and environmental
parameters: https://github.com/AtomGraph/letsencrypt-tomcat/blob/master/entrypoint.sh#L134

And this image extends it and adds the webapp (as ROOT) in a two-stage
build: https://github.com/AtomGraph/LinkedDataHub/blob/master/Dockerfile#L139

Hope it helps.

On Wed, Feb 24, 2021 at 12:45 AM Jerry Malcolm <[hidden email]> wrote:

>
> The server solution I am developing is split across multiple Amazon Web
> Services EC2 instances.  They all use the same TC WAR images.  But each
> server handles a different portion of the functionality....
> aaa.mydomain.com is called for one set of function, and bbb.mydomain.com
> is called for another set of function.  This is not load balancing the
> same server.  It's two separate TC "hosts" with two different server
> names, but the same code base.
>
> It hugely simplifies maintenance if I can create one EC2 server image
> (AWS AMI) and clone it to both aaa.mydomain and bbb.mydomain servers.
> But the one issue is the TC configuration.  The TC host name on aaa
> needs to be configured as aaa.mydomain.com and bbb TC host name needs to
> be configured as bbb.mydomain.com.
>
> I figure the brute force method is to clone the AMI to both and then
> scp/ftp one TC config directory to aaa and a different TC config
> directory to bbb.  That will work.  But in my mind it's not elegant, and
> until I write automation scripts, it requires manual intervention.
>
> This may be a short thread if you say that's the way to do it. Fine.
> But I do want to ask if there's any better ways to do this that I'm not
> aware of, such as using RDNS or something at TC boot to identify if I'm
> aaa or bbb based on my ip address and then boot the appropriate Tomcat
> config accordingly.  Ok, maybe I'm just blue skying....  But I would
> like a few opinions from people a lot closer to this area than I am.
>
> One other fly in the ointment is that a few of the hosts currently have
> light activity, but may grow.  So in a couple of cases, I have multiple
> virtual TC hosts (ccc.mydomain, ddd.mydomain, and eee.mydomain) on one
> single EC2 instance allowing for the capability to split any one of
> those out to its own EC2 instance in the future as needed.
>
> So EC2-a has aaa, EC2-b has bbb, and EC2-c has ccc, ddd, and eee hosts.
> But again, all of TC hosts run the same WAR packages.
>
> Thanks.
>
> Jerry
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Configuration on TC startup

Luis Rodríguez Fernández
Hello,

- server.xml templating + docker: nice solution Martynas, we are doing
basically the same but with shell envsubst
- TC virtual-host creation: perhaps you can make use of the
https://tomcat.apache.org/tomcat-9.0-doc/html-host-manager-howto.html

Cheers,

Luis

El mié, 24 feb 2021 a las 0:51, Martynas Jusevičius (<[hidden email]>)
escribió:

> I think this is where you need to wrap your apps into Docker images :)
>
> See this base image for example:
> https://hub.docker.com/r/atomgraph/letsencrypt-tomcat
> It configures server.xml by using an XSLT stylesheet and environmental
> parameters:
> https://github.com/AtomGraph/letsencrypt-tomcat/blob/master/entrypoint.sh#L134
>
> And this image extends it and adds the webapp (as ROOT) in a two-stage
> build:
> https://github.com/AtomGraph/LinkedDataHub/blob/master/Dockerfile#L139
>
> Hope it helps.
>
> On Wed, Feb 24, 2021 at 12:45 AM Jerry Malcolm <[hidden email]>
> wrote:
> >
> > The server solution I am developing is split across multiple Amazon Web
> > Services EC2 instances.  They all use the same TC WAR images.  But each
> > server handles a different portion of the functionality....
> > aaa.mydomain.com is called for one set of function, and bbb.mydomain.com
> > is called for another set of function.  This is not load balancing the
> > same server.  It's two separate TC "hosts" with two different server
> > names, but the same code base.
> >
> > It hugely simplifies maintenance if I can create one EC2 server image
> > (AWS AMI) and clone it to both aaa.mydomain and bbb.mydomain servers.
> > But the one issue is the TC configuration.  The TC host name on aaa
> > needs to be configured as aaa.mydomain.com and bbb TC host name needs to
> > be configured as bbb.mydomain.com.
> >
> > I figure the brute force method is to clone the AMI to both and then
> > scp/ftp one TC config directory to aaa and a different TC config
> > directory to bbb.  That will work.  But in my mind it's not elegant, and
> > until I write automation scripts, it requires manual intervention.
> >
> > This may be a short thread if you say that's the way to do it. Fine.
> > But I do want to ask if there's any better ways to do this that I'm not
> > aware of, such as using RDNS or something at TC boot to identify if I'm
> > aaa or bbb based on my ip address and then boot the appropriate Tomcat
> > config accordingly.  Ok, maybe I'm just blue skying....  But I would
> > like a few opinions from people a lot closer to this area than I am.
> >
> > One other fly in the ointment is that a few of the hosts currently have
> > light activity, but may grow.  So in a couple of cases, I have multiple
> > virtual TC hosts (ccc.mydomain, ddd.mydomain, and eee.mydomain) on one
> > single EC2 instance allowing for the capability to split any one of
> > those out to its own EC2 instance in the future as needed.
> >
> > So EC2-a has aaa, EC2-b has bbb, and EC2-c has ccc, ddd, and eee hosts.
> > But again, all of TC hosts run the same WAR packages.
> >
> > Thanks.
> >
> > Jerry
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

--

"Ever tried. Ever failed. No matter. Try Again. Fail again. Fail better."

- Samuel Beckett