Sie sind auf Seite 1von 24

Bringing DevOps to the Database

Steve Jones
Editor, SQLServerCentral
Redgate Software
@way0utwest
Three Takeaways
Takeaways

1. The database can be built*


2. The database can be tested*
3. The database can be released*

* like other software


Agenda
• Who am I?
• The DevOps Software Development Pipeline
• Principles of DevOps
• Evolving Database Development
26 years SQL Server data experience
DBA, developer, manager, writer, speaker in a variety of
companies and industries

Founder, SQLServerCentral
And current editor, with the goal of helping you learn to be a better
data professional every day

Steve Jones 10 years Microsoft Data Platform MVP


Evangelist, Redgate Software I am honored to be recognized by Microsoft for the last decade
Editor, SQLServerCentral as an MVP

/in/way0utwest @way0utwest www.voiceofthedba.com


The Three Ways
• Principles underlying DevOps from Gene Kim
• Systems Thinking
• Amplify Feedback Loops
• Culture of Experimentation and Learning
What is DevOps?
“DevOps is the union of people, process, and products to enable
continuous delivery of value to our end users.”
- Donovan Brown
DevOps in Practice
• Culture
• DBAs and developers working together
• Automation
• Introduce tools to the database
• Lean
• make db changes simpler, evolve the db
• Measurement
• consider impact of db change
• Sharing
• understand how a db change impacts development and operations
The Application Development Pipeline
Development Operations

Continuous integration
QA
Build

Production
Trigger Test

Staging

Sync
Report
Beta

Publish

Artifact
repository
The Database Development Pipeline
Development Operations

Continuous integration
QA
Build

Production
Trigger Test

Staging
Shared
Sync
Report
UAT

Publish

Artifact
repository
A big thanks to all of our sponsors!
Evolving Database Development
• The foundation is Version Control
• Treat the database code just like application code
• Capture our DDL (and DML)
• VCS Organization
• Can be same repo or separate repo (I prefer separate)
• Use a sub folder for the DDL
• Use Pull Requests for code review
SQL and Version Control
• The process is
• Get changed code to a text file
• Commit to the VCS
• Comments are why changes were made, not what.
• Options for database DDL and DML
• Scripting – SMO in SQL Server
• Third Party Tools
• File | Save
Demo
Store database code in a VCS
Database Continuous Integration
• Database Build Process
• Pull code from VCS
• Order code according to rules of SQL
• Execute code on a database
• Run tests
• Package code for downstream release

• Use a Build Server just like application code


• TFS Build, Bamboo, Team City, Cruise Control, Jenkins, whatever
Database Testing
• Tests must be automated
• For SQL Server
• tSQLt
• Microsoft Unit Testing Projects
• DBUnit
• TSQLUnit
• Custom scripted tests

* For best results, use curated test data


Demo
Implement Continuous Integration
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)
Deploy the Code
• Use a consistent process
• Use automation where you can, use manual steps (documented)
where you cannot
• Slowly and continuously improve the process
• Use a Release Management Server
• Octopus Deploy
• TFS
• Bamboo
Release Issues
• Rollback
• For code (views, procs, functions) – Deploy the previous version
• For tables – Need custom code
• In general, I am a fan of dark deploys and roll forward
• Environment Data
• Data that varies by environment (queue names, security, etc)
• Script and deploy with deploy once scripts (maybe separate pipeline)
• Use tokens where possible and store config data in the environment
Demo
Release to Downstream Environments
Summary
• Understand and apply the DevOps principles to the db
• 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
The End

www.voiceofthedba.com

sjones@sqlservercentral.com
@way0utwest
/in/way0utwest
References
• You’re Doing DevOps Wrong - https://techcrunch.com/2016/07/04/youre-doing-devops-wrong/
• Codifying DevOps Practices - http://www.jedi.be/blog/2012/05/12/codifying-devops-area-practices/
• 3 DevOps Principles to Apply to Your IT Team -
http://blogs.atlassian.com/2015/09/3-key-devops-principles-apply-team/
• DevOps Distilled, Part 1: http://www.ibm.com/developerworks/library/se-devops/part1/index.html
• Closing the Gap Between Database Continuous Delivery and Code Continuous Delivery
- http://devops.com/2014/11/19/closing-gap-database-continuous-delivery-code-continuous-delivery/
- Where’s the Database in DevOps - https://www.red-gate.com/library/wheres-the-database-in-devops
- How do Databases Fit into DevOps -
https://blog.devopsguys.com/2015/02/19/how-do-databases-fit-into-devops/
Images
• https://coupongy.files.wordpress.com/2013/06/scratching-head3.gif
• http://sipsoftlogic.com/qa-testing/
• http://www.qahipster.com/uploads/8/1/4/4/8144013/417638_orig.gif
• https://commons.wikimedia.org/wiki/File:Server-blades.svg
• http://sethkravitz.com/wp-content/uploads/2016/01/culture.jpg
• http://cdn.electric-cloud.com/wp-content/uploads/2015/04/end_to_end_automation.jpeg
• https://media.licdn.com/mpr/mpr/p/6/005/0b0/1ca/3876971.jpg
• http://studyjams.scholastic.com/studyjams/assets/jams/math/measurement/image.jpg
• http://static1.squarespace.com/static/50e6cb55e4b0404f376ac3a9/t/51001a3ce4b0479a8076a5da/1358961213093/feedback.png
• https://www.govloop.com/blogs/4001-5000/4920-Experiment.gif
• http://onlinelearningtips.com/wp-content/uploads/2014/04/worlde-online-learning.gif
• http://successagency.com/blog/wp-content/uploads/2014/05/5.-Communication-gif.gif
• https://elizajanee.files.wordpress.com/2015/03/tumblr_n652boc6hf1rpfx57o1_400.gif
• http://cdn2.totallythebomb.com/wp-content/uploads/2011/09/stopsign.gif
• http://threesixtysafety.com/wp-content/uploads/effective-communication.jpg
• http://www.millenniumrecycling.com/wp-content/uploads/2015/01/Process-Gif.gif

Das könnte Ihnen auch gefallen