Monday, October 28, 2013

RavenDb tip – deploying unstable builds regularly [REPOST]

When significant updated builds to RavenDb are posted to the Hibernating Rhinos build page (which is fairly frequently – a good thing) it means I need to deploy the updated DLLs to the servers. We currenty manage 8 instances of RavenDb – 1 for each service that supports sonatribe. That can be an aruous task – especially as we host 4 isntances on 1 server and 4 on another.

I’ve been playing about with PowerShell recently and thought this would be a good opportunity to get my teeth into it. I was initially trying to get the WebDeploy stuff to work scripted but that was a massive nause.

I ended up just going with a script i can run on each server. Here are the steps I needed to accomplish:

stop iis
remove the old files from the db folder including the bin and all it’s contents but excluding the Data directory and the web.config and log4net.config files
copy the contents of the deplyment folder (which i set up to include the plugins needed) to the database directory
restart iis
Simples.

Here’s the script:



Nice and simple. Just create an array of strings containing the paths to the folders where ravendb is hosted. Loop through them deleting and copying. Restart IIS.

This saves me about an hour a week and also guarantees that I don’t accidentally miss something. It’s a shame the web-deploy stuff in msdeploy didn’t work – we host the databases in IIS so it would have been a suitable solution and would have meant i could deploy from my dev machine without even needing to log onto the server. I expect I’ll try and tackle that at some other point.

w://