build · deployment

An approach for automating Sitecore deployments with TeamCity at your machine

This post is a summary of my workshop at the company. However, it might be an initiative of your own approach for automating Sitecore deployments with TeamCity.

Update (27-Mar-2018): you can play with Sitecore 9 as well

Setup Prerequisites

How to set it up

  • use SIM to setup 03 new Sitecore 8.2 Update 4 instances:
    • 01 sitecore instance whose host name should be viethoang.ca.local
    • 01 sitecore instance whose host name should be viethoang.cd1.local
      • bind another host name tekcent.local to it
    • 01 sitecore instance whose host name should be viethoang.cd2.local
      • bind another host name demo.local to it
  • copy-paste \App_Config\ConnectionStrings.config of ca to overwrite the one of cd1 & cd2 to make sure 03 Sitecore instances using the same databases
  • install Node.js
  • install TeamCity 812
  • install Nuget.exe 3.5.0 tool in TeamCity
    • Administration -> Tools -> Install Tool…
    • asd_10
    • asd_11.png
  • install Gulp build runner to run gulp scripts in TeamCity
    • Upload it to TeamCity
    • Administration -> Plugins List -> Upload plugin zip
    • asd_1
    • note: if the link above does not work, select latest successful build here https://teamcity.jetbrains.com/viewType.html?buildTypeId=bt434
      • make sure downloaded .zip file is not corrupted
      • adsc9_1
      • put the downloaded plugin .zip file into <TeamCity Data Directory>/plugins folder (normally it’s C:\ProgramData\JetBrains\TeamCity\plugins)
    • restart TeamCity Server via Window Services
    • asd_2.png
  • import TeamCity_VhLocal.zip to TeamCity
    • Administration -> Projects Import -> Upload Archive then click  Configure Import Scope button
    • asd_3
    • check Vh local checkbox then click Start Import button
    • asd_4.png
  • go to Administration -> -> Vh Local -> CA – CD1 – CD2 -> Parameters in order to correct 04 Configuration Parameters because they might be different between my machine and your machine
    • asd_5
      1. vh.instanceRoot_CA: the full path parent folder of CA website folder
        • asd_6.png
        • Note: backslashes are escaped
        • Ex: “F:\\Sitecore Training\\viethoang.ca.local”
      2. vh.instanceRoot_CD1: the full path parent folder of CD1 website folder
        • Note: backslashes are escaped
        • Ex: “F:\\Sitecore Training\\viethoang.cd1.local”
      3. vh.instanceRoot_CD2: the full path parent folder of CD2 website folder
        • Note: backslashes are escaped
        • Ex: “F:\\Sitecore Training\\viethoang.cd2.local”
      4. vh.unicornFolder: the full path of an available folder which will stores *.yml files (Note: it should be short such as “D:\unicorn_files” in order to avoid “Windows File Paths Longer Than 255 Characters” issue in the very first run of Unicorn Sync)

What’s next?

Run build Vh Local :: CA – CD1 – CD2. Hopefully, you will have no any issues and when the build is done, you would see something like this:

asd_9.png

How to verify the automating Sitecore deployments on your machine

Open a browser, navigate to:

Hopefully, you would see something like this:

 

Got issues?

Please send your issues (with screenshots if possible) to viet.hoang.sitecore@gmail.com so that I have a chance to understand your problem and be able to suggest the solution.

Happy Sitecore coding!

REFERENCES

Advertisement

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.