question

Matt Whitfield avatar image
Matt Whitfield asked

What are the steps in your deployment process?

I'm just working on a deployment process for the company I'm contracting with, and recommending steps that they should take before deploying software and database updates on their production systems. So I thought I'd ask the people I trust most with this sort of thing, to make sure I haven't missed out anything crucial. So... What are the steps in your deployment process?
upgradeprocess
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

write code - F5 - leave building - find coffee.
4 Likes 4 ·
@Fatherjack - well, you know where my priorities lie!
0 Likes 0 ·

1 Answer

·
Grant Fritchey avatar image
Grant Fritchey answered
First, put all the code into source control, including the database. Then, all deployments come from labeled/versioned code within the source control system. That way you know exactly what you're deploying, what has been deployed, what got changed, when, why, how, by who... etc. After that, it depends on the system we're deploying to what mechanisms are used. Total automation for continuous integration systems, mostly automated for Dev & QA, not terribly automated for production. Since I've got a couple of chapters in a book coming out shortly on this topic, I'm not going to rewrite everything here. Let's talk production deployments. Have a copy of production. This can be a QA environment or a Staging environment, either way. Just make sure that you have a mechanism in place to ensure that it's an exact copy of the code (not necessarily the data) of the production system. Then, you develop a deployment script (or scripts) that will successfully deploy the database. You need to ensure that these scripts run without error. If there is an error, reset the Staging system to be a copy of production, fix the script, rerun it. Once the script runs without flaw, you can then take that script and run it against production. BUT, before you do, best to either take a backup, or a snapshot, of the production system, always. Then, wthout editing what was run in Staging, run it in production.
13 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Ok - just wondering - because interdependency is a total nightmare. Especially when you have a computed column that depends on a function that depends on another function that depends on a table... It's like the nursery rhyme 'there was an old lady that swallowed a fly'. The other issue I had here was that they have been deploying database updates with hand-crafted scripts, and I said to them 'have you actually checked that the schemas match?'. 'No, but they will do...' 'Ok, well humour me - let's just check...' Cue schema comparison finding a shed load of differences... Thanks guys
1 Like 1 ·
wonderful. We are following exactly the same step in couple of our new deployments but the rest is more or less manual.
0 Likes 0 ·
Awesome - I'll +1 you tomorrow - out of votes right now :/ One question I have - how do you manage the issue of having database elements in source control then having to order them into a script that takes into account the interdependency between the objects?
0 Likes 0 ·
@Matt that's where tools come in. We use Visual Studio Team System to do this. I've also tested, and documented, a full process using Red Gate's SQL Compare. I'll bet something could be set up with your software too.
0 Likes 0 ·
@Matt... We leave all the indexes/fk's etc in a script until the end of the table creation scripts... We would have TableA.sql and TableA_alt.sql
0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.