dinsdag 14 september 2010

Simple site deployment when you don't need all the fuzz

Hi all I'd like to share a simplistic way of deploying a made on your dev server solution to a production-like environment.

Yesterday I was working on a project for a simple Intranet in which we wanted to use default Mcrosoft stuff, create a site structure and add some lists and webparts to pages. This should be deployed at the customers environment as sort of pilot. My initial thought were, why not install the thing in the customers environment and do the work there. Well as it turns out the environment isn't ready yet, so I was looking for an alternative.

The consultant on the job wanted to do a save site with content, the thing consultants liked to do using MOSS 2007. Well as a developer, I'm ofcourse not following that path, its for hobbyist, costs (however less than the 2003 version) performance and as it turns out, doesn't work out of the box for publishing sites in SharePoint 2010. You can with a hack, but I guess it will bite you when in production, or other times you least expect it. Usually (not always) things are eft out for a reason.

So what's the aternative. Making the templates, making a manifested template with all the sites, add al modificatons in the templates, nah too much tidous work. Making a backup and later resore this, that might work, however I'm not doing the installation and (haven't tested this yet) it might get to complex with SQL, permissions and all. But while investating if ts even possible, I spotted with my little eye: "Export a site or list". Now that seems to easy so were going to try this out. Funny enough there's no "Import a site or list" function, you need Powershell for that (even better now I can get all devvie about it).

So I:
1. Created a site structure containing several sites
2. Used the epxort to export the sites
3. Removed them all and recreated the webapp
4. Created an initial site collecton using the same template as the root site in the export had
5. Started a powershell prompt
6. Ran Import-SPWeb with the correct url and the reference to the exported file
7. Voila all sites returned like before I exported them

Now this was just an initial test and it seems to work. I can image that when there are custom features required they need to be available at Farm and Site Collection level. But still this is a nice method for deploying pre made sites into another environment, you can make a script that installs the packages required, activate any necessary features and import the structure.

Hope this helps anyone struggling with how to deploy all the work done on a dev server and make it a happy experience.

Geen opmerkingen:

Een reactie posten