TeamCity Application Deployment Process

TeamCity Application Deployment Process

Build

Projects need to be built before they can be deployed. Typically, for back-end Java projects, this means generating a .war file. TeamCity builds our projects using Build Configurations that we have configured. These Build Configurations are named the same as the project name and are organized into folders.

Build Configurations

When creating a new Build Configuration, use a Template if one is available and applicable to your project. If no applicable Template is available, strongly consider creating a new one since other projects will likely share the same structure as yours. The Template will provide you with a basic setup for your build, but you will have to customize it to fit your specific project.

Version Control

At the bare minimum, you will have to select your VCS Root (version control system root). Select your project from either Git (new projects) or SVN (legacy projects).

Triggers

Your template should at least have 1 trigger that triggers off commits to the default branch. Other triggers can be added, such as a trigger that triggers when a dependency of the project finishes building.

Other Settings

Other tabs such as Build Steps, Failure Conditions, Build Features, etc. should likely come from the template and should rarely be customized.

Build Templates

Java 17 Build

The Java 17 Build template tests a Java 17 project and builds a .war file. Build Configurations for older Java versions do not have a template and were created by copying existing Build Configurations.

React Build NPM Publish

The React Build NPM Publish template is used for our “dependency” React projects. It tests and builds the project and publishes the built package to our private NPM repository, Verdaccio. To accomplish this, an NPM Registry Connection is specified in the Build Features.

In addition to running whenever there is a commit to the main branch, it will also run whenever there is a pull request created that targets the main branch. In this case, it will only run tests and will not build or publish. The status of the build will be published to the pull request in GitHub. This requires two Build Features: Pull Requests and Commit Status Publisher.

React Build For Deploy

The React Build For Deploy template is used for our deployed React web applications. It tests and builds the project, producing an artifact that is ready to be deployed to a web server. To pull dependencies from Verdaccio, an NPM Registry Connection is specified in the Build Features.

In addition to running whenever there is a commit to the main branch, it will also run whenever there is a pull request created that targets the main branch. In this case, it will only run tests and will not build or publish. The status of the build will be published to the pull request in GitHub. This requires two Build Features: Pull Requests and Commit Status Publisher.

Deploy

The Build Configurations in the Deploy project are responsible for deploying our applications to our different environments. Much like our builds, deployment configurations should use an existing template if possible.

Deploy Templates

Maven War Deploy - Non-Prod

The Maven War Deploy – Non-Prod template handles deployments of our Java applications to our non-production Tomcat servers.

The template is built using the device-management project, so some changes need to be made to any new deployment created from this template.

1.      Under the Triggers tab, Edit the Finish Build Trigger and replace the device-management build configuration with your own project’s build configuration. Make sure the Branch Filter has the correct default branch name, depending on the version control system.

2.      Under the Dependencies tab, Edit the Artifact Source and replace the device-management build configuration with your own project’s build configuration.

3.      Under the Parameters tab, override the applicationName parameter with the name of your application. Also override the devServer and testServer if needed.

When selecting Deploy, you will be prompted to select an Environment to deploy to (dev or test). There is also a checkbox labeled Restart Only which, if checked, will just restart the application that is currently deployed to that environment instead of deploying a new .war file.

Maven War Deploy – Prod

The Maven War Deploy – Prod template handles deployments of our Java applications to our production Tomcat servers.

The template is built using the device-management project, so some changes need to be made to any new deployment created from this template.

1.      Under the Triggers tab, Edit the Finish Build Trigger and replace the device-management build configuration with your own project’s build configuration. Make sure the Branch Filter has the correct default branch name, depending on the version control system.

2.      Under the Dependencies tab, Edit the Artifact Source and replace the device-management build configuration with your own project’s build configuration.

3.      Under the Parameters tab, override the applicationName parameter with the name of your application. Also override the prodServer if needed.

When selecting Deploy, you see the prod environment selected. There is also a checkbox labeled Restart Only which, if checked, will just restart the application that is currently deployed to that environment instead of deploying a new .war file.

After confirming the deployment, it will need 2 approvals from the Prod Deploy Approvers group for it to start. If the user that creates the deployment is in the Prod Deploy Approvers group, they will automatically count as 1 of the approvers.

React Web Deploy - Non-Prod

The React Web Deploy – Non-Prod template handles deployments of our React applications to our non-production web servers.

The template is built using the customer-portal project, so some changes need to be made to any new deployment created from this template.

1.      Under the Triggers tab, Edit the Finish Build Trigger and replace the customer-portal build configuration with your own project’s build configuration.

2.      Under the Dependencies tab, Edit the Artifact Source and replace the customer-portal build configuration with your own project’s build configuration.

3.      Under the Parameters tab, override the applicationPath parameter with the path to your application on the server. Also override the devServer and testServer if needed.

When selecting Deploy, you will be prompted to select an Environment to deploy to (dev or test).

React Web Deploy – Prod

The React Web Deploy – Prod template handles deployments of our React applications to our production web servers.

The template is built using the customer-portal project, so some changes need to be made to any new deployment created from this template.

1.      Under the Triggers tab, Edit the Finish Build Trigger and replace the customer-portal build configuration with your own project’s build configuration.

2.      Under the Dependencies tab, Edit the Artifact Source and replace the customer-portal build configuration with your own project’s build configuration.

3.      Under the Parameters tab, override the applicationPath parameter with the path to your application on the server. Also override the prodServer if needed.

When selecting Deploy, you see the prod environment selected.

After confirming the deployment, it will need 2 approvals from the Prod Deploy Approvers group for it to start. If the user that creates the deployment is in the Prod Deploy Approvers group, they will automatically count as 1 of the approvers.


    • Related Articles

    • Central Deployment Process

      Run SQL scripts in http://sourcecontrol.fullcount.net/repos/internal/trunk/at-fullcount-model/src/main/resources/sql/nextDeploy Pause TeamCity test for fullcount-uptime-production-overnight. Download release war file from archiva for all ...
    • Remote Deployment Process - Java

      Deployment Process Determine if a valid argument has been passed in Only continue if downloadOnly, postDownload, fullDeployment, handleSuccess, checkHash, verifyApplications passed through. Lock file to stop deployment from running more than once ...
    • Run Remote Deployment Process - Java

      Remote Server Configuration This has already been completed for all existing remote servers. Java 1.8 installed Tomcat located at /srv/tomcat XE database installed and running with fc_obj_owner user Directory /home/deployment exists Database backup ...
    • Overview of Deployment Process for Remote Servers

      Overview of Deployment Process for Remote Servers Introduction The process for updating the Touchscreen and Back Office applications is known as the deployment process. The deployment process is only used for updating applications and databases on ...
    • Post Central Deployment Tasks

      Post Central Deployment Tasks Objectives Complete necessary post-deployment tasks Prerequisites Access to Redmine Access to production database Access to fcadmin Access to deployment test server Instructions Send release docs Release docs are located ...