SlideShare a Scribd company logo
1 of 29
+ 
Database Change Management* as a service 
* Also known as ‘patching’ or ‘refactoring’
+ 
About me 
(Andrew Solomon) 
Was … 
an academic teaching Perl 
Am now doing … 
 Perl Web Development at Net-A-Porter 
 (learning) Devops at Net-A-Porter 
 Teaching at Geekuni
+ 
Motivation 
Data is inconvenient 
 Next app release coming 
 App has new features 
 Needs different DB structure 
 Can’t just trash and install DB like an app
+ 
Principles 
For safe refactoring 
 Backward compatibility 
 Old and new app versions are ok with the refactored DB 
 DB is versioned 
 You can quickly determine which patches have been applied 
 App won’t be run if the DB is not compatible 
 Write a rollback for every DB change 
http://www.amazon.co.uk/Continuous-Delivery-Deployment- 
Automation-Addison-Wesley/dp/0321601912
+ 
The Net-a-Porter Way 
Old school
+ 
The Net-a-Porter Way 
Old school 
 Put refactor code into My-App’s code base 
 Approach A: Run when installing the My-App RPM 
 Approach B: Run when starting My-App 
 Log the patches run in the database
+ 
The Net-a-Porter Way 
Old school 
 Put refactor.pl into My-App’s code base 
 PROBLEM: A slightly different refactor.pl for each app 
 PROBLEM: refactor.pl has extra CPAN dependencies 
 Approach A: Run when installing the My-App RPM 
 Approach B: Run when starting My-App 
 Log the patches run in the database
+ 
The Net-a-Porter Way 
Old school 
 Put refactor.pl into My-App’s code base 
 PROBLEM: A slightly different refactor.pl for each app 
 PROBLEM: refactor.pl has extra CPAN dependencies 
 Approach A: Run when installing the My-App RPM 
 Approach B: Run when starting My-App 
 PROBLEM: Multiple My-App servers per DB 
 Log the patches run in the database
+ 
The Service Way
+ 
Available Refactoring Tools 
Flyway 
Liquibase 
DB Deploy
+ 
Winner: Liquibase 
Big user base 
Bought by Datical 
Has branching and 
More features than Flyway 
DB Deploy uses Apache ANT
Overview
Liquibase
+ 
Liquibase 
How it works 
Input: 
 An XML file listing SQL files to run 
 Special comments in the SQL files for tagging 
Output: 
 ‘databasechangelog’ tables 
 Which patches have been run 
 ‘databasechangeloglock’ 
 Ensure only one refactoring process!
+ 
Liquibase 
Example XML 
<databaseChangeLog …> 
<include file="1.0.0/000-create_schema.sql” 
relativeToChangelogFile="true"/> 
<include file="1.0.0/010-populate.sql” 
relativeToChangelogFile="true"/> 
<changeSet author="a.solomon" id="tag-1.0.0"> 
<tagDatabase tag="1.0.0"/> 
</changeSet> 
</databaseChangeLog>
+ 
Liquibase 
Example SQL 
--liquibase formatted sql 
--changeset a.solomon:1.0.1-000 
BEGIN; 
CREATE TABLE public.foobar ( 
id INTEGER PRIMARY KEY, 
name TEXT UNIQUE NOT NULL 
); 
ALTER table public.foobar OWNER to magpie; 
--ROLLBACK DROP TABLE public.foobar; 
COMMIT;
+ 
Liquibase 
Example Update 
/usr/bin/liquibase  
--changeLogFile=changeset.xml  
--url="jdbc:postgresql://db1.myapp.com:5432/myapp-db1"  
--username=liquibase –password=foobar update
+ 
Liquibase 
Example Rollback 
/usr/bin/liquibase  
--changeLogFile=changeset.xml  
--url="jdbc:postgresql://db1.myapp.com:5432/myapp-db1"  
--username=liquibase –password=foobar rollback 1.0.0
+ 
Liquibase 
Example databasechangelog 
author | filename | md5sum | tag 
a.solomon | 1.0.1/000-create_schema.sql | 7:49c8 | 1.0.1
+ 
Liquibase::Git 
What is it? 
 Perl module and script (soon on CPAN?) 
 A perl script 
 Clones git repo of the app 
 Looks in a directory of patches 
 Calls liquibase
