Installing "core" on existing environment

Hi there,

just got started with TeamCity and I have to say: I love it.
After we are working on several platforms we'd like to separate the GUI from the actual build agents and therefore use an existing webserver.
Is there a way and maybe a howto somewhere that explains the installation on an existing webserver environment (apache2 and tomcat) without a build agent after they will be hosted separatly?

Thanks in advance.

11 comments
Comment actions Permalink

Hi Felix,

Sorry for delay.
If you already have configured web server, then please see how to install TeamCity into existing J2EE container. In this section you can find the detailed instructions for installing additional build agents.
TeamCity server comes bundled with one build agent, that is installed by default. You can stop the default agent or disable it on the Agents page of the web UI.
If you have any further questions or faced with any problems while setting up TeamCity, please feel free to ask.

0
Comment actions Permalink

Hi Alina,
thanks for the response.
Well, I did that but I am not able to configure the Data directory because actually I dont know where the config files are stored. I checked the entire filesystems but didnt find the specific files mentioned in: https://confluence.jetbrains.com/display/TCD9/TeamCity+Data+Directory#TeamCityDataDirectory-ConfiguringtheLocation

The webapp itself shows:

TeamCity has failed to start

Unable to initialize logs. The logs directories are not accessible for writing.

TeamCity server process does not have enough permissions to write into the log files under the directory:

/var/lib/logs


Please fix permissions and restart TeamCity. You can read more about TeamCity logs in documentation.

Thanks for your help.
0
Comment actions Permalink

Do you install new TeamCity server or move the existing one?
If you install new one, you should specify path to the data directory in

<TeamCity home directory>/conf/teamcity-startup.properties
file.
0
Comment actions Permalink

I installed a new one just by using die *.war file in my existing tomcat.
There is no "conf" directory. And I assume, that the home directory is /var/lib/tomcat7/webapps/teamcity

0
Comment actions Permalink

TeamCity data directory is created on first start. Please use %USERPROFILE%\.BuildServer on Linux. For more details please see https://confluence.jetbrains.com/display/TCD9/TeamCity+Data+Directory#TeamCityDataDirectory-LocationoftheTeamCityDataDirectory.

0
Comment actions Permalink

Hi,

well, I installed the teamcity.war
I opened the Site once with the following result:

TeamCity has failed to start

Unable to initialize logs. The logs directories are not accessible for writing.

TeamCity server process does not have enough permissions to write into the log files under the directory:

/var/lib/logs

Please fix permissions and restart TeamCity. You can read more about TeamCity logs in documentation.


I checked the entire server for ".BuildServer" but didn't find it.
So which parameters do I have to set to run the J2EE Application with an existing tomcat server?
0
Comment actions Permalink

Please use

TEAMCITY_DATA_PATH
environment variable or
<TeamCity home directory>/conf/teamcity-startup.properties to specify Data directory path. You something like this 
$HOME/.BuildServer
 instead of "
/var/lib/logs". And make sure that the user the TeamCity server is running under has read/write permissions for $HOME/.BuildServer directory.
0
Comment actions Permalink

So well,

after I did some intense debugging I got the following results:

- Downloading the TeamCity-9.1.4.war and installing it on a fresh installed Ubuntu 14.04 Server with tomcat7, deploying the app turns into the following result:

Unable to initialize logs. The logs directories are not accessible for writing.
TeamCity server process does not have enough permissions to write into the log files under the directory:
/var/lib/logs

- After some research I found out, that the variable "CATALINA_BASE" in JRE "catalina.base" is configured as logging direcory in /etc/tomcat7/logging.properties
- Starting up tomcat7 via init.d script sets the CATALINA_BASE to /var/lib/$NAME where $NAME is tomcat7
- All other logs, conf files etc. get deployed to this directory so therefore tomcat is running as supposed to

- the TeamCity-9.1.4.war on the other side wants to write to /var/lib/logs, so for debug reasons I gave tomcat the permission to write to this directory
- The result was a new folder /var/lib/logs with only one file: "teamcity-server.log"
- This file contains the following information:

