How to build and maintain sharepoint solution deployments? We have a development environement, qa and production. How do we rollout the complete solution? And what about updates? If we deploy the solution again with updates, the existing data is gone or we have a broken site or lists?
3 Answers
You might want to have a look at this blog which is a great introduction to building your own fully automated deployment (SharePoint 2007 and 2010): http://soerennielsen.wordpress.com/2011/07/29/sharepoint-advanced-large-scale-deployment-scripting-part-1-of-3/
As James said, you can use PowerShell script for deploying SharePoint solution/features automatically in QA and Production. You can create one script which could be used for rolling out solutions to both QA and Production Farms. To differentiate between QA and Production, all you have to do is to change URL of Web applications (Web application created at QA and Production Farms respectively) and you're good to go.
Note: Deploying updated solutions (depending on you're not explicitly making any change to existing content) may not affect your existing SharePoint content, although it will change the customization/solution logic.
PowerShell Deployment Script: Deployment in SharePoint 2010 still has the same eight steps (Deactivate Features, Uninstall Features…..) as described at the beginning of this post. The following script deploy a solution (script source):
function WaitForJobToFinish([string]$SolutionFileName)
{
$JobName = "*solution-deployment*$SolutionFileName*"
$job = Get-SPTimerJob | ?{ $_.Name -like $JobName }
if ($job -eq $null)
{
Write-Host 'Timer job not found'
}
else
{
$JobFullName = $job.Name
Write-Host -NoNewLine "Waiting to finish job $JobFullName"
while ((Get-SPTimerJob $JobFullName) -ne $null)
{
Write-Host -NoNewLine .
Start-Sleep -Seconds 2
}
Write-Host "Finished waiting for job.."
}
}
Add-PsSnapin Microsoft.SharePoint.PowerShell
$CurrentDir=$args[0]
$solutionName="Limeco.UI.WebParts.wsp"
$SolutionPath=$CurrentDir + "\"+$solutionName
Write-Host 'Going to disable feature'
disable-spfeature -identity Limeco.UI.WebParts_LimecoWebPartFeature -confirm:$false -url http://localhost
Write-Host 'Going to uninstall feature'
uninstall-spfeature -identity Limeco.UI.WebParts_LimecoWebPartFeature -confirm:$false -force
Write-Host 'Going to uninstall solution'
Uninstall-SPSolution -identity $solutionName -allwebapplications -confirm:$false
Write-Host 'Waiting for job to finish'
WaitForJobToFinish
Write-Host 'Going to remove solution'
Remove-SPSolution –entity $solutionName -confirm:$false
Write-Host 'Going to add solution'
Add-SPSolution $SolutionPath
Write-Host 'Going to install solution to all web applications'
Install-SPSolution –entity $solutionName –llwebapplications –ACDeployment
Write-Host 'Waiting for job to finish'
WaitForJobToFinish
Write-Host 'Going to enable Feature'
Enable-spfeature -identity Limeco.UI.WebParts_LimecoWebPartFeature -confirm:$false -url http://localhost
Remove-PsSnapin Microsoft.SharePoint.PowerShell
You will have to design this yourself, possibly by creating powershell scripts to perform the WSP deployments.