Download presentation
Presentation is loading. Please wait.
1
Bringing DevOps to the Database
Steve Jones SQLServerCentral Redgate Software DevOps is a hot topic in today’s software development world. However most of the knowledge and experience with DevOps is based around application software and ignores the database. We will examine how the concepts and principles of DevOps can be applied to database development by looking at both automated comparison analysis as well as migration script management. Automated building, testing, and deployment of database changes will be shown.
2
Agenda Who am I? The Database Development Pipeline
Principles of DevOps Evolving Database Development
3
Who am I? Steve Jones www.voiceofthedba.com @way0utwest /in/way0utwest
SQLServerCentral founder Redgate Software Evangelist @way0utwest /in/way0utwest
4
The Database Development Pipeline
Create table Orders ( OrderID int , OrderDate datetime , salesrep int , customerid int , status tnyint ) Dev Create procedure GetOrders @o datetime As Begin Select * from orders Where orderdate using System; using System.Collections.Generic; using System.Text; using eBay.Service.Core.Sdk; using eBay.Service.Core.Soap; namespace Trading_Samples { class Program { static void Main(string[] args) { MakeGetOrders(); Console.ReadLine(); Developers write code, working with test systems.
5
The Database Development Pipeline
Create table Orders ( OrderID int , OrderDate datetime , salesrep int , customerid int , status tnyint ) Dev Create procedure GetOrders @o datetime As Begin Select * from orders Where orderdate using System; using System.Collections.Generic; using System.Text; using eBay.Service.Core.Sdk; using eBay.Service.Core.Soap; namespace Trading_Samples { class Program { static void Main(string[] args) { MakeGetOrders(); Console.ReadLine(); Application code usually goes to a VCS
6
The Database Development Pipeline
Continuous Integration Create table Orders ( OrderID int , OrderDate datetime , salesrep int , customerid int , status tnyint ) Dev Create procedure GetOrders @o datetime As Begin Select * from orders Where orderdate using System; using System.Collections.Generic; using System.Text; using eBay.Service.Core.Sdk; using eBay.Service.Core.Soap; namespace Trading_Samples { class Program { static void Main(string[] args) { MakeGetOrders(); Console.ReadLine(); Here the application usually kicks off a CI process Build Test Commit Publish
7
The Database Development Pipeline
Continuous Integration Testing Create table Orders ( OrderID int , OrderDate datetime , salesrep int , customerid int , status tnyint ) Alter table Orders Add status tinyint; Create procedure GetOrders ….. Dev QA Create procedure GetOrders @o datetime As Begin Select * from orders Where orderdate using System; using System.Collections.Generic; using System.Text; using eBay.Service.Core.Sdk; using eBay.Service.Core.Soap; namespace Trading_Samples { class Program { static void Main(string[] args) { MakeGetOrders(); Console.ReadLine(); Here the application usually kicks off a CI process Build Test Commit Publish
8
The Database Development Pipeline
Continuous Integration Testing Create table Orders ( OrderID int , OrderDate datetime , salesrep int , customerid int , status tnyint ) Alter table Orders Add status tinyint; Create procedure GetOrders ….. Dev QA Create procedure GetOrders @o datetime As Begin Select * from orders Where orderdate using System; using System.Collections.Generic; using System.Text; using eBay.Service.Core.Sdk; using eBay.Service.Core.Soap; namespace Trading_Samples { class Program { static void Main(string[] args) { MakeGetOrders(); Console.ReadLine(); Here the application usually kicks off a CI process Build Test Commit Publish
9
The Database Development Pipeline
Continuous Integration Testing Production Create table Orders ( OrderID int , OrderDate datetime , salesrep int , customerid int , status tnyint ) Alter table Orders Add status tinyint; Create procedure GetOrders ….. Alter table Orders Add status tinyint; Create procedure GetOrders ….. Prod Dev QA Create procedure GetOrders @o datetime As Begin Select * from orders Where orderdate using System; using System.Collections.Generic; using System.Text; using eBay.Service.Core.Sdk; using eBay.Service.Core.Soap; namespace Trading_Samples { class Program { static void Main(string[] args) { MakeGetOrders(); Console.ReadLine(); Here the application usually kicks off a CI process Build Test COPY Commit Publish
10
DevOps Principles Systems Thinking Amplify Feedback Loops
Experimentation and Learning
11
Communication and collaboration. These are the most important.
Note: Your DevOps process will be different than mine. And anyone else’s.
12
DevOps in Practice Automation Testing
Measurement and Tracking/Auditing Communication Transparency Sharing
13
Evolving Database Development
Create table Orders ( OrderID int , OrderDate datetime , salesrep int , customerid int , status tnyint ) Dev Create procedure GetOrders @o datetime As Begin Select * from orders Where orderdate Here the application usually kicks off a CI process
14
Evolving Database Development
Getting database code into a VCS Scripting – SMO in SQL Server Third Party Tools File | Save
15
Demo Store database code in a VCS
16
Evolving Database Development
Continuous Integration Create table Orders ( OrderID int , OrderDate datetime , salesrep int , customerid int , status tnyint ) Dev Create procedure GetOrders @o datetime As Begin Select * from orders Where orderdate Here the application usually kicks off a CI process Build Test Commit Publish
17
Database Continuous Integration
Use a Build Server TFS Build, Bamboo, Team City, Cruise Control, Jenkins, whatever Database Build Pull code from VCS Execute code (in order) on a database Database Testing Use a framework (next slide) Publish Generate an Upgrade Script for an existing database (coming soon)
18
Database Testing For SQL Server
tSQLt Microsoft Unit Testing Projects DBUnit TSQLUnit Custom scripted tests * For best results, use curated test data
19
Demo Implement Continuous Integration
20
Evolving Database Development
Continuous Integration Testing Create table Orders ( OrderID int , OrderDate datetime , salesrep int , customerid int , status tnyint ) Alter table Orders Add status tinyint; Create procedure GetOrders ….. Dev Create procedure GetOrders @o datetime As Begin Select * from orders Where orderdate QA Here the application usually kicks off a CI process Build Test Commit Publish
21
Generate the Update Script
For code (stored procedures, functions, views, modules, etc.) Take latest version from VCS For tables Use Comparison or migration scripts to make changes. Tools Comparison tools (SQL Compare, etc) Migration Tools (ReadyRoll, FlywayDB, Liquibase, etc)
22
Use a Process
23
Demo Release to Downstream Environments
24
Evolving Database Development
Continuous Integration Testing Production Create table Orders ( OrderID int , OrderDate datetime , salesrep int , customerid int , status tnyint ) Alter table Orders Add status tinyint; Create procedure GetOrders ….. Alter table Orders Add status tinyint; Create procedure GetOrders ….. COPY Prod Dev Create procedure GetOrders @o datetime As Begin Select * from orders Where orderdate QA Here the application usually kicks off a CI process Build Test Commit Publish
25
Summary Understand and implement the DevOps principles
Systems Thinking Feedback Loops Experimentation and Learning Treat the database like application code Build the exceptions into your process Adapt to your environment Do more of what works Do less of what doesn’t
26
The End www.voiceofthedba.com sjones@sqlservercentral.com @way0utwest
Thank you for coming Questions? More product info at Training: red-gate.com/training @way0utwest /in/way0utwest
27
References You’re Doing DevOps Wrong - Codifying DevOps Practices - 3 DevOps Principles to Apply to Your IT Team - apply-team/ DevOps Distilled, Part 1: Closing the Gap Between Database Continuous Delivery and Code Continuous Delivery Where’s the Database in DevOps - How do Databases Fit into DevOps - devops/
28
Images
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.