Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Delivering changes for databases and applications

Delivering changes for databases and applications

Talk presented @ SQLSaturday Lisbon 2017 (11-03-2017)

Eduardo Piairo

March 11, 2017
Tweet

More Decks by Eduardo Piairo

Other Decks in Technology

Transcript

  1. Delivering changes for databases and applications Eduardo Piairo, DevOps Engineer

    3/6/2018 | 2 | @EdPiairo https://pt.linkedin.com/in/jesuspiairo [email protected] http://www.eduardopiairo.com/
  2. Chapter 3: Infrastructure 1. Physical machines 2. Virtual machines 3.

    Platform as a Service (PaaS) 4. Serverless 5. Infrastructure as Code (IaC)
  3. Chapter 4: Database 1. What’s so special about databases 2.

    Database challenges 3. Why database automation 4. The 1st step: Source Control 5. Migrations vs State 6. Flyway 7. Version Control System
  4. The problem to fix Database and application most of the

    times are not both included in the value stream Have different deployment pipelines Database is not included in the deployment pipeline As result, database is out of pace with application development
  5. Infrastructure How can you have the required consistency without including

    infrastructure? If you practice (development) and play (production) in different fields, why do you expect the same behavior/performance?
  6. Virtual machines In the cloud Upfront cost First step to

    IaC Requires configuration management
  7. Platform as a Service (PaaS) Very flexible approach Costs grow

    with the application Fast and simple development Bring infrastructure/operations closer to the development
  8. Infrastructure as Code (IaC) Thank you Virtualization!! Managing and provisioning

    infrastructure Is not simply writing scripts Allows to apply proven software development practices Version control, testing, small deployments
  9. Database challenges Databases are out of pace with application development

    Lack of traceability of database changes (changes history) Manual databases processes prevent the CI and CD utilization Lack of testability Database setup time for new environments Bugs in production
  10. Why database automation Enable control over database development Increase speed

    of response to change Keep a versioned “history” of database states and changes Reliability of the release process Increase release frequency though repeatability of processes Reduce time spent fixing bugs - automated tests Remove/reduce human intervention in the release process
  11. 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
  12. 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
  13. Flyway Flyway – “Database Migrations made Easy” http://flywaydb.org/ Open source

    database migration tool Flyway command-line enabled Simplicity: easy to setup, no need to install Zero dependencies (java + jdbc) Scripts are written in SQL
  14. Flyway – How it works Flyway commands: migrate, clean, info,

    validate, baseline, repair Metadata table: Used to track the state of the database If the database is empty, flyway won’t find it and will create it Flyway scans the migrations directory and check migrations against the metadata table Migrations are sorted based on their version number and applied in order
  15. Version Control System Rule 1: Script version (timestamp) Rule 2:

    Operation type Rule 3: Object type Rule 4: Object name Example: V20170311.1200__Create_TB_MyTable.sql
  16. 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
  17. Delivering changes for databases and applications 3/6/2018 | 41 |

    @EdPiairo https://pt.linkedin.com/in/jesuspiairo [email protected] http://www.eduardopiairo.com/