build · deployment

Playing Sitecore 9 auto-deploy with TeamCity on 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 9 deployments with TeamCity.

Setup Prerequisites

How to set it up

  1. setup 03 new Sitecore 9.0 Update 1 instances:
    • 01 sitecore instance whose host name should be viethoang.cm.local
    • 01 sitecore instance whose host name should be viethoang.cd1.local
      • bind another host name tekcent.local
    • 01 sitecore instance whose host name should be viethoang.cd2.local
      • bind another host name demo.local
  2. copy-paste \App_Config\ConnectionStrings.config of cm to overwrite the one of cd1 & cd2 to ensure 03 Sitecore instances using the same databases
  3. install Node.js
  4. install TeamCity
  5. install Nuget.exe tool (latest version) in TeamCity
    • Administration -> Tools -> Install Tool…
    • asd_10
  6. install Gulp build runner to run gulp scripts in 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
  7. import TeamCity_VhLocal.zip to TeamCity
    • Administration -> Projects Import -> Upload Archive then click  Configure Import Scope button
    • asd_3
    • check Viet Hoang – Simple Development Framework checkbox and then click Start Import button
    • adsc9_2
  8. go to Administration -> <Root Project> -> Viet Hoang – Simple Development Framework -> CM – CD1 – CD2 -> Parameters in order to correct 08 Configuration Parameters because they might be different between my machine and your machine
    • adsc9_3
      1. vhs.deployIisAppPath_CD1: the CD1 website name in IIS
        • adsc9_4
      2. vhs.deployIisAppPath_CD2: the CD2 website name in IIS
        • adsc9_5
      3. vhs.deployIisAppPath_CM: the CM website name in IIS
        • adsc9_6
      4. vhs.instance.root: the full path parent folder of CM/CD1/CD2 website folder
      5. vhs.instance.name_CD1: the name of CD1 website folder
        • Ex: CD1 website root is “F:\Sitecore Training\viethoang.cd1.local” then the value is viethoang.cd1.local
      6. vhs.instance.name_CD2: the name of CD1 website folder
        • Ex: CD2 website root is “F:\Sitecore Training\viethoang.cd2.local” then the value is viethoang.cd2.local
      7. vhs.instance.name_CM: the name of CM website folder
        • Ex: CM website root is “F:\Sitecore Training\viethoang.cm.local” then the value is viethoang.cm.local
      8. vhs.unicorn.sourceFolder: the full path of an available folder which will stores *.yml files (Note: it should be short such as “C:\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 Viet Hoang – Simple Development Framework :: CA – CD1 – CD2. Hopefully, you will have no any issues and when the build is done, you would see something like this:

adsc9_7

 

How to verify the automating Sitecore deployments at your machine

Hopefully, you would see something like this:

 

This slideshow requires JavaScript.

Note: you can play with Web Deploy (should ensure to enable its all features)

adsc9_10

as well by updating parameter vhs.forceToPublishWithMsBuild to false

  • go to Administration -> <Root Project> -> Viet Hoang – Simple Development Framework -> CM – CD1 – CD2 -> Parameters
  • adsc9_9

References

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!

4 thoughts on “Playing Sitecore 9 auto-deploy with TeamCity on your machine

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

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

Google+ photo

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

Twitter picture

You are commenting using your Twitter 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.