Slide 1

Slide 1 text

OPERATIONS FOR DATABASES Eduardo Piairo The Agile/DevOps Journey

Slide 2

Slide 2 text

OPERATIONS FOR DATABASES Eduardo Piairo Operations Engineer DevOps Porto Founder About me @EdPiairo https://pt.linkedin.com/in/jesuspiairo [email protected] http://www.eduardopiairo.com/

Slide 3

Slide 3 text

OPERATIONS FOR DATABASES Agile journey Scrum Kanban DevOps This presentation Database operations Automation Source Control Continuous Integration Continuous Delivery The definition and the interpretation of the covered concepts are attached to the cultural context of a specific organization on a certain period!

Slide 4

Slide 4 text

OPERATIONS FOR DATABASES 1.Before Scrum 2.Scrum 3.Kanban 4.Scrum + Kanban Agile journey

Slide 5

Slide 5 text

OPERATIONS FOR DATABASES 1.Before Scrum 2.Scrum 3.Kanban 4.Scrum + Kanban Agile journey

Slide 6

Slide 6 text

OPERATIONS FOR DATABASES Before Scrum • Before Scrum - The “real agile” method • Centralized decision mechanism • Growing phase • Size (5 to 15) • Complexity (more and more components)

Slide 7

Slide 7 text

OPERATIONS FOR DATABASES Before Scrum Application #1 Application #2 Application #3 Shared database(s) “Team” #1 “Team” #2 “Team” #3 “Team” #T-SQL

Slide 8

Slide 8 text

OPERATIONS FOR DATABASES 1.Before Scrum 2.Scrum 3.Kanban 4.Scrum + Kanban Agile journey

Slide 9

Slide 9 text

OPERATIONS FOR DATABASES Scrum • Scrum - The “magic” scrum • Scrum for the masses (>20) • Pure Scrum approach – operations as development team • 2 week sprint, sprint goal • The team was “too reactive”

Slide 10

Slide 10 text

OPERATIONS FOR DATABASES DevOps for databases - The beginning Application #1 Application #2 Application #3 Shared database(s) Team #1 Team #2 Team #3 Team #T-SQL

Slide 11

Slide 11 text

OPERATIONS FOR DATABASES DevOps for databases - Building a deployment pipeline (value stream) Source Control Continuous Integration Continuous Delivery Database + Application

Slide 12

Slide 12 text

OPERATIONS FOR DATABASES What’s so special about databases? DevOps for databases - The special case of the database

Slide 13

Slide 13 text

OPERATIONS FOR DATABASES DevOps for databases - Problems to fix • Databases are out of pace with application development • Synchronization between development and DBA teams • No traceability of database changes (changes history) • What changed? Who? When? Why? • Manual databases processes prevent the CI and CD utilization in their full extent • Time consuming and error prone • Releases are less frequent and risky

Slide 14

Slide 14 text

OPERATIONS FOR DATABASES DevOps for databases - Problems to fix • Bugs in production environment • Database related bugs are only discovered after deployment to production • Manual or inexistent tests • Fixes and hotfixes have time cost, what can lead to delay a release • Database setup time of a new environment • Expensive process for new clients

Slide 15

Slide 15 text

OPERATIONS FOR DATABASES DevOps for databases - Problems to fix Databases became a bottleneck in an agile delivery process

Slide 16

Slide 16 text

OPERATIONS FOR DATABASES DevOps for databases - The solution Source Control Continuous Integration Continuous Delivery Automation + Change control

Slide 17

Slide 17 text

OPERATIONS FOR DATABASES Decision #1 Let’s automate Let’s do source control DevOps for databases - The solution

Slide 18

Slide 18 text

OPERATIONS FOR DATABASES DevOps for databases - The value of automation • Enable control over database development • Increase speed of response to change • Keep a versioned “history” of database states • Greater reliability of the release process • Increase release frequency through repeatability of processes • Reduce time spent fixing bugs • Remove/reduce human intervention in the release process • The build step is automatic triggered by a “push” into source control repository • The deploy step is automatic triggered by a successfully build process

Slide 19

Slide 19 text

OPERATIONS FOR DATABASES DevOps for databases - The value of automation • Without automation your are working in a amnesic state • (Re)Learn and forget it vs Improve and forget it • You do not want to depend on the “best of the best”

Slide 20

Slide 20 text

OPERATIONS FOR DATABASES DevOps for databases - The 1st step: Source Control • First step in your database deployment pipeline • Traceability through change history • SQL as documentation • Shared code-base and shared process • Enforceable standards to reduce conflicts • Fundamental resource: SQL script