[2015-11-20 19:11:51,416]   INFO -  jetbrains.buildServer.STARTUP - ===========================================================
[2015-11-20 19:11:51,416]   INFO -  jetbrains.buildServer.STARTUP - Starting TeamCity server
[2015-11-20 19:11:51,551]   INFO -  jetbrains.buildServer.STARTUP - TeamCity version: 9.1.4 (build 37293), data format version 727
[2015-11-20 19:11:51,561]   INFO -  jetbrains.buildServer.STARTUP - OS: Linux, User: tomcat7, JRE: 1.7.0_85, OpenJDK 64-Bit Server VM (24.85-b03, mixed mode), OpenJDK Runtime Environment (1.7.0_85-b01), Oracle Corporation
[2015-11-20 19:11:51,562]   INFO -  jetbrains.buildServer.STARTUP - JVM parameters: -Djava.util.logging.config.file=/var/lib/tomcat7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC -Djava.endorsed.dirs=/usr/share/tomcat7/endorsed -Dcatalina.base=/var/lib/tomcat7 -Dcatalina.home=/usr/share/tomcat7 -Djava.io.tmpdir=/tmp/tomcat7-tomcat7-tmp
[2015-11-20 19:11:51,562]   INFO -  jetbrains.buildServer.STARTUP - Garbage collection: ParNew, ConcurrentMarkSweep
[2015-11-20 19:11:51,573]   INFO -  jetbrains.buildServer.STARTUP - Web server version: Apache Tomcat/7.0.52 (Ubuntu)
[2015-11-20 19:11:51,573]   INFO -  jetbrains.buildServer.STARTUP - Server IP address: 127.0.1.1
[2015-11-20 19:11:51,581]   INFO -  jetbrains.buildServer.STARTUP - Web server ports: 8080 (protocol: HTTP/1.1, scheme: http), 8005 (shutdown port)
[2015-11-20 19:11:51,594]   INFO -  jetbrains.buildServer.STARTUP - Version file lock was successfully obtained: /var/lib/tomcat7/webapps/teamcity/BUILD_37293
[2015-11-20 19:11:51,604]   INFO -  jetbrains.buildServer.STARTUP - Servlet real path: /var/lib/tomcat7/webapps/teamcity/
[2015-11-20 19:11:51,613]   INFO -  jetbrains.buildServer.STARTUP - Current stage: Looking for the TeamCity Data Directory
[2015-11-20 19:11:51,613]   INFO -  jetbrains.buildServer.STARTUP - The TeamCity Data Directory path is determined using the user home directory
[2015-11-20 19:11:51,618]   INFO -  jetbrains.buildServer.STARTUP - The TeamCity Data Directory "/home/tomcat7/.BuildServer" doesn't exist
[2015-11-20 19:11:51,618]   INFO -  jetbrains.buildServer.STARTUP - Asking user to confirm first start with the predefined TeamCity Data Directory path
[2015-11-20 19:11:51,618]   INFO -  jetbrains.buildServer.STARTUP - Startup confirmation is required. Open TeamCity web page in the browser
[2015-11-20 19:11:51,619]   INFO -  jetbrains.buildServer.STARTUP - Current stage: Confirming TeamCity first start (administrator login is required to proceed)


comparing my setup with the full Teamcity-9.1.4.tar.gz did not showed any difference yet. I am sure there must be one because starting the runAll.sh in my environment works without errors.
So I copied the webapps contents to my tomcat server: same error as mentioned above.

Next step: I started my tomcat using the conf files from the full installer instead of the ones coming with default installation. Now tomcat does not start up with the following message:

Nov 27, 2015 11:35:57 AM org.apache.catalina.startup.Catalina load
WARNUNG: Catalina.start using conf/server.xml: Error at (23, 77) : org.apache.catalina.startup.VersionLoggerListener
Nov 27, 2015 11:35:57 AM org.apache.catalina.startup.Catalina start
SCHWERWIEGEND: Cannot start server. Server instance is not configured.


If I uncomment the corresponding line in server.xml it starts up with the above-mentioned errors. So therefore I assume this Listener is essential.
But I don't know where I am missing it out.

Sorry for this intense debugging, but I'd like to use our existing tomcat and this just keeps bugging me. :)

Regards,
Felix

0
Comment actions Permalink

Hi Felix,

Did you follow all the instructions from the section: https://confluence.jetbrains.com/display/TCD9/Installing+and+Configuring+the+TeamCity+Server#InstallingandConfiguringtheTeamCityServer-InstallingTeamCityintoExistingJ2EEContainer ?
In particular #7 step: configure the TeamCity logging properties by specifying the

log4j.configuration
and
teamcity_logs JVM options. 
0
Comment actions Permalink

oh damn.. got it to work... Finally..

On Ubuntu 14.04 with tomcat7 it works by setting the following in /etc/default/tomcat7:

JAVA_OPTS="-Dteamcity_logs=logs/ -Djava.awt.headless=true -Xmx1024m -XX:+UseConcMarkSweepGC"

Hint: Adjust the memory as well.

Thanks a lot for your help.

0
Comment actions Permalink

Thank you for the update. Nice to hear that everything works now!

0

Please sign in to leave a comment.