Environment Variables

Post any suggestions or enhancement requests about the Verj.io platform or this Forum

Moderators: Jon, Steve, Ian, Dave

Steve James
Ebase User
Posts: 331
Joined: Mon Mar 10, 2014 8:34 am

Environment Variables

#1

Postby Steve James » Wed Apr 01, 2015 9:47 am

We are well down the line of using Ebase Environment variables but each change requires a restart to Tomcat.
We've a large number of users and a number of unattended forms eg room bookings displayed on a TV in a reception area which refreshes every 30 minutes.

It would be good if Ebase had an enhancement to retrieve environment variables from a file which doesn't result / require a restart of Tomcat.

Thanks
0 x

alexmcclune
Ebase User
Posts: 95
Joined: Wed Feb 27, 2013 5:16 pm

#2

Postby alexmcclune » Wed Apr 01, 2015 10:12 am

+1
0 x

Steve James
Ebase User
Posts: 331
Joined: Mon Mar 10, 2014 8:34 am

#3

Postby Steve James » Wed Apr 01, 2015 11:01 am

An update

1 - by default Tomcat will reload the UFS web application if I make a change to the web.xml

tomcat\conf\context.xml
WatchedResource - The auto deployer will monitor the specified static resource of the web application for updates, and will reload the web application if it is updated. The content of this element must be a string.
https://tomcat.apache.org/tomcat-7.0-do ... Components

2 - by default Tomcat persists sessions across restarts - http://tomcat.apache.org/tomcat-7.0-doc ... s_Restarts

So I guess currently my options are
a, stop the WatchedResource and schedule a restart at a quiet time?
b, not worry and make changes to the web.xml and take the hit on the number of users who interact with the form while the web application is restarting?
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#4

Postby Jon » Wed Apr 01, 2015 12:22 pm

A couple of comments:

1. You can stop Tomcat automatically reloading the web app by setting reloadable="false" in the ufs.xml file in tomcat/conf/Catalina/localhost. This will also make it a little faster.

2. An alternative to using environment variables is to use your own properties file. This would just be a lot of key=value properties. Then you could choose to load this whenever you wanted to - but you would need script code to do this. I could cobble together some code to illustrate this if anyone is interested. Also I'm aware that I've previously recommended using environment variables as the solution to this issue, so don't want to confuse people.

Regards
Jon
0 x

Steve James
Ebase User
Posts: 331
Joined: Mon Mar 10, 2014 8:34 am

#5

Postby Steve James » Wed Apr 01, 2015 1:29 pm

Thanks Jon.

1 - hmmm that's confused me now. I tested making a change to web.xml and saving it and UFS definitely restarted, if I refreshed my web page quickly after I saved the file I got a 404 error on ufsajax. If I refreshed a minute or so later my form reloaded (proving session persistence to my mind). The test form also had a script to pull details of a new environment variable (pre save I unsurprisingly got an undefined error, post save and reload the value of the new environment variable was returned).

Now for where I am confused - reloadable="false" in the ufs.xml file in tomcat/conf/Catalina/localhost.


2 - yes I've used this in 1 area as we had a config file for another non Ebase solution that was common so I make use of the common JSON config by reading it in a Javascript and evaluating the content. Very useful.

Environment Variable as you say are more Ebase standard (or at least what you've been pushing).
Our form developers have been asked to use environment variables where ever possible. The new information regarding reloading and session persistence reduces the perceived impact as we'd not investigated Tomcat and how saving changes to web.xml impacted our users.

We can (I believe) reduce the impact still further by removing the WatchedResource so changes to web.xml do not force a reload. I can then schedule a restart in the middle of the night (one to prove over the next few days).

Thanks
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#6

Postby Jon » Thu Apr 02, 2015 7:06 am

Steve,

I was surprised by your reply about reloading Tomcat web apps. I was expecting reloadable="false" to deactivate all automatic reloading. But it doesn't - it still reloads when web.xml is changed. The way it seems to work is that to turn off all reloading you have to do two things:

1. Set reloadable="false". This stops reloading when something on the class path is changed e.g. a file in WEB-INF/classes or WEB-INF/lib.

2. Comment out the WatchedResource line for WEB-INF/web.xml in tomcat/conf/context.xml. This stops reloading when web.xml changes.

In general, reloading should be disabled for an Ebase web app, particularly a production system. The reasons are: 1) the system is down for a few seconds so users can suffer, 2) there is a memory issue shutting down some of the background threads and this can lead to PERMGEN out of memory failures which crash the entire Tomcat system.

Regards
Jon
0 x


Who is online

Users browsing this forum: No registered users and 3 guests