Liquibase::Git
+ 
Liquibase::Git 
Example 
$ liquibase-git --username liquibase  
--password foobar  
--db mydb-db1  
--hostname db1.myapp.com  
--git-repo https://github.com/nap/myapp.git  
--git-changeset-dir db/db1  
--git-identifier master  
--db-type postgresql  
--changeset-file changeset.xml
+ 
NAP::Liquibase 
Getting the Puppet to help 
Most of Liquibase::Git’s parameters are retrieved from the Puppet 
DB 
Just reads a new file from My-App – the list of DBs to refactor 
# in the puppet hieradata 
$ cat myapp.com.yaml 
liquibase: 
databases: 
- db: 'myapp-db1' 
- db: 'myapp-db2’ 
# ask mco for myapp’s dbhost 
$ nap-liquibase --db-host db1.myapp.com  
--app-git-repo https:://github.com/nap/myapp.git  
--app-git-identifier master
NAP::Liquibase
Jenkins Deploy-oid 
mco ping … -F system_db=liquibase
+ 
Appendix 
… managing DBs outside the Puppet estate 
Cases where the box is being managed differently with puppet… 
Jenkins Continuous Integration Test Server 
Developer’s Box 
 Option 1: Emulate Liquibase on an empty DB – 5 lines 
 Option 2: Call liquibase-git to update a DB dump
+ 
Conclusion 
Don’t write new DB refactoring 
code for each app 
Don’t assume you’ll only have one 
app server per DB 
Don’t deploy DB refactoring code 
on the app’s host 
Treat it as a 
service
+ 
But wait!!! There’s more… 
 Ilmari told me about it 
 It’s a Perl project of David E. 
Wheeler / theory 
 Based on sane principles: 
http://sqitch.org/ 
Sqitch is to Liquibase 
Is what 
Git is to CVS 
 The switch to sqitch will be almost 
invisible at the architecture level 
 Only difference is that the developers 
get LOCAL application of the patches 
on the dev box with a simple 
command-line interface
+ 
Questions? 
… or grab me at the pub.

More Related Content

What's hot

FHIR Server 安裝與使用
FHIR Server 安裝與使用FHIR Server 安裝與使用
FHIR Server 安裝與使用Lorex L. Yang
 
Qlik Replicateでのタスク設定の詳細
Qlik Replicateでのタスク設定の詳細Qlik Replicateでのタスク設定の詳細
Qlik Replicateでのタスク設定の詳細QlikPresalesJapan
 
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)Roman Kharkovski
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github Max Claus Nunes
 
MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용I Goo Lee
 
Automate DBA Tasks With Ansible
Automate DBA Tasks With AnsibleAutomate DBA Tasks With Ansible
Automate DBA Tasks With AnsibleIvica Arsov
 
C34 Always On 可用性グループ 構築時のポイント by 小澤真之
C34 Always On 可用性グループ 構築時のポイント by 小澤真之C34 Always On 可用性グループ 構築時のポイント by 小澤真之
C34 Always On 可用性グループ 構築時のポイント by 小澤真之Insight Technology, Inc.
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraformJulien Pivotto
 
Always on 可用性グループ 構築時のポイント
Always on 可用性グループ 構築時のポイントAlways on 可用性グループ 構築時のポイント
Always on 可用性グループ 構築時のポイントMasayuki Ozawa
 
Jenkins를 활용한 Openshift CI/CD 구성
Jenkins를 활용한 Openshift CI/CD 구성 Jenkins를 활용한 Openshift CI/CD 구성
Jenkins를 활용한 Openshift CI/CD 구성 rockplace
 
Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Tr...
Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Tr...Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Tr...
Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Tr...Edureka!
 
Maria db 이중화구성_고민하기
Maria db 이중화구성_고민하기Maria db 이중화구성_고민하기
Maria db 이중화구성_고민하기NeoClova
 
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and OptimizationPgDay.Seoul
 
Database Migrations with Gradle and Liquibase
Database Migrations with Gradle and LiquibaseDatabase Migrations with Gradle and Liquibase
Database Migrations with Gradle and LiquibaseDan Stine
 
