Monday, December 6, 2021

Installing TeamCity Continuous Integration / Continuous Deployment DevOps Environment

Hi,
In this post I am going to talk about installing TeamCity which is a DevOps Continuous Integration and Deployment Server.

Prerequisite(s)
SNoNameVersionDownload PageDirect Link
1Java1.8 or >N/AN/A
2MySql8.0 or >N/AN/A
3Team City2020.1 or >N/AClick to Download

The installation of Java and Mysql is off the topic, if you need a discussion point on that... for MySql let me share the link below to have a detailed explanation on how to install MySql in ubuntu and for Java you can refer any online resources which is appropriate for the operating system that you have.

 
Having said Java and Mysql are installed, let us proceed forward for the installation of Team City

Installation of Team City
Download the package from the prerequisites section and move it to your favorite location.

Use the following command to untar the package to your favorite location

$ tar -xzf TeamCity-2020.1.tar.gz

Now you will have a fully exploded package of Team City and this concludes the installation of Team City Continuous Integration/ Continuous Deployment

We can run team city service with two different modes

1. Evaluation
2. Production

Let us discuss the above mentioned modes in detail

Starting Team City Service
Whether we run team city for evaluation or for prodcution, we should have a database for team city in place.... in our case "teamcity_ci" is the database created in mysql server.

For Evaluation

In order to have Team City to run in Evaluation mode..

Open a terminal window and navigate to the bin directory of Team City and run the command given below....

$ ./runAll.sh start

Now open up a browser and hit the following url

Now the user interface would ask user details to key in and proceeding further you have key in the database details as well....

Top stop the service use the following command...
$ ./runAll.sh stop
 
Well this concludes starting team city service for evaluation 

For Production
To have team city run in production mode we have to use the script teamcity-server.sh which resides in bin directory

$ ./teamcity-server.sh start

Now open up a browser and hit the following url

To stop the service use the following command...
$ ./teamcity-server.sh stop

To know about the options to be used with command just run the following...
$ ./teamcity-server.sh

Well this concludes starting team city service for production

Team City auto start on server startup
This section talks about having team city service up and running during the server startup/reboot

Create a file named "teamcity" under the folder /etc/init.d folder open that file in your favorite text editor, in our case vi editor 
 
The following commands would detail how the file has to be created and edited
 
$ sudo touch /etc/init.d/teamcity
$ sudo vi /etc/init.d/teamcity
 
If one of above two commands prompts for the password, please provide one associated with the user.
 
append the file with following content...

#!/bin/sh
### BEGIN INIT INFO
# Provides: TeamCity autostart
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start teamcity daemon at boot time
# Description: Enable service provided by daemon.
# /etc/init.d/teamcity - startup script for teamcity
### END INIT INFO
# Ensure you enter the right user name that TeamCity will run under
USER="admin" ## CHANGE THIS USER NAME TO MATCH YOUR USERNAME
case $1 in
start)
start-stop-daemon --start -c $USER --exec ./TeamCity-2020-1/bin/teamcity-server.sh start
;;
stop)
start-stop-daemon --start -c $USER --exec ./TeamCity-2020-1/bin/teamcity-server.sh stop
;;
esac
exit 0


Change file permission of "teamcity" in /etc/init.d

If the team city server is up and running stop it first before you make these changes and on terminal fire up the following three commands....
$ sudo chmod +x /etc/init.d/teamcity
$ sudo update-rc.d teamcity defaults
$ sudo /etc/init.d/teamcity start

Well that is it, with this we have concluded the installation of TeamCity CI/CD server.

Hope you had great time reading.

No comments:

Post a Comment

How to change the root password in linux when it is forgotten/to change

This blog is all about changing the root password of the Linux system when it is forgotten or to reset the password...   Let's get it ...