Friday, October 9, 2009

Introducing SPDeploy - a quick way to (re)deploy dev and test structure to SharePoint

CodePlex link: http://spdeploy.codeplex.com

About

SPDeploy will, based on schema validated xml configuration, lookup or create content in a local SharePoint farm, such as WebApplications (with content database and iis site / application pool), Sites, Webs. It will also handle wsp solution installations to the farm; further deployments of installed wsps into web applications; activation of features on all feature-accepting levels of the structure.

Folder, list item and document support is planned, but not as a replacement for WSPs, features or plain common sense.

With SPDeploy you can quickly, and painlessly, reset and redeploy your test or development environment, as well as quickly add development / third party features to the mix - without incorporating them into your production ready wsps, or extending large powershell / batch scripts. The point is to encourage proper integration testing in your development environment, and bringing structure to your favorite SharePoint build server.

Important! Deployment or upgrades into a production or even UAT environments should be made with as strict a setup as possible, with (if possible) all the structure definition, creation and library deployment packaged into definitions, features and solutions. I do not suggest using SPDeploy for this. Test with SPDeploy - ship with wsps and upgradable features!

Developer / extension notes

All data classes in the project are generated from XSD, and generic configration runners make it easy to expand with custom sub nodes. Add an accepted sub node to the XSD, rebuild the project to generate new data classes, and create a Processor derived class to deal with the new sub node type. A new sub node processor will automatically get the result from the lookup or creation of the node above (like a SPWeb, if you're adding processors under the XML's Web node).

Sample xml configuration data

If you reference the schema provided in the source package, Visual Studio will even give you autocompletion and validation of the configuration as you go.


<?xml version="1.0" encoding="utf-8" ?>
<Deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Schemas\SPDeploy.xsd">
<Solutions>
<Solution FileName="C:\path\to\a\Solution.wsp"/>
</Solutions>
<WebApplications>
<WebApplication Action="Lookup" Name="SharePoint - 80">
<SolutionDeployments>
<SolutionDeployment Name="Solution.wsp"/>
</SolutionDeployments>
<Sites>
<Site Action="Create" Url="/" Title="RootWeb" LCID="1044" Template="STS#1" OwnerLogin="somedomain\user">
<RootWeb>
<Features>
<FeatureActivation Guid="fba9e8df-b758-4197-8768-169ef727d5bb" />
</Features>
<Webs>
<Web Action="Create" Title="RecursionWeb" LCID="1044" Template="STS#1" Url="RecursionIsFun">
<Webs>
<Web Action="Create" Title="RecursionWeb" LCID="1044" Template="STS#1" Url="RecursionIsFun">
<Webs>
<Web Action="Create" Title="RecursionWeb" LCID="1044" Template="STS#1" Url="RecursionIsFun">
<Webs>
<Web Action="Create" Title="RecursionWeb" LCID="1044" Template="STS#1" Url="RecursionIsFun">
</Web>
</Webs>
</Web>
</Webs>
</Web>
</Webs>
</Web>
</Webs>
</RootWeb>
</Site>
</Sites>
</WebApplication>
<WebApplication Action="Create" Name="TestApp" Header="vm-dev" Port="8009" Database="TestContent" PoolName="TestPooly" CreatePool="true">
<SolutionDeployments>
<SolutionDeployment Name="Solution.wsp"/>
</SolutionDeployments>
<Sites>
<Site Action="Create" Url="/" Template="STS#1" LCID="1044" OwnerLogin="somedomain\user" Title="TestWeb">
<RootWeb>
<Webs>
<Web Action="Create" Title="SubWeb" LCID="1044" Template="STS#1" Url="SubWebUrl">
<Features>
<FeatureActivation Guid="fba9e8df-b758-4197-8768-169ef727d5bb" />
</Features>
</Web>
</Webs>
</RootWeb>
</Site>
</Sites>
</WebApplication>
</WebApplications>
</Deployment>

2 comments:

Peter said...

DEATH TO XML! Looks nice otherwise.

Einar Otto Stangvik said...

@Peter,

I've heard that a lot lately ;) It's a lot more structured than the 500 flat lines of stsadm (and other tools) calls, though, so I think this works!