Slide 1

Slide 1 text

TRACK: CI/CD CONTINUOUS EVERYTHING NOVEMBER 12, 2020 Eduardo Piairo Why and how to include database changes in the deployment pipeline

Slide 2

Slide 2 text

TRACK: CI/CD CONTINUOUS EVERYTHING ● Engineering Operations Director @ Deeper Insights ● Co-Founder and Leader @ DevOps Porto About Me @EdPiairo https://pt.linkedin.com/in/eduardopiairo [email protected] https://www.eduardopiairo.com

Slide 3

Slide 3 text

TRACK: CI/CD CONTINUOUS EVERYTHING ● Deployment pipeline ● Database challenges ● Deployment pipeline stages ● Deployment pipeline scenarios ● Final thoughts Agenda

Slide 4

Slide 4 text

TRACK: CI/CD CONTINUOUS EVERYTHING A deployment pipeline should enable collaboration between the various groups involved in delivering software and provide everyone visibility about the flow of changes in the system, together with a thorough audit trail. by Martin Fowler @ https://martinfowler.com/bliki/DeploymentPipeline.html Definition

Slide 5

Slide 5 text

TRACK: CI/CD CONTINUOUS EVERYTHING ● Stage 1 – Change description (Source Control) ● Stage 2 – Change validation (Continuous Integration) ● Stage 3 – Change implementation (Continuous Delivery) Stages Source Control Continuous Integration Continuous Delivery

Slide 6

Slide 6 text

TRACK: CI/CD CONTINUOUS EVERYTHING Database & Deployment Pipeline Source Control Continuous Integration Continuous Delivery Database + Application

Slide 7

Slide 7 text

TRACK: CI/CD CONTINUOUS EVERYTHING What’s so special about databases?

Slide 8

Slide 8 text

TRACK: CI/CD CONTINUOUS EVERYTHING Database Challenges • Database and application changes (most of the time) are handled differently • Different deployment pipelines - synchronization needed • Database is not included (manual work)

Slide 9

Slide 9 text

TRACK: CI/CD CONTINUOUS EVERYTHING Database Challenges • Manual work … • Lack of traceability of database changes (changes history) • It’s the most expensive and risky work type • Prevent CI and CD utilization in their full extent • Promote the fear of changes

Slide 10

Slide 10 text

TRACK: CI/CD CONTINUOUS EVERYTHING Databases become a bottleneck in the delivery process

Slide 11

Slide 11 text

TRACK: CI/CD CONTINUOUS EVERYTHING

Slide 12

Slide 12 text

TRACK: CI/CD CONTINUOUS EVERYTHING The Value Of Automation • Enable control over database development • Increase speed of response to change • Greater reliability, repeatability and consistency • Enables failing in a controlled and known way • Remove/reduce human intervention in the release process

Slide 13

Slide 13 text

TRACK: CI/CD CONTINUOUS EVERYTHING Fearless database changes

Slide 14

Slide 14 text

TRACK: CI/CD CONTINUOUS EVERYTHING Source Control • Every database change can be described with an SQL script • Traceability through change history • SQL as documentation • Shared code-base and shared process • Enforce standards to reduce conflicts

Slide 15

Slide 15 text

TRACK: CI/CD CONTINUOUS EVERYTHING Migrations vs State • State based solutions • How the database should be • Migrations based solutions • How the database should change Migration Migration State Delta

Slide 16

Slide 16 text

TRACK: CI/CD CONTINUOUS EVERYTHING Scripting Guideline • One script, one operation type, one object (small batches) • Merge conflicts management • Patterns identification • File system scripts history search

Slide 17

Slide 17 text

TRACK: CI/CD CONTINUOUS EVERYTHING Continuous Integration • Integrate and validate changes • Unit and integration tests • Small batches, less risk • Considerations • What should be tested? And when? • How can the application contribute to this stage?

Slide 18

Slide 18 text

TRACK: CI/CD CONTINUOUS EVERYTHING Continuous Delivery • Delivering change(s) in the target environment • Considerations • Downtime • Time to recover • Affected applications

Slide 19

Slide 19 text

TRACK: CI/CD CONTINUOUS EVERYTHING Failed Deployment • Scripts (roll-back, roll-front) • Very fast • (Please) Do not make mistakes • Working backwards

Slide 20

Slide 20 text

TRACK: CI/CD CONTINUOUS EVERYTHING Failed Deployment • Backups (before deploy) • Safer but slower • Keep databases small • Avoid shared databases

Slide 21

Slide 21 text

TRACK: CI/CD CONTINUOUS EVERYTHING Scenario #1 Source Control Continuous Integration Continuous Delivery APP DB • Independent deployment pipelines • High need of synchronization between DBA and development team

Slide 22

Slide 22 text

TRACK: CI/CD CONTINUOUS EVERYTHING Scenario #2 Source Control Continuous Integration Continuous Delivery APP DB • Different code repositories • Independent CI process • The contact point will be the deployment moment

Slide 23

Slide 23 text

TRACK: CI/CD CONTINUOUS EVERYTHING Scenario #3 Source Control Continuous Integration Continuous Delivery APP DB • Different code repositories • Connected/dependent CI process • Short learning step towards scenario #4

Slide 24

Slide 24 text

TRACK: CI/CD CONTINUOUS EVERYTHING Scenario #4 Source Control Continuous Integration Continuous Delivery APP DB • Share the some code repository, CI process and CD process • No need of synchronization • Promotes learning within teams (database code reviews)

Slide 25

Slide 25 text

TRACK: CI/CD CONTINUOUS EVERYTHING My Definition Pipeline: Cultural and technical tool for managing changes in the software development process (should contemplate databases, applications and infrastructure).

Slide 26

Slide 26 text

TRACK: CI/CD CONTINUOUS EVERYTHING DevOps Way • Increase flow visibility • Increase feedback • Increase knowledge base and exploration

Slide 27

Slide 27 text

TRACK: CI/CD CONTINUOUS EVERYTHING Q&A @EdPiairo https://pt.linkedin.com/in/eduardopiairo [email protected] http://www.eduardopiairo.com/ #2021-ci-cd