PostGreSQL Performance Tuning
PostGreSQL Performance TuningPostGreSQL Performance Tuning
PostGreSQL Performance TuningMaven Logix
 

What's hot (20)

Jenkins Pipelines
Jenkins PipelinesJenkins Pipelines
Jenkins Pipelines
 
FHIR Server 安裝與使用
FHIR Server 安裝與使用FHIR Server 安裝與使用
FHIR Server 安裝與使用
 
Qlik Replicateでのタスク設定の詳細
Qlik Replicateでのタスク設定の詳細Qlik Replicateでのタスク設定の詳細
Qlik Replicateでのタスク設定の詳細
 
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용
 
Automate DBA Tasks With Ansible
Automate DBA Tasks With AnsibleAutomate DBA Tasks With Ansible
Automate DBA Tasks With Ansible
 
C34 Always On 可用性グループ 構築時のポイント by 小澤真之
C34 Always On 可用性グループ 構築時のポイント by 小澤真之C34 Always On 可用性グループ 構築時のポイント by 小澤真之
C34 Always On 可用性グループ 構築時のポイント by 小澤真之
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraform
 
Liquibase case study
Liquibase case studyLiquibase case study
Liquibase case study
 
MongoDB
MongoDBMongoDB
MongoDB
 
Always on 可用性グループ 構築時のポイント
Always on 可用性グループ 構築時のポイントAlways on 可用性グループ 構築時のポイント
Always on 可用性グループ 構築時のポイント
 
Jenkins를 활용한 Openshift CI/CD 구성
Jenkins를 활용한 Openshift CI/CD 구성 Jenkins를 활용한 Openshift CI/CD 구성
Jenkins를 활용한 Openshift CI/CD 구성
 
Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Tr...
Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Tr...Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Tr...
Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Tr...
 
Maria db 이중화구성_고민하기
Maria db 이중화구성_고민하기Maria db 이중화구성_고민하기
Maria db 이중화구성_고민하기
 
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
 
Zabbix Monitoring Platform
Zabbix Monitoring Platform Zabbix Monitoring Platform
Zabbix Monitoring Platform
 
Database Migrations with Gradle and Liquibase
Database Migrations with Gradle and LiquibaseDatabase Migrations with Gradle and Liquibase
Database Migrations with Gradle and Liquibase
 
PostGreSQL Performance Tuning
PostGreSQL Performance TuningPostGreSQL Performance Tuning
PostGreSQL Performance Tuning
 

Viewers also liked

Puppet & Perforce: Versioning Everything for Deployments
Puppet & Perforce: Versioning Everything for DeploymentsPuppet & Perforce: Versioning Everything for Deployments
Puppet & Perforce: Versioning Everything for DeploymentsPerforce
 
Database Change Management
Database Change ManagementDatabase Change Management
Database Change ManagementDominik Hirt
 
Liquibase få kontroll på dina databasförändringar
Liquibase   få kontroll på dina databasförändringarLiquibase   få kontroll på dina databasförändringar
Liquibase få kontroll på dina databasförändringarSqueed
 
Continuous Web Performance Monitoring with Jenkins
Continuous Web Performance Monitoring with JenkinsContinuous Web Performance Monitoring with Jenkins
Continuous Web Performance Monitoring with JenkinsMichael Kröll
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database DeploymentsMike Willbanks
 
Database Refactoring With Liquibase
Database Refactoring With LiquibaseDatabase Refactoring With Liquibase
Database Refactoring With LiquibaseTim Berglund
 
Agile Database Development with Liquibase
Agile Database Development with LiquibaseAgile Database Development with Liquibase
Agile Database Development with LiquibaseTim Berglund
 

Viewers also liked (8)

Puppet & Perforce: Versioning Everything for Deployments
Puppet & Perforce: Versioning Everything for DeploymentsPuppet & Perforce: Versioning Everything for Deployments
Puppet & Perforce: Versioning Everything for Deployments
 
Database Change Management
Database Change ManagementDatabase Change Management
Database Change Management
 
