continuous db changes delivery with liquibase

20
Continuous DB Changes Delivery With Liquibase Presented by Aidas Dragunas

Upload: aidas-dragunas

Post on 15-Apr-2017

1.388 views

Category:

Software


2 download

TRANSCRIPT

Page 1: Continuous DB Changes Delivery With Liquibase

Continuous DB Changes Delivery With LiquibasePresented by Aidas Dragunas

Page 2: Continuous DB Changes Delivery With Liquibase

Agenda• The short overview of Continuous Delivery process• The overview of Liquibase technology as one of open source

technologies, designed for DB changes migration• Live demonstration of how Liquibase could be used in Continuous

Delivery process

Page 3: Continuous DB Changes Delivery With Liquibase

Continuous Delivery Overview How to continuously deliver application changes to the testing and production environment

Page 4: Continuous DB Changes Delivery With Liquibase

Deployment automation stages

Commit CodePerform Unit &

Integration testing

Deploy to testing

environment

Perform Acceptance

testing

Deploy to production

environment

Continuous Integration

Continuous Delivery

Continuous Deployment

Page 5: Continuous DB Changes Delivery With Liquibase

Continuous integration process

3

2

4

CI Server (Jenkins)

Development teamSCM repository

(GIT, SVN)

1

Notification

Binary repository (Nexus)

Page 6: Continuous DB Changes Delivery With Liquibase

Continuous delivery process

25

4

3

CI Server (Jenkins)

Testing Environment

Development teamSCM repository

(GIT, SVN)

1

Notification

Binary repository (Nexus)

Page 7: Continuous DB Changes Delivery With Liquibase

Continuous deployment process

2

4

5

3

7

6

CI Server (Jenkins)

Testing Environment

Development teamSCM repository

(GIT, SVN)

1

Stakeholders

Production Environment

Notification

Notification

Binary repository (Nexus)

Page 8: Continuous DB Changes Delivery With Liquibase

Continuous delivery key notes• DB changes and web changes are committed into the SCM

repository together• DB changes are created and stored incrementally• DB changes are deployed incrementally• DB changes and web changes are deployed together

Page 9: Continuous DB Changes Delivery With Liquibase

Liquibase OverviewOverview of Liquibase - one of DB changes deployment tools

Page 10: Continuous DB Changes Delivery With Liquibase

Introduction• Purpose

• Provide structure to track and manage DB changes

• Deploy DB changes to the database

• Main keywords• Master Changelog• Incremental Changelog• Changeset

• Latest version• 3.4.2 (November 24, 2015)

• License• Liquibase - Apache 2.0• Datical DB - Commerce

version of Liquibase

• Principles• Manage DB changes in small chunks – Changesets• Store DB changes in Changelog files (preferably one Changeset in one file).• Use Changelog tables in the DB to track and manage DB changes

deployment process.

Page 11: Continuous DB Changes Delivery With Liquibase

Features• Changeset descripton formats

• XML• SQL• JSON• YAML

• Changeset description types• Inside Changelog file• Outside Changelog file

• Changeset types• DB structure changes• Methods• Data changes

• Database types• Oracle• PostgreSQL• SQL Server• MySQL• Other

• Additional features• DB changes file generation• DB changes rollback• DB difference generation • DB documentation

• Plugins• Ant, Maven, Gradle (third

party provider)• Spring

Page 12: Continuous DB Changes Delivery With Liquibase

Benefits• Flexible• Plugins for main deployment engines (Ant, Maven, Gradle)• Suitable for beginners and for experienced developers• Abiliy to load data and compile methods• Ability to rollback changes• Ability to review changes SQL file• Ability to generate documentation• Manually defining the order of changes • Supports various changelog formats• Supports the majority of database vendors

Page 13: Continuous DB Changes Delivery With Liquibase

Drawbacks• Sometimes too complex, especially for datasets deployment• Manually defining the order of changes • Different plugins features for Gradle, Maven and Ant• Poorly formated output log• Change locks happen. When manual lock release should be

performed directly in the database• Limited by JDBC• Doesn‘t support Slonik files, so PostgreSQL built-in streaming

replication should be enabled

Page 14: Continuous DB Changes Delivery With Liquibase

Liquibase vs FlywayFeature Liquibase Flyway

Incremental migration x x

Migration SQL preview x

Migration formats XML, SQL, YAML, JSON SQL, Java

Migration order management strategy

Manual Automatic

Migration rollback x

Repeated change execution

x

Context based change deployment

x

Page 16: Continuous DB Changes Delivery With Liquibase

Continuous Delivery With Liquibase DemoHow to continuously deliver DB changes to the PostgreSQL database using Liquibase

Page 17: Continuous DB Changes Delivery With Liquibase

Solutions Pie

PostgreSQL

Jenkins/Nexus

Git

Maven/Ant/Gradle

Liquibase (Changelogs/Changesets)

Page 18: Continuous DB Changes Delivery With Liquibase

Changelogs catalog structure• changes

• change-20151009142310• change.sql• change.xml

• change-20151009143745• ....• changelog.xml

• datasets• dataset-0001

• dataset.xml• dataset-0002• ....• changelog.xml

• methods• changelog.xml

• env• local.properties• development.properties• qa.properties• production.properties

• gradle• libs

Page 19: Continuous DB Changes Delivery With Liquibase

Live Example

Page 20: Continuous DB Changes Delivery With Liquibase

Questions?