Skip to main content

Web Deploy setup and configuration with Sitecore

Web Deploy empowers Visual Studio and WebMatrix to help developers streamline the deployment of Web applications to Microsoft IIS Web servers or to Microsoft Azure Websites. In addition, integration with Web Platform Installer allows developers to simply and easily install community webapplications. 

This post describe the installation of Web Deploy and Configuration with Sitecore instance. 

This post will be very useful if you want to sync your Sitecore media items with all of the CD's environment (Distributed environment) . In one of my previous project, I was keeping all the media items in file system and synchronizing all the files from CM to Cd's server. This solution is tested with 1 CMS and 6 CD's server (2-EU, 2- NA, 2- AP) with more than 5 Lakh files. 

1.     Software Pre-requisites

          a.       OS – Window 7/ Windows Server 2008 R2 Enterprise
          b.       CMS – Sitecore 8.0
          c.       WebDeploy_amd64_en-US.msi      

                  

2.      Installation

Download the latest version of web deploy installer for Windows (64bit) using the below link. 



Follow below steps for installtion: 

  1. Click on Download.
  2. In the File Download dialog box, click Run.
  3. In the Security Warning dialog box, click Run.
  4. On the Welcome to the Web Deployment Tool Setup Wizard page, click Next.
  5. On the End-User License Agreement page, select the I accept the terms in the license agreement box, and then click Next.
  6. On the Choose Setup Type page, click Complete.









Note : Install the WebDeploy on CMS and CD environment. Create one    local admin account for CMS configuration. After installation Access the below url from CMS server. It will prompt for user ID and password. Provide the admin user ID and password.
http://[ CDIPAddress]/ MsDeployAgentService

3.           Configure Web Deploy With Sitecore                     


To configure Web Deployment of file media from CM to CD, on the publishing instance or all CM instances follow below steps.


1.  In the /App_Config/Include sub directory, rename the WebDeploy.config.example file to WebDeploy.config (remove the .example extension). 

2. In the /App_Config/Include/WebDeploy.config file, configure parameters for the /configuration/sitecore/events/event/handler element as follows:


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <sitecore>
    <!-- Read the Sitecore Scaling guide (http://sdn.sitecore.net/Reference/Sitecore%206/Scaling%20Guide.aspx)
         in its entirety before you configure Web Deploy.

         If you use Web Deploy to transfer file media to a CD environment that uses DFS to synchronize those files,
         change the Media.FileFolder setting in the web.config file to the equivalent of /App_Data/Replicated/MediaFiles,
         and configure Web Deployment for the /App_Data/Replicated/MediaFiles subdirectory rather than the
         /App_Data/MediaFiles subdirectory.
         -->    
    <events>
      <event name="publish:begin">
        <handler type="Sitecore.Publishing.WebDeploy.PublishHandler, Sitecore.Publishing.WebDeploy" method="OnPublish">
                                <synchronous>true</synchronous>
          <tasks hint="list:AddTask">
            <default type="Sitecore.Publishing.WebDeploy.Task">
              <!-- Publish operation int othe target database will trigger this deployment task. -->
              <targetDatabase>web_na</targetDatabase>

              <!-- Target server is optional. If omitted, operation is performed on the local server. -->
              <targetServer>sdc0na-iissc01</targetServer>
              <!--
                userName and password are optional. If omitted, local user identity or
                credentials saved in Windows Vault will be used to connect to the server.
              -->
              <userName>sdc0na-iissc01\wdadmin</userName>
              <password>wRSJd2Bf8S</password>

              <!-- localRoot is optional. If omitted, the website root is used. -->
              <localRoot>D:\inetpub\wwwroot\WebDeployCMS\Website</localRoot>
             
              <remoteRoot>D:\inetpub\wwwroot\WebDeployCDTest\Website</remoteRoot>
             
              <!-- Paths, relative to the localRoot, which will be deployed to the remote location. -->
              <items hint="list:AddPath">
                <media>App_Data/Replicated/MediaFiles</media>
              </items>
             
            </default>
          </tasks>
        

 <tasks hint="list:AddTask">
            <default type="Sitecore.Publishing.WebDeploy.Task">
              <!-- Publish operation int othe target database will trigger this deployment task. -->
              <targetDatabase>web_na</targetDatabase>

              <!-- Target server is optional. If omitted, operation is performed on the local server. -->
              <targetServer>sdc0na-iissc02</targetServer>
              <!--
                userName and password are optional. If omitted, local user identity or
                credentials saved in Windows Vault will be used to connect to the server.
              -->
              <userName>sdc0na-iissc02\wdadmin</userName>
              <password>wRSJd2Bf8S</password>

              <!-- localRoot is optional. If omitted, the website root is used. -->
              <localRoot>D:\inetpub\wwwroot\WebDeployCMS\Website</localRoot>
             
              <remoteRoot>D:\inetpub\wwwroot\WebDeployCDTest\Website</remoteRoot>
             
              <!-- Paths, relative to the localRoot, which will be deployed to the remote location. -->
              <items hint="list:AddPath">
                <media>App_Data/Replicated/MediaFiles</media>
              </items>
             
            </default>
          </tasks>

        </handler>
      </event>
    </events>
  </sitecore>
</configuration>

Note :
1.       Install the weDeploy on CMS and CD both environment .
2.       After configuration upload some document using Sitecore in Media library and choose as File Upload.  Publish the Media and search in CD server of particular media.


4.          Useful Links



The Windows domain and username of an account with permissions to modify the required file systems on the remote server, such as DOMAIN\username (you can omit the domain for local Windows accounts). Note Because of a bug in Web Deploy 2.0, the user must be either the built-in Administrator or a member of the Domain Administrators security group. The Sitecore reference number for the issue is 351405. For more information about this requirement, see http://learn.iis.net/page.aspx/1023/web-deploy-error-codes/.





Comments

Post a Comment

Popular posts from this blog

Sitecore Publishing target and Solr Configuration

Creating a new publishing target is very helpful if your Sitecore environment is setup in multiple content delivery servers. We can publish data from Master database to one or more publishing target databases. Main thing to notice here is Master database contains all versions of any content or assets while publishing target database contains single latest version for each language.      This post aims to provide systematic instructions to set up publishing target. It comprises of a target database (where the content will be published) and publishing target definition item in master database that points to that target database.             Post creation of publishing target need to take care of Solr configuration. This post cove master slave Solr configuration and onPublishEndAsync strategy. We are using 1 Solr Master instance and 6 Slave instance (2-EU, 2-Ap, 2- NA).     1   So...

Setup Sitecore Habitat v9.0 project in simple way

In this article , I would describe how to setup the Sitecore habitat V9.0 project with Sitecore Experience Platform 9.0 rev in very simple way. I used below system configuration to setup this project: 1. Windows 10 (32/64-bit) 2. IIS 10.0 3. .NET Framework 4.6.2 4. Microsoft Visual Studio 2017 5. Microsoft SQL Server 2017 6. Solr 6.6.2 7. Microsoft PowerShell® version 5.0 8. Web Platform Installer 5.0. 9. Web Deploy 3.6 for Hosting Servers 10. Node-v8.9.4-x64 Follow below steps to setup the project. A).   Habitat require Sitecore instance. Setup the clean Sitecore 9.0 instance. Ex : http://demo.local.com , Directory location : C:\inetpub\wwwroot\demo.local.com   For more info visit -   https://dev.sitecore.net/ B). Download the Habitat V9.0 project from Github site :  https://github.com/Sitecore/Habitat/     Note  :  When you download the packages, it is possible that the .ZIP packages are marked as blocke...