Changing data path in Tomcat 7

Hi!

I'm running the WAR distribution of TeamCity on a Linux system with Tomcat 7. I seem to be unable to change the data path used by TeamCity.

So far I've tried:

  • Globally setting the TEAMCITY_DATA_PATH environment variable for my server (the docs are talking about a Linux environment variable, not some other kind of Tomcat environment variable, are they?). I even rebooted my server to ensure the environment variable was set for the shell Tomcat runs in.
  • Adding the following to my conf/web.xml:

<env-entry>
    <env-entry-name>teamcity.data.path</env-entry-name>
    <env-entry-value>/home/teamcity/</env-entry-value>
    <env-entry-type>java.lang.String</env-entry-type>
</env-entry>


Both times, TeamCity complained about not being able to create its database in /dev/null/.BuildServer.

I'm not that familiar with Tomcat and its inner workings, but I think that assigning a home directory for my Tomcat user or editing Tomcat's init script would not be the cleanest of options.

7 comments
Comment actions Permalink

I also attempted to add the <env-entry /> to my WEB-INF/web.xml without success.

Then I tried putting it in my /etc/conf.d/tomcat-7 (no idea what the equivalent on other distros than Gentoo is):

# Where your web applications are located
CATALINA_HOME=/usr/share/tomcat-7/
CATALINA_BASE=/var/lib/tomcat-7/


# TeamCity home directory
TEAMCITY_DATA_PATH="/home/teamcity/"


Again, no success.

Running a 'grep -r "TEAMCITY_DATA_PATH" *' on the extracted contents of the WAR archive yields nothing, as does a 'grep -r "teamcity.data.path" *'. I am beginning to believe that the documentation is simply wrong.

0
Comment actions Permalink

Hello Markus,

What version of TeamCity do you use?

Thanks in advance,
Marina

0
Comment actions Permalink

Same problem. I want to have 6.0 and 6.5 teamcitys, running simultaniously on my tomcat 6. But unfortunally, i can specify data path only in global JAVA_OPTS (-Dteamcity.data.path='/lfoo/bar/').
Is there any solution to define data path for tomcat application, not to whole JVM, if I have 2 separate databases and 2 .BuildServer folders&

0
Comment actions Permalink

I'm running TeamCity 6.0.2.

Thanks @Stas, I didn't try setting JAVA_OPTS globally for my TomCat yet.

I did in the meantime install Jenkins, another CI server, on my system and it took me less than 5 minutes to figure out: after installing the package, one can simply define the home directory in the instance's web.xml (on my system found in /var/lib/tomcat-7/webapps/jenkins/WEB-INF/ where 'jenkins' is the name of the instance):

<!-- if specified, this value is used as the Hudson home directory -->
<env-entry>
  <env-entry-name>HUDSON_HOME</env-entry-name>
  <env-entry-type>java.lang.String</env-entry-type>
  <env-entry-value>/home/jenkins/</env-entry-value>
</env-entry>


Wish it was that easy with TeamCity :)

0
Comment actions Permalink

Hi Markus

Thanks for feedback. We created a request TW-15868, please comment/vote for it.

Michael

0
Comment actions Permalink

Hi Stas

Could you share a use case with us - what's a goal to have two TeamCity instances deployed in parallel?

Thanks

0
Comment actions Permalink

It's cool to have ability to deploy new version of TC on same server as current working TC, to check if it works with my projects on definite server.

0

Please sign in to leave a comment.