Slide 21

Slide 21 text

OPERATIONS FOR DATABASES Decision #2 Database source control: Migrations vs State DevOps for databases - The 1st step: Source Control

Slide 22

Slide 22 text

OPERATIONS FOR DATABASES DevOps for databases - Migrations vs State • State based solutions • Script represents the current database state • Your source of truth is how the database should be • Migrations based solutions • Script represents a migration • Migration represents how to transition to the next database version • Your source of truth is how the database should change Flyway: open source database migration tool • Simplicity: easy to setup, no need to install • Zero dependencies (java + jdbc) • Scripts are written in SQL

Slide 23

Slide 23 text

OPERATIONS FOR DATABASES DevOps for databases - Communicating through a contract • Contract – communication mechanism for change management • Set of rules and expectations • Define responsibility frontiers • Sets a common language Application #1 Application #2 Application #3 Shared database(s) Team #1 T-SQL Script Team #2 Team #3 Team #T-SQL

Slide 24

Slide 24 text

OPERATIONS FOR DATABASES DevOps for databases - Scripting rules • Scripting rules • Rule 1: Script version (timestamp) • Rule 2: Operation type • Rule 3: Object type • Rule 4: Object name Example: V20160220.1100__Create_TB_MyTable.sql • One script, one operation type, one object (small batches) • Merge conflicts management • Patterns identification • File system scripts history search

Slide 25

Slide 25 text

OPERATIONS FOR DATABASES DevOps for databases - Communicating through a contract – The pipeline • Contract – communication mechanism form change management • Should be reflected in your development pipeline • The better/clearer your pipeline, the less you need to document (your code is your documentation) • Everything is negotiable in the contract, except its application

Slide 26

Slide 26 text

OPERATIONS FOR DATABASES 1.Before Scrum 2.Scrum 3.Kanban 4.Scrum + Kanban Agile journey

Slide 27

Slide 27 text

OPERATIONS FOR DATABASES Kanban • Kanban 101 • Focus on development teams necessities • 4 week iterations • A bad choice • Different “language” from other teams • Desynchronization between operations and development teams

Slide 28

Slide 28 text

OPERATIONS FOR DATABASES DevOps for databases - Communicating through a contract • Contract – change communication management tool • Change description (Source Control) • Change validation (Continuous Integration) • Change implementation (Continuous Delivery)

Slide 29

Slide 29 text

OPERATIONS FOR DATABASES 1.Before Scrum 2.Scrum 3.Kanban 4.Scrum + Kanban Agile journey

Slide 30

Slide 30 text

OPERATIONS FOR DATABASES Scrum + Kanban • Scrum + Kanban – The best of two worlds • 2 week sprint, sprint goal • Task definition was based on teams necessities and our necessities • Team capacity < 70% (enough bandwidth to react) • Strong and disciplined team • Integration in solutions design • Operations as a service

Slide 31

Slide 31 text

OPERATIONS FOR DATABASES DevOps for databases - Communicating through a contract • Extending the Contract – communication mechanism for change management • Applications • Databases • Infrastructure

Slide 32

Slide 32 text

OPERATIONS FOR DATABASES Why DevOps? • Developing software is not enough, you have to deliver it • Communication framework for manage change • You can not stop change, but you can control it • CAMS • We change the culture (with lot of negotiation and evangelization) • We invested in automation (started with 0 automation in a never ending automation journey) • We conquer work flow visibility, so we were able to start measure • We spread the contract across the organization

Slide 33

Slide 33 text

OPERATIONS FOR DATABASES Some metrics/results • We went from 100% manual databases changes to about 98% automatic changes (100% controlled changes) • On average 200 scripts were created per day • In one year we achieved 10k scripts • We went from supporting only 1costumer to 4 costumers at the same time • Each week, costumer requests were delivered • Fixes were applied whenever necessary

Slide 34

Slide 34 text

OPERATIONS FOR DATABASES The DevOps way • DevOps: contract for collaboration and communication (change management “framework”) • Change description (Source Control) • Change validation (Continuous Integration) • Change implementation (Continuous Delivery) • Applications, databases, infrastructure

Slide 35

Slide 35 text

OPERATIONS FOR DATABASES Reading material

Slide 36

Slide 36 text

OPERATIONS FOR DATABASES Q&A @EdPiairo https://pt.linkedin.com/in/jesuspiairo [email protected] http://www.eduardopiairo.com/