Running production (production release) and staging (prerelease test) on the same Tomcat

47 views
Skip to first unread message

Ondřej Němeček

unread,
Jun 6, 2015, 1:53:44 PM6/6/15
to acti...@googlegroups.com

Hi all,

I use ActiveJDBC + ActiveWeb for small website project.

I wonder how to run application in production and staging versions on the same Tomcat.

Currently I set ACTIVE_ENV=production-tomcat in catalina.properties so this variable is shared across whole Tomcat container. So all application instances uses database connection defined for "production-tomcat" environment.

Is there some way to set ACTIVE_ENV in Tomcat per host? How to deal with this?

For now It looks like most straightforward way is use two separated Tomcats. But maybe you will have better idea...

Thanks,
Ondrej Nemecek.

Igor Polevoy

unread,
Jun 6, 2015, 4:40:36 PM6/6/15
to acti...@googlegroups.com
Ondrej, this is a great question. 

We run multiple projects with ActiveWeb + ActiveJDBC and maintain many environments (development, test, staging, production). 
We use: https://github.com/javalite/activejdbc/tree/master/app-config to source property files for appropriate environments based on ACTIVE_ENV system variable. 

We use Jetty locally and Tomcat in all other environments. We do not run multiple applications on the same instance of Tomcat. We run multiple Tomcat instances, 
and every application is deployed on a separate Tomcat as a ROOT.war. This allows us to restart and maintain applications independently from one another. 

Usually we specify an environment as:

export ACTIVE_ENV=production

in script  Tomcat/bin/setenv.sh

Also, we have separate servers for separate environments. We do not run production and stating on the same server. 

I hope this helps. 

Thank you
igor

Ondřej Němeček

unread,
Jun 8, 2015, 6:08:43 PM6/8/15
to acti...@googlegroups.com

Thanks,

it helps, it looks like I will use multiple Tomcat instances.

Do you use proxy when running multiple instances on the same machine, so you can use port 80 when accessing Tomcat instances from browser? Or do you use Tomcat without proxy and accessing Tomcat instances through different ports?

With best regards,
O.

Igor Polevoy

unread,
Jun 9, 2015, 2:57:13 PM6/9/15
to acti...@googlegroups.com
yes, we do Usually we run at least two nodes of every application and configure NGinx or Apache as a load balancer with sticky sessions/ 

We do use HTTP sessions, but place a tiny lightweight object there. 
Load balancer pins a session to a node. 

tx
Reply all
Reply to author
Forward
0 new messages