Deployment is a very vast topic when it comes to MOSS. If you are good to go with .Net application deployments, you should know that it really sucks on sharepoint as it is not an easy trade. Consider the following scenarios:
- You have developed a web application using sharepoint. You have a requirement to deploy your web application with all the site contents as well as data.
- You have already deployed the web application and you would like to provide your client with a patch to be executed on their MOSS website to get the latest site contents. At the same time, the data should not be disturbed on the production environment.
- You have come up with a requirement to install lists, web parts, custom pages and features on the production server. You want it done through automation. I will explain it in a separate post.
Lets look at these scenarios one by one:
Deploying Complete Website
In order to deploy complete website, we use backup/restore method. It restores all site contents and any data to the destination server. Though there are certain limitations:
- It do not restore any assemblies that you have placed in your \bin folder under VirtualDirectories folder.
- It did not include features.
- There could be even more limitations as you face them.
I prefer the backup/restore of stsadm utility that can be achieved by simply writing down following commands:
stsadm -o backup -url http://server_name:port -filename \\anylocation\backup.bak
We may restore this backup.bak file to any server farm using the following command:
stsadm -o restore -url http://server_name:port -filename \\anylocation\backup.bak
The above method to take backup of the site produces one bak file as you can see in the statement backup.bak. There is another way you may use Central Administration backup method, go to Operations tab and follow “Perform a backup” link. This backup produces a number of files. The same backup may also be taken using the command line by following the following commands:
stsadm -o backup -directory \\backup -backupmethod full -item portNo
The above command takes a full backup of the given port number and produces same set of files as being produced by central administration. \\backup means a backup shared folder.
In order to restore from the backup produced by the above command, follow this syntax:
stsadm -o restore -directory \\backup -restoremethod overwrite -suppressprompt -item portNo
If you would like to deploy only site contents to the production server, the best possible way is using import/export feature. Again using stsadm utility, the following commands do the trick:
stsadm -o export -url http://servername:port -filename \\location\exported_data.cmp
The same command is being used to import site contents to production server:
stsadm -o import -url http://servername:port -filename \\location\exported_data.cmp
However, note down that features must be de-activated before you execute the import command on the destination server. Otherwise, you will experience different errors while importing.