Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Automate Database Deployment - SQL In The City Workshop

1,180 views

Published on

Presentation from Grant Fritchey on how to automate database deployments.
Presentation from SQL In The City Workshop

Published in: Software
  • Be the first to comment

Automate Database Deployment - SQL In The City Workshop

  1. 1. Automate Your Database Deployments Continuous delivery for databases Grant Fritchey Red Gate Software
  2. 2. Get in touch scarydba.com grant@scarydba.com @gfritchey Grant Fritchey
  3. 3. Get in touch www.voiceofthedba.com sjones@sqlservercentral.com @way0utwest Steve Jones
  4. 4. Development Continuous integration Build Test Publish Sync ALTER TABLE foo… Deployment script Release management Artifact repository Production Trigger Review, Backup & deploy Source control QA / Test / Pre-production Continuous delivery for databases Database release pipeline Continuous Integration Development ProductionTesting Operations Database development and change management
  5. 5. Development Continuous integration Build Test Publish Sync ALTER TABLE foo… Deployment script Release management Artifact repository Production Trigger Review, Backup & deploy Source control QA / Test / Pre-production Continuous delivery for databases In this presentation Database release pipeline Continuous Integration Development ProductionTesting
  6. 6. Goals • Understand the patterns and practices for automating database deployments. • Learn about the advantages continuous integration brings to a release pipeline. • Understand the challenges databases present for continuous delivery.
  7. 7. Continuous delivery – what it is and isn’t Common misconception: Continuous delivery = Continuous deployment But in fact: Continuous delivery means making sure your database changes are always production-ready.
  8. 8. Recap: Continuous Delivery Development Test Production Release pipeline Approval gate
  9. 9. Four key stages of the deployment pipeline SOURCE CONTROL CONTINUOUS INTEGRATION AUTOMATED TESTING AUTOMATED DEPLOYMENT
  10. 10. Get your database under control • Use version control for all code (including tests) • Commit early, commit often • Use tools o If it’s hard, people don’t do it • Train people • Build often SOURCE CONTROL
  11. 11. Continuous Integration • Requires • Code repository • Build automation • Delivers • Functional testing • Delivery testing • Artifact generation CONTINUOUS INTEGRATION: FUNDAMENTALS
  12. 12. Database Deployments in CI • Complete deployment • Fast • Partial build validation • Functional validation • No artifact • Incremental deployment • Longer • Harder • Complete build validation • Generates artifact CONTINUOUS INTEGRATION: FUNDAMENTALS
  13. 13. Demo
  14. 14. Development Continuous integration Build Test Publish Sync ALTER TABLE foo… Deployment script Release management Artifact repository Production Trigger Review, Backup & deploy Source control QA / Test / Pre-production Continuous delivery for databases Focus here Build out your release strategy Continuous Integration Development ProductionTesting
  15. 15. Automation
  16. 16. Automation Deployment package
  17. 17. deployment package 1 2 3 Back to Development FAI L
  18. 18. Development Continuous integration Build Test Publish Sync ALTER TABLE foo… Deployment script Release management Artifact repository Production Trigger Review, Backup & deploy Source control QA / Test / Pre-production Continuous delivery for databases Repository might be separate piece of software or part of release management software Continuous Integration Development ProductionTesting Operations Database development and change management
  19. 19. Demo
  20. 20. Pre-production is a dry-run • Staging matches production • As close as possible • Can use diff tool • Or backup and restore AUTOMATED DEPLOYMENT
  21. 21. Development Continuous integration Build Test Publish Sync ALTER TABLE foo… Deployment script Release management Artifact repository Production Trigger Review, Backup & deploy Source control QA / Test / Pre-production Continuous delivery for databases Continuous Integration Development ProductionTesting Operations Database development and change management
  22. 22. Wait…
  23. 23. Check for database drift • Last-minute hotfix • Manual emergency fixes • Unknown changes AUTOMATED DEPLOYMENT
  24. 24. Ready to go now?…
  25. 25. Plan for things to go wrong …you need a rollback and recovery strategy AUTOMATED DEPLOYMENT
  26. 26. Protection • Backups • Snapshots • Rollback scripts • A/B or blue/green deployments • Roll forward scripts AUTOMATED DEPLOYMENT
  27. 27. Demo
  28. 28. Recap: Continuous Delivery Development Test Production Release pipeline Approval gate
  29. 29. Documentation and resources • Continuous Delivery by Jez Humble and David Farley (Addison Wesley) • The Phoenix Project: A Novel About IT, DevOps, and Helping Your Business Win by Gene Kim, Kevin Behr and George Spafford (IT Revolution Press) • The Goal: A Process of Ongoing Improvement by Eliyahu M. Goldratt and Jeff Cox (Gower Publishing Ltd.) • Agile Organization by the agile admin (theagileadmin.com) Further resources: • Database Delivery Learning program: www.red-gate.com/delivery • Patterns and practices on Simple-Talk • Tutorials in Red Gate training academy • www.youtube.com/user/RedGateVideos - for recorded seminars
  30. 30. Want to try the tools you’ve just seen? Come to our Hands-on Labs
  31. 31. Image sources Author Source Information William Warby Flickr Glass Man - Flickr. This file is licensed under the Creative Commons Attribution 2.0 Generic license. Perry McKenna Flickr Headless Horse – Flickr. This file is licensed under the Creative Commons Attribution 2.0 Generic license. William Warby Flickr Gears – Flickr. This file is licensed under the Creative Commons Attribution 2.0 Generic license. Ross Harmes Flickr Gear for lightweight snow camping – Flickr. This file is licensed under the Creative Commons Attribution 2.0 Generic license. Val Gardena – Gröden Marketing Flickr Fis Ski World Cup Val Gardena Gröden – Flickr. This file is licensed under the Creative Commons Attribution 2.0 Generic license Paul Pehrson Flickr Ice cream sundae - Flickr. This file is licensed under the Creative Commons Attribution 2.0 Generic license

×