File system deploy to multiple servers

455 Views Asked by At

I am using TFS and Visual Studio 2017. I have two servers for load balancing purposes, both servers have identical release versions(In theory) of my MVC application.

The current release process is as follows:

  1. Take a backup of the existing root folder by copying all files into _old folder.
  2. Copy the release files onto the server manually i.e, Ctrl+c and Ctrl+v.

I do the same for Server 2.

I am wondering if there is a way to automate this.

I have tried the following: I created a publish profile which will publish to one server at a time, this is working however the backup of the existing files(i.e, step 1) is still manual and also I have to do this twice once on each server (i.e, had to create two profiles instead of 1)

I did try to tweak the pubxml file as below My *.pubxml file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>\\10.0.0.100\c$\Applications\TestApps\Test</publishUrl>
    <publishUrl>\\10.0.0.101\c$\Applications\TestApps\Test</publishUrl>
    <DeleteExistingFiles>False</DeleteExistingFiles>
  </PropertyGroup>
</Project>

The above did not work, funny enough when i try and publish using this publish profile. Only Server 2 (10.0.0.101) picked up my change and Can anyone help.

I am using Visual Studio 2017 Visual Studio Team Foundation Server 15.117.26714.0

1

There are 1 best solutions below

2
Richard On

The only suggestions out there for MSDeploy are multiple profiles.

But you say you are using TFS: if you are using an up to date version of Azure Dev Ops server (the renamed TFS server) then deployment groups allow deployment to multiple servers.