Liquibase få kontroll på dina databasförändringar
Liquibase   få kontroll på dina databasförändringarLiquibase   få kontroll på dina databasförändringar
Liquibase få kontroll på dina databasförändringar
 
Mini Training Flyway
Mini Training FlywayMini Training Flyway
Mini Training Flyway
 
Continuous Web Performance Monitoring with Jenkins
Continuous Web Performance Monitoring with JenkinsContinuous Web Performance Monitoring with Jenkins
Continuous Web Performance Monitoring with Jenkins
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database Deployments
 
Database Refactoring With Liquibase
Database Refactoring With LiquibaseDatabase Refactoring With Liquibase
Database Refactoring With Liquibase
 
Agile Database Development with Liquibase
Agile Database Development with LiquibaseAgile Database Development with Liquibase
Agile Database Development with Liquibase
 

Similar to Database Change Management as a Service

FlywayDB Migration with Spring Boot
FlywayDB Migration with Spring BootFlywayDB Migration with Spring Boot
FlywayDB Migration with Spring BootInexture Solutions
 
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...Alan Pinstein
 
Evolutionary Database Design
Evolutionary Database DesignEvolutionary Database Design
Evolutionary Database DesignAndrei Solntsev
 
DevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven InfrastructureDevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven InfrastructureAntons Kranga
 
Liquibase - Open Source version control for your database
Liquibase - Open Source version control for your databaseLiquibase - Open Source version control for your database
Liquibase - Open Source version control for your databaseBlaine Carter
 
Liquibase – a time machine for your data
Liquibase – a time machine for your dataLiquibase – a time machine for your data
Liquibase – a time machine for your dataNeev Technologies
 
Migrating to SharePoint 2013 - Business and Technical Perspective
Migrating to SharePoint 2013 - Business and Technical PerspectiveMigrating to SharePoint 2013 - Business and Technical Perspective
Migrating to SharePoint 2013 - Business and Technical PerspectiveJohn Calvert
 
Ready, Set, Upgrade!
Ready, Set, Upgrade!Ready, Set, Upgrade!
Ready, Set, Upgrade!Cory Peters
 
Intro to Github Actions @likecoin
Intro to Github Actions @likecoinIntro to Github Actions @likecoin
Intro to Github Actions @likecoinWilliam Chong
 
Agile Database Modeling with Grails - Preview of GORM 1.4 - SF Grails Meetup ...
Agile Database Modeling with Grails - Preview of GORM 1.4 - SF Grails Meetup ...Agile Database Modeling with Grails - Preview of GORM 1.4 - SF Grails Meetup ...
Agile Database Modeling with Grails - Preview of GORM 1.4 - SF Grails Meetup ...Philip Stehlik
 
Going Serverless with Azure Functions in .NET
Going Serverless with Azure Functions in .NETGoing Serverless with Azure Functions in .NET
Going Serverless with Azure Functions in .NETJeremy Likness
 
Architecting the Future: Abstractions and Metadata - BSidesKC
Architecting the Future: Abstractions and Metadata - BSidesKCArchitecting the Future: Abstractions and Metadata - BSidesKC
Architecting the Future: Abstractions and Metadata - BSidesKCDaniel Barker
 
Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013Mohan Arumugam
 
CISOA Conference 2020 Banner 9 Development
CISOA Conference 2020 Banner 9 DevelopmentCISOA Conference 2020 Banner 9 Development
CISOA Conference 2020 Banner 9 DevelopmentBrad Rippe
 
Code First with Serverless Azure Functions
Code First with Serverless Azure FunctionsCode First with Serverless Azure Functions
Code First with Serverless Azure FunctionsJeremy Likness
 
PHP North-East - Automated Deployment
PHP North-East - Automated DeploymentPHP North-East - Automated Deployment
PHP North-East - Automated DeploymentMichael Peacock
 

Similar to Database Change Management as a Service (20)

BPMS1
BPMS1BPMS1
BPMS1
 
BPMS1
BPMS1BPMS1
BPMS1
 
FlywayDB Migration with Spring Boot
FlywayDB Migration with Spring BootFlywayDB Migration with Spring Boot
FlywayDB Migration with Spring Boot
 
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
 
Evolutionary Database Design
Evolutionary Database DesignEvolutionary Database Design
Evolutionary Database Design
 
DevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven InfrastructureDevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven Infrastructure
 
Iac d.damyanov 4.pptx
Iac d.damyanov 4.pptxIac d.damyanov 4.pptx
Iac d.damyanov 4.pptx
 
Liquibase - Open Source version control for your database
Liquibase - Open Source version control for your databaseLiquibase - Open Source version control for your database
Liquibase - Open Source version control for your database
 
Liquibase – a time machine for your data
Liquibase – a time machine for your dataLiquibase – a time machine for your data
Liquibase – a time machine for your data
 
Migrating to SharePoint 2013 - Business and Technical Perspective
Migrating to SharePoint 2013 - Business and Technical PerspectiveMigrating to SharePoint 2013 - Business and Technical Perspective
Migrating to SharePoint 2013 - Business and Technical Perspective
 
RoR guide_p1
RoR guide_p1RoR guide_p1
RoR guide_p1
 
Ready, Set, Upgrade!
Ready, Set, Upgrade!Ready, Set, Upgrade!
Ready, Set, Upgrade!
 
Intro to Github Actions @likecoin
Intro to Github Actions @likecoinIntro to Github Actions @likecoin
Intro to Github Actions @likecoin
 
Agile Database Modeling with Grails - Preview of GORM 1.4 - SF Grails Meetup ...
Agile Database Modeling with Grails - Preview of GORM 1.4 - SF Grails Meetup ...Agile Database Modeling with Grails - Preview of GORM 1.4 - SF Grails Meetup ...
Agile Database Modeling with Grails - Preview of GORM 1.4 - SF Grails Meetup ...
 
Going Serverless with Azure Functions in .NET
Going Serverless with Azure Functions in .NETGoing Serverless with Azure Functions in .NET
Going Serverless with Azure Functions in .NET
 
Architecting the Future: Abstractions and Metadata - BSidesKC
Architecting the Future: Abstractions and Metadata - BSidesKCArchitecting the Future: Abstractions and Metadata - BSidesKC
Architecting the Future: Abstractions and Metadata - BSidesKC
 
Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013
 
CISOA Conference 2020 Banner 9 Development
CISOA Conference 2020 Banner 9 DevelopmentCISOA Conference 2020 Banner 9 Development
CISOA Conference 2020 Banner 9 Development
 
Code First with Serverless Azure Functions
Code First with Serverless Azure FunctionsCode First with Serverless Azure Functions
Code First with Serverless Azure Functions
 
PHP North-East - Automated Deployment
PHP North-East - Automated DeploymentPHP North-East - Automated Deployment
PHP North-East - Automated Deployment
 

Recently uploaded

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 

Recently uploaded (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 

Database Change Management as a Service

  • 1. + Database Change Management* as a service * Also known as ‘patching’ or ‘refactoring’
  • 2. + About me (Andrew Solomon) Was … an academic teaching Perl Am now doing …  Perl Web Development at Net-A-Porter  (learning) Devops at Net-A-Porter  Teaching at Geekuni
  • 3. + Motivation Data is inconvenient  Next app release coming  App has new features  Needs different DB structure  Can’t just trash and install DB like an app
  • 4. + Principles For safe refactoring  Backward compatibility  Old and new app versions are ok with the refactored DB  DB is versioned  You can quickly determine which patches have been applied  App won’t be run if the DB is not compatible  Write a rollback for every DB change http://www.amazon.co.uk/Continuous-Delivery-Deployment- Automation-Addison-Wesley/dp/0321601912
  • 5. + The Net-a-Porter Way Old school
  • 6. + The Net-a-Porter Way Old school  Put refactor code into My-App’s code base  Approach A: Run when installing the My-App RPM  Approach B: Run when starting My-App  Log the patches run in the database
  • 7. + The Net-a-Porter Way Old school  Put refactor.pl into My-App’s code base  PROBLEM: A slightly different refactor.pl for each app  PROBLEM: refactor.pl has extra CPAN dependencies  Approach A: Run when installing the My-App RPM  Approach B: Run when starting My-App  Log the patches run in the database
  • 8. + The Net-a-Porter Way Old school  Put refactor.pl into My-App’s code base  PROBLEM: A slightly different refactor.pl for each app  PROBLEM: refactor.pl has extra CPAN dependencies  Approach A: Run when installing the My-App RPM  Approach B: Run when starting My-App  PROBLEM: Multiple My-App servers per DB  Log the patches run in the database
  • 10. + Available Refactoring Tools Flyway Liquibase DB Deploy
  • 11. + Winner: Liquibase Big user base Bought by Datical Has branching and More features than Flyway DB Deploy uses Apache ANT
  • 14. + Liquibase How it works Input:  An XML file listing SQL files to run  Special comments in the SQL files for tagging Output:  ‘databasechangelog’ tables  Which patches have been run  ‘databasechangeloglock’  Ensure only one refactoring process!
  • 15. + Liquibase Example XML <databaseChangeLog …> <include file="1.0.0/000-create_schema.sql” relativeToChangelogFile="true"/> <include file="1.0.0/010-populate.sql” relativeToChangelogFile="true"/> <changeSet author="a.solomon" id="tag-1.0.0"> <tagDatabase tag="1.0.0"/> </changeSet> </databaseChangeLog>
  • 16. + Liquibase Example SQL --liquibase formatted sql --changeset a.solomon:1.0.1-000 BEGIN; CREATE TABLE public.foobar ( id INTEGER PRIMARY KEY, name TEXT UNIQUE NOT NULL ); ALTER table public.foobar OWNER to magpie; --ROLLBACK DROP TABLE public.foobar; COMMIT;
  • 17. + Liquibase Example Update /usr/bin/liquibase --changeLogFile=changeset.xml --url="jdbc:postgresql://db1.myapp.com:5432/myapp-db1" --username=liquibase –password=foobar update
  • 18. + Liquibase Example Rollback /usr/bin/liquibase --changeLogFile=changeset.xml --url="jdbc:postgresql://db1.myapp.com:5432/myapp-db1" --username=liquibase –password=foobar rollback 1.0.0
  • 19. + Liquibase Example databasechangelog author | filename | md5sum | tag a.solomon | 1.0.1/000-create_schema.sql | 7:49c8 | 1.0.1
  • 20. + Liquibase::Git What is it?  Perl module and script (soon on CPAN?)  A perl script  Clones git repo of the app  Looks in a directory of patches  Calls liquibase
  • 22. + Liquibase::Git Example $ liquibase-git --username liquibase --password foobar --db mydb-db1 --hostname db1.myapp.com --git-repo https://github.com/nap/myapp.git --git-changeset-dir db/db1 --git-identifier master --db-type postgresql --changeset-file changeset.xml
  • 23. + NAP::Liquibase Getting the Puppet to help Most of Liquibase::Git’s parameters are retrieved from the Puppet DB Just reads a new file from My-App – the list of DBs to refactor # in the puppet hieradata $ cat myapp.com.yaml liquibase: databases: - db: 'myapp-db1' - db: 'myapp-db2’ # ask mco for myapp’s dbhost $ nap-liquibase --db-host db1.myapp.com --app-git-repo https:://github.com/nap/myapp.git --app-git-identifier master
  • 25. Jenkins Deploy-oid mco ping … -F system_db=liquibase
  • 26. + Appendix … managing DBs outside the Puppet estate Cases where the box is being managed differently with puppet… Jenkins Continuous Integration Test Server Developer’s Box  Option 1: Emulate Liquibase on an empty DB – 5 lines  Option 2: Call liquibase-git to update a DB dump
  • 27. + Conclusion Don’t write new DB refactoring code for each app Don’t assume you’ll only have one app server per DB Don’t deploy DB refactoring code on the app’s host Treat it as a service
  • 28. + But wait!!! There’s more…  Ilmari told me about it  It’s a Perl project of David E. Wheeler / theory  Based on sane principles: http://sqitch.org/ Sqitch is to Liquibase Is what Git is to CVS  The switch to sqitch will be almost invisible at the architecture level  Only difference is that the developers get LOCAL application of the patches on the dev box with a simple command-line interface
  • 29. + Questions? … or grab me at the pub.