Tuesday, October 16, 2012

New server setup

My typical setup is a Debian server and the magical apt-get makes me optimistic that I'll get some sleep. Then again, I setup servers as often as I change my tires so thankfully I still spend more time coding. Recently I've been setting up a team production Windows 2008 R2 server. As per hosting, RackSpace is the best bang for the buck. After a few failed images and some time with their support my box was ready to go. This is my installation checklist:

SQL Server 2008 R2 Express (historic client reasons)

Git (http://git-scm.com/downloads)
Mercurial (vendor reasons)
TeamCity 7.1 (CruiseControl.NET would work too but TC is quick GUI config)
Microsoft Windows SDK for Windows 7 and .NET Framework 4 (required for MSBuild)
Microsoft Visual Studio 2010 Shell (Integrated) Redistributable Package (required for MSBuild)
Microsoft Visual Studio 2010 Web Deployment Projects (http://www.microsoft.com/en-us/download/details.aspx?id=24509 - required for MSBuild)
Web Deploy library (http://www.iis.net/downloads/microsoft/web-deploy - required for MSBuild)

Just notice how many dependencies are required for MSBuild! Having installed Visual Studio 2010 on my computer none of these ever came up. Few blogs suggested copying over the Web and WebApplications which seemed odd because Windows just doesn't work that way. One person went as far as to suggest installing Visual Studio 2010 on a production machine. Microsoft, at times, does not make things easy but in my experience if your first reaction is to state the obvious maybe rethink speaking. Anyhow after trial and error this seems to do the job to create a successfully deployable solution. Here is is my rough build.proj and as I am developing this as a learning framework for non .NET developers I have to keep it simple. Unit testing and functional testing may apear in here but it's all time dependent. Once you have this in your solution directory it's enough to point TeamCity to this build file and rejoice in the magic of Continuous Integration.


<?xml version="1.0" encoding="utf-8" ?>
<Project DefaultTarget="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <SolutionName>helloworld</SolutionName>
        <SolutionFile>$(SolutionName).sln</SolutionFile>
        <ProjectName>helloworld</ProjectName>
        <ProjectFile>$(ProjectName)\$(ProjectName).csproj</ProjectFile>
    </PropertyGroup>
 
 <Target Name="Build" DependsOnTargets="BuildPackage;CopyOutput" />
 
 <Target Name="BuildPackage">
        <MSBuild Projects="$(SolutionFile)" ContinueOnError="false" Targets="Rebuild" Properties="Configuration=$(Configuration)" />
        <MSBuild Projects="$(ProjectFile)" ContinueOnError="false" Targets="Package" Properties="Configuration=$(Configuration)" />
    </Target>
 
 <Target Name="CopyOutput">
        <ItemGroup>
            <PackagedFiles Include="$(ProjectName)\obj\$(Configuration)\Package\PackageTmp\**\*.*"/>
        </ItemGroup>
  <Copy SourceFiles="@(PackagedFiles)" DestinationFiles="@(PackagedFiles->'C:\inetpub\wwwroot\$(ProjectName)\$(Configuration)\%(RecursiveDir)%(Filename)%(Extension)')"/>
 </Target>
 
 <Target Name="Clean">
  <MSBuild Projects="helloworld/$(ProjectName).csproj" Targets="Clean" />
 </Target>
</Project>

No comments:

Post a Comment