Below are the steps to create a TeamCity installation for deployment using Bitbucket.
Live Web server
Pre-requisites
In the solution in Visual Studio, you will need:
- NuGet folder
With:
- nuget.config
- nuget.exe
- nuget.targets
Project folder
You will also require a Build directory:
- Build
- dev.build
- Microsoft.Web.Publishing.Tasks.dll
- stage.build
- production.build
Bitbucket details:
https://bitbucket.org/gocompanyName/projectName-cms
[email protected]:gocompanyName/projectName-cms.git
Also, Install
Git for Windows
Tortoise Git for windows
During installation make sure to select Putty for SSH,
- Check that the server has enough CPU & RAM.
- Acquire correct 'new' server details.
- Check IIS is installed and running.
- Install Visual Studio Community (latest version) - This ensures the latest version of .NET is installed and the build agents that Team City uses are also installed. Plus it's extremely useful for the server side, debugging etc.
- Download and install the latest version of TeamCity.
- Start Installer
- Set the port to 8080
- Install to the default directory
- Make sure services are set to run under the SYSTEM account.
- Save default build agent settings -> Just click Save.
- Copy the Microsoft JDBC Driver (in drivers folder) - Into the following directory,
C:\ProgramData\JetBrains\TeamCity\lib\jdbc
- During the installer, the process selects MS SQL Server and adds the following credentials.
- Database Setup,
- Create a new, empty database and call it TeamCity - with 'SA' permissions (default)
- Do not add Instance name (leave blank)
- Database name: 'TeamCity'
- username: sa
- password: password for the sa account
- Create a User account,
Username: admin
Password: admin password here
- Navigate to TeamCity: http://localhost:8080/
- Create a Project:
Name: PROJECTNAME
ProjectId: ProjectName
Description: PROJECTNAME
- Create a new Build Configuration.
Name: PROJECTNAME_Web
Project Configuration Id: ProjectName_ProjectNameWeb
- Install Putty if it isn't already installed
- Run Putty
- Generate a new key.
- Save public as public.txt in C:\SSH
- Save private as private.ppk C:\SSH
- In TeamCity - Go to project settings -> SSH -> Upload new key. Upload the private key.
- Leave Putty Open and running with the key in the window as you need this for a copy and paste operation later.
- Then go to VCS Roots ( New VCS (Version Control Settings) section.)
- Set up VCS
- Type of VCS: Git
- VCS Name: PROJECTNAMEWeb
- Fetch URL: [email protected]:gocompanyName/projectName-cms.git (or clone link of the git repo)
- Push URL: leave blank
- Default branch: refs/heads/master
- Then leave everything else as the default setting apart from the Authentication Method. Set to the uploaded key. Choose the private key.
- Click Save (When you have completed the next step you can test the connection.)
- Log into Bitbucket -> Account Settings --> SSH Keys
- Click Add Key
- Give it a meaningful name.
- Copy and paste the private key from pUtty
- Click save.
- Make sure the project builds transformation file
- Back into TeamCity
- Project Settings -> General Settings -> Build COnfigurations -> Edit
- From left menu go to Build Steps.
- In the project folder in windows explorer, locate the Build directory and create a copy of the stage.build, rename to release.build.
- Update the <Configuration tag to'Release'. <Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
- Update the OutputFolder to exact location: <OutputFolder>C:\Websites\Production\CompanyName.ProjectName.Web</OutputFolder>
- Next we need to create the Web.config file version in Visual Studio.
- You should be able to create a new release version of the web.config file using the Configuration Manager tool.
- Copy the contents of stage to set up the correct parameters.
- Update this with the correct server & connection details.
- Once you're happy with the configuration files, add them to source control, commit and push. Make sure they are set to debug=false, trace=false.
- Once committed, go back to the TeamCity installation and navigate to,
<Root project> -> PROJECTNAME -> PROJECTNAME_Web -> Edit Settings -> Build Steps -> Auto-Detect Build Steps
- Select: Build/release.build
- In the edit screen, you can add value as in the TeamCity image in the folder.
- Finally, run the build; it should deploy to the correct folder.
- Copy it across any static files which are not committed to source control.
- Check that the correct settings are in the config files. Update and re-commit if necessary and then re-deploy to update the files -- do not copy directly to the deployment folder.
- Finally set up a website in IIS and configure with the correct domain name to the correct assigned address.
Make sure to add permissions to the folder to which Umbraco is installed.
- NETWORK SERVICE & IIS_USERS (both full permissions).