SlideShare ist ein Scribd-Unternehmen logo
1 von 62
Downloaden Sie, um offline zu lesen
DB Schema deployment within
Kubernetes Releases
Marc Müller
Principal Consultant
marc.mueller@4tecture.ch
@muellermarc
www.4tecture.ch
Slide Download
https://www.4tecture.ch/events/dwx23k8sdbdeployment
Agenda
▪ Intro
▪ Evolving Databases
▪ K8s specific deployment
approaches
▪ Autonomous Deployment
▪ Implementing a DB schema
deployment solution
▪ SQL Server Data Tools
Intro
DB schema deployment with Kubernetes releases
Write Code
Customer use the
code
Write Code
Customer use the
code
100 deployments
per day!
Being ready for 100 deployments a day
Fully automated process
▪ Build Automation
▪ Deployment Automation
▪ Test Automation
Small and frequent releases
▪ Reduce Complexity
▪ Daily Business
There is no place like production
▪ Testing in Production
▪ Zero Downtime
▪ Feature Flags
What about the DB development?
Database development
is fully integrated
No manual schema
changes
Automated deployment
of schema changes
Reality?
Different Teams
DB development not
integrated / manual
Schema mismatch
between dev and prod
Challenges
DB schema and code change
belong together
Dry-Run on (production) data
Data Migrations / Reference
Data
Zero Downtime Deployment
Evolving Databases
DB schema deployment with Kubernetes releases
Database Migrations
New version of the app = different database
schema
Many tools to diff and apply new schemas
Zero-downtime deployments is often a critical
requirement
Code First
DB First
Release v2
Deployment Approaches
Deploy
DB Schema
Deploy
Binaries
Prod Environment
v2
Binaries
v1
Prod Environment
v2
Binaries
v2
Release v2
Deploy
Binaries
Deploy
DB Schema
Prod Environment
v1 Binaries
v1
Binaries
v2
Factory
Prod Environment
v2 Binaries
v1
Binaries
v2
Factory
Where to put the fallback logic?
Database
▪ Use views / triggers to support old
schema
Advantages
▪ Old code just works during
deployment
Disadvantages
▪ Have a lot of if statement in
database logic
▪ Harder to test
Code
▪ Use factory to determine the
implementation for the current database
version
▪ Couple database version to features /
implementation
Advantages
▪ Code is easier to test
Disadvantages
▪ More complexity in code
▪ Factory / Toggles needed
Support Rollback Scenarios
«If you can’t get upgrade right, what leads
you to believe you could get rollback right
as well?” – Buck Hodges
Implement Rollback logic only if needed
▪ DB deployment is often complex and multi-step
▪ Hopefully never used – wasted time for implementation and testing?
When to run the migration?
On service startup As part of the deployment
process script
As dedicated jobs within your
application (i.e. k8s jobs)
Best Practices
▪ DB Frist deployment mode
▪ Easer to develop
▪ DB Migration is critical – fail fast / don’t deploy binaries
▪ No rollback – forward only
▪ Saves huge effort
▪ PR validation / staging will bring up errors before production deployment
▪ Fully automated process – fast rollout of fixes
▪ Dedicated Deployment Job
▪ Application is self-contained
▪ No dependencies to other deployment scripts
▪ Functionality of target environment
Kubernetes specific
deployment approaches
DB schema deployment with Kubernetes releases
CD
PR
Classic CI / CD Pipeline
CI
Checkout
Build
App
Run Unit
Test
Build
Dacpac
Publish
Dacpac
Publish
App
Create DB
Deploy DB
Schema
Deploy
App
QA
Deploy DB
Schema
Deploy
App
Pre-Prod
Clone
Prod DB
Deploy DB
Schema
Deploy
App
Prod
Deploy DB
Schema
Deploy
App
CI Type
k8s
Pod
Pod
Push Approach
CI Pipeline
CD Pipeline
Container
Registry
SQL DB SQL DB SQL DB
Pod
Pod
Pod
Pod
Pull Approach
k8s
Pod
Pod
CI Pipeline
CD Pipeline
Container
Registry
SQL DB SQL DB SQL DB
Pod
Pod
Pod
Pod
Git Repo
(config)
Operator
Push vs Pull Approaches
Push Approach
▪ Classical CI/CD
▪ Agent pushes artifacts
to target
▪ Pipeline owns
deployment logic
Pull Approach
▪ GitOps approach
▪ Observe configuration
changes and pull
application artifacts
▪ Application package
owns deployment logic
Current Deployment
Pod #1
v1
Pod #2
v1
Pod #3
v1
Pod #4
v1
Rolling Update 1/4
Pod #1
v1
Pod #2
v1
Pod #3
v1
Pod #4
v1
Rolling Update 2/4
Pod #1
v2
Pod #2
v2
Pod #3
v1
Pod #4
v1
Rolling Update 3/4
Pod #1
v2
Pod #2
v2
Pod #3
v2
Pod #4
v1
Rolling Update 4/4
Pod #1
v2
Pod #2
v2
Pod #3
v2
Pod #4
v2
Rolling Update
Migration on service start
Call “db.Database.Migrate” at startup
Problems:
▪ Every instance of the service will attempt to migrate
the database
▪ The application has permissions to perform
destructive updates to the database
Migration run by deployment scripts
Use Azure Pipelines / GitHub Actions to run a
deployment script before service rollout
Pro:
▪ Single and dedicated DB deployment
▪ Dedicated security principal for schema deployment
Challenges:
▪ Knowledge in pipeline, application has a dependency
to pipelines to run correctly
Using Jobs as part of your application
Use Kubernetes jobs and init containers / Helm chart
hooks
Pro:
▪ Dedicated job with dedicated identity / permissions
▪ Part of target environment, no external
dependencies
Challenges:
▪ More complexity
Automomous
Deployment
DB schema deployment with Kubernetes releases
Autonomous Application Packages
▪ CI/CD pipelines work great for internal services
▪ If an application package is distributed, the schema
deployment should be part of it
▪ Logic from the CI/CD pipeline is moved to the
application package
▪ CI/CD pipelines can be simplified
Helm Release
Deployment
Helm Release
App Pod
App
Container
Init
Container
Job
DB Migration Pod
DB Migration
Container
Service Ingress
DB
Security Considerations
▪ Strict security boundary between dev/test
and prod
▪ Use dedicated users for each database /
service
▪ Use dedicated users for
▪ Schema deployment with DDL
▪ Application / service with read/write permissions
Demo
Kubernetes Rollout
Implementing a DB schema
deployment solution
DB schema deployment with Kubernetes releases
Create a custom migration runner
▪ Independent (and app specific) tool to
run the DB migration
▪ Developed side-by-side with application
and DB schema
▪ Containerized
▪ Packaged in service deployment
Demo
Migration Runner
Define a Kubernetes Job
▪ Run your DB migration tool as a
Kubernetes job
▪ Use dedicated service identities with
corresponding permissions on database
Demo
Job
Use init containers
▪ Use init containers to wait for the
migration to successfully finish
▪ Init container will block the deployment /
execution of new application containers
without a successful deployment
▪ Dedicated permissions needed to monitor
jobs
Demo
Init Container
Publish single package
▪ Package contains all configurations and
container references to deploy and run
the application
▪ Supports any deployment paradigm /
automated and manual deployment
▪ Ideal solution to distribute your
applications at customer site
SQS Server Data Tools
(SSDT)
DB schema deployment with Kubernetes releases
SSDT - Characteristic
• SSDT Project Type for relational Database
Development
• Integrated in Visual Studio IDE
• Others: SSMS, Redgate, DDL/DML Scripts
• SSDT Advantages:
IDE
MSBuild
IntelliSense
Validation
Code Base
Consistency
Design
Compare
CI
CD
• Officially Supported since VS 2015
• 1:1 Database Representation
• SSDT Deployment / Prerequisites:
SSDT - Characteristic
DB Schema Migrations (Static & Dynamic SQL)
Single Pre- and Post Script Logic
Microsoft.Data.Tools.Msbuild
(NuGet)
SSDT - Features
• Build time validation / IntelliSense Support
• Bidirectional Scheme Comparison (SSDT  DB)
• Bidirectional Scheme Synchronization (SSDT  DB)
• Versioned migration and schemes artifact (DACPAC)
• Code-base integration / Change tracking (GIT)
Schema Compare
• Schema Compare
• Local Development
• Bidirectional Sync.
• Choose your
favorite IDE
• Prevent data loss:
rename in SSDT
Code Analysis
• Standardized Design Patterns
• Code Quality
• Reduce Code
Smells
• Supports Static-/
and Dynamic SQL
• Tables, SP, UDDT,
Views…
Developer Workflow
1. Create a Feature Branch
from Development
2. Publish/Deploy (F5)
Database Project
3. Develop Database
changes (Renames have
to performed in SSDT)
4. Perform a Schema
Compare from DB to
Database Project, Sync.
5. Commit > PR > Review
Local
DEV DB
Visual Studio
DB Project Git Repo
→
QA Dump
Prod Dump
Demo
SSDT in Visual Studio
SSDT is nice, but…
SSDT supports basic script extensibility
▪ Single Pre-Script
▪ Single Post-Script
Enterprise-grade migrations imply
complexity
▪ Extended Script Management is needed
▪ State Tracking of Custom Migrations
▪ «DB Version» Tracking
SSDT can easily be extended….
Migration History
▪
▪
▪
▪
▪
▪
▪
Our Learnings combined…
Features
• Configurable Setup and
Naming Convention
• Logging / Full Transactional
Scripts
• Custom execution filters
• Fully configurable Extension
Q & A
DB schema deployment with Kubernetes releases
Recap
▪ Dedicated migration runner outside the
service
▪ Use k8s functionality: jobs and init container
▪ Self-contained package, no additional
deployment logic
▪ Database Development fully integrated into
development process
▪ No manual schema changes in deployment
process
Thank you for your attention!
If you have any questions do not hesitate to contact us:
4tecture GmbH Marc Müller
Industriestrasse 25 Principal Consultant
CH-8604 Volketswil
+41 44 508 37 00 marc.mueller@4tecture.ch
info@4tecture.ch @muellermarc
www.4tecture.ch www.powerofdevops.com
DWX 2023 - Datenbank-Schema Deployment im Kubernetes Release

Weitere ähnliche Inhalte

Ähnlich wie DWX 2023 - Datenbank-Schema Deployment im Kubernetes Release

Experts Live Europe 2017 - Why you should care about Docker - an introduction
Experts Live Europe 2017 - Why you should care about Docker - an introductionExperts Live Europe 2017 - Why you should care about Docker - an introduction
Experts Live Europe 2017 - Why you should care about Docker - an introductionMarc Müller
 
Achieving Full Stack DevOps at Colonial Life
Achieving Full Stack DevOps at Colonial Life Achieving Full Stack DevOps at Colonial Life
Achieving Full Stack DevOps at Colonial Life DevOps.com
 
SQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DACSQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DACsqlserver.co.il
 
Continuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
Continuous Integration and the Data Warehouse - PASS SQL Saturday SloveniaContinuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
Continuous Integration and the Data Warehouse - PASS SQL Saturday SloveniaDr. John Tunnicliffe
 
Continuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
Continuous Integration and the Data Warehouse - PASS SQL Saturday SloveniaContinuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
Continuous Integration and the Data Warehouse - PASS SQL Saturday SloveniaDr. John Tunnicliffe
 
Kubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-native
Kubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-nativeKubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-native
Kubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-nativecornelia davis
 
Kubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-native
Kubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-nativeKubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-native
Kubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-nativeVMware Tanzu
 
Developing Microservices Directly in AKS/Kubernetes
Developing Microservices Directly in AKS/KubernetesDeveloping Microservices Directly in AKS/Kubernetes
Developing Microservices Directly in AKS/KubernetesChakradhar Rao Jonagam
 
The Rocky Cloud Road
The Rocky Cloud RoadThe Rocky Cloud Road
The Rocky Cloud RoadGert Drapers
 
Real World Development: Peeling The Onion – Migrating A Monolithic Applicatio...
Real World Development: Peeling The Onion – Migrating A Monolithic Applicatio...Real World Development: Peeling The Onion – Migrating A Monolithic Applicatio...
Real World Development: Peeling The Onion – Migrating A Monolithic Applicatio...Amazon Web Services
 
Erik Baardse - Bringing Agility to Traditional application by docker
Erik Baardse - Bringing Agility to Traditional application by dockerErik Baardse - Bringing Agility to Traditional application by docker
Erik Baardse - Bringing Agility to Traditional application by dockerAgile Impact Conference
 
HOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLDHOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLDAleksandr Maklakov
 
Azure DevOps Tasks.pptx
 Azure DevOps Tasks.pptx Azure DevOps Tasks.pptx
Azure DevOps Tasks.pptxPrasanthOneness
 
Microsoft Cloud BI Update 2012 for SQL Saturday Philly
Microsoft Cloud BI Update 2012 for SQL Saturday PhillyMicrosoft Cloud BI Update 2012 for SQL Saturday Philly
Microsoft Cloud BI Update 2012 for SQL Saturday PhillyMark Kromer
 
Саша Белецкий "Continuous Delivery в продуктовой разработке"
Саша Белецкий "Continuous Delivery в продуктовой разработке"Саша Белецкий "Continuous Delivery в продуктовой разработке"
Саша Белецкий "Continuous Delivery в продуктовой разработке"Agile Base Camp
 
Bringing DevOps to the Database
Bringing DevOps to the DatabaseBringing DevOps to the Database
Bringing DevOps to the DatabaseMichaela Murray
 
Application modernization with azure PaaS and FaaS
Application modernization with azure PaaS and FaaSApplication modernization with azure PaaS and FaaS
Application modernization with azure PaaS and FaaSDileepa Rajapaksa
 
Azure Integration DTAP Series, How to go from Development to Production – Par...
Azure Integration DTAP Series, How to go from Development to Production – Par...Azure Integration DTAP Series, How to go from Development to Production – Par...
Azure Integration DTAP Series, How to go from Development to Production – Par...BizTalk360
 
Containers, microservices and serverless for realists
Containers, microservices and serverless for realistsContainers, microservices and serverless for realists
Containers, microservices and serverless for realistsKarthik Gaekwad
 
Devops Days, 2019 - Charlotte
Devops Days, 2019 - CharlotteDevops Days, 2019 - Charlotte
Devops Days, 2019 - Charlottebotsplash.com
 

Ähnlich wie DWX 2023 - Datenbank-Schema Deployment im Kubernetes Release (20)

Experts Live Europe 2017 - Why you should care about Docker - an introduction
Experts Live Europe 2017 - Why you should care about Docker - an introductionExperts Live Europe 2017 - Why you should care about Docker - an introduction
Experts Live Europe 2017 - Why you should care about Docker - an introduction
 
Achieving Full Stack DevOps at Colonial Life
Achieving Full Stack DevOps at Colonial Life Achieving Full Stack DevOps at Colonial Life
Achieving Full Stack DevOps at Colonial Life
 
SQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DACSQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DAC
 
Continuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
Continuous Integration and the Data Warehouse - PASS SQL Saturday SloveniaContinuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
Continuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
 
Continuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
Continuous Integration and the Data Warehouse - PASS SQL Saturday SloveniaContinuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
Continuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
 
Kubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-native
Kubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-nativeKubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-native
Kubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-native
 
Kubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-native
Kubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-nativeKubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-native
Kubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-native
 
Developing Microservices Directly in AKS/Kubernetes
Developing Microservices Directly in AKS/KubernetesDeveloping Microservices Directly in AKS/Kubernetes
Developing Microservices Directly in AKS/Kubernetes
 
The Rocky Cloud Road
The Rocky Cloud RoadThe Rocky Cloud Road
The Rocky Cloud Road
 
Real World Development: Peeling The Onion – Migrating A Monolithic Applicatio...
Real World Development: Peeling The Onion – Migrating A Monolithic Applicatio...Real World Development: Peeling The Onion – Migrating A Monolithic Applicatio...
Real World Development: Peeling The Onion – Migrating A Monolithic Applicatio...
 
Erik Baardse - Bringing Agility to Traditional application by docker
Erik Baardse - Bringing Agility to Traditional application by dockerErik Baardse - Bringing Agility to Traditional application by docker
Erik Baardse - Bringing Agility to Traditional application by docker
 
HOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLDHOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLD
 
Azure DevOps Tasks.pptx
 Azure DevOps Tasks.pptx Azure DevOps Tasks.pptx
Azure DevOps Tasks.pptx
 
Microsoft Cloud BI Update 2012 for SQL Saturday Philly
Microsoft Cloud BI Update 2012 for SQL Saturday PhillyMicrosoft Cloud BI Update 2012 for SQL Saturday Philly
Microsoft Cloud BI Update 2012 for SQL Saturday Philly
 
Саша Белецкий "Continuous Delivery в продуктовой разработке"
Саша Белецкий "Continuous Delivery в продуктовой разработке"Саша Белецкий "Continuous Delivery в продуктовой разработке"
Саша Белецкий "Continuous Delivery в продуктовой разработке"
 
Bringing DevOps to the Database
Bringing DevOps to the DatabaseBringing DevOps to the Database
Bringing DevOps to the Database
 
Application modernization with azure PaaS and FaaS
Application modernization with azure PaaS and FaaSApplication modernization with azure PaaS and FaaS
Application modernization with azure PaaS and FaaS
 
Azure Integration DTAP Series, How to go from Development to Production – Par...
Azure Integration DTAP Series, How to go from Development to Production – Par...Azure Integration DTAP Series, How to go from Development to Production – Par...
Azure Integration DTAP Series, How to go from Development to Production – Par...
 
Containers, microservices and serverless for realists
Containers, microservices and serverless for realistsContainers, microservices and serverless for realists
Containers, microservices and serverless for realists
 
Devops Days, 2019 - Charlotte
Devops Days, 2019 - CharlotteDevops Days, 2019 - Charlotte
Devops Days, 2019 - Charlotte
 

Mehr von Marc Müller

.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra....NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...Marc Müller
 
DWX 2023 - GitHub Actions für Azure-DevOps-Pipelines-Benutzer
DWX 2023 - GitHub Actions für Azure-DevOps-Pipelines-BenutzerDWX 2023 - GitHub Actions für Azure-DevOps-Pipelines-Benutzer
DWX 2023 - GitHub Actions für Azure-DevOps-Pipelines-BenutzerMarc Müller
 
DWX 2023 - Schnelles Feedback mit Pull-Request Deployments
DWX 2023 - Schnelles Feedback mit Pull-Request DeploymentsDWX 2023 - Schnelles Feedback mit Pull-Request Deployments
DWX 2023 - Schnelles Feedback mit Pull-Request DeploymentsMarc Müller
 
DWX 2023 - .NET-Microservices mit Dapr: Zu viel Abstraktion oder der richtige...
DWX 2023 - .NET-Microservices mit Dapr: Zu viel Abstraktion oder der richtige...DWX 2023 - .NET-Microservices mit Dapr: Zu viel Abstraktion oder der richtige...
DWX 2023 - .NET-Microservices mit Dapr: Zu viel Abstraktion oder der richtige...Marc Müller
 
Global Azure Austria 2023 - Fast feedback with pull request deployments
Global Azure Austria 2023 - Fast feedback with pull request deploymentsGlobal Azure Austria 2023 - Fast feedback with pull request deployments
Global Azure Austria 2023 - Fast feedback with pull request deploymentsMarc Müller
 
BASTA Spring 2023 - SCHNELLES FEEDBACK MIT PULL REQUEST DEPLOYMENTS
BASTA Spring 2023 - SCHNELLES FEEDBACK MIT PULL REQUEST DEPLOYMENTSBASTA Spring 2023 - SCHNELLES FEEDBACK MIT PULL REQUEST DEPLOYMENTS
BASTA Spring 2023 - SCHNELLES FEEDBACK MIT PULL REQUEST DEPLOYMENTSMarc Müller
 
BASTA Spring 2023 - AUTOMATISIERTES DATENBANK-DEPLOYMENT IM DEVOPS-PROZESS
BASTA Spring 2023 - AUTOMATISIERTES DATENBANK-DEPLOYMENT IM DEVOPS-PROZESSBASTA Spring 2023 - AUTOMATISIERTES DATENBANK-DEPLOYMENT IM DEVOPS-PROZESS
BASTA Spring 2023 - AUTOMATISIERTES DATENBANK-DEPLOYMENT IM DEVOPS-PROZESSMarc Müller
 
BASTA! 2022 - Einführung in Helm, der Paket-Manger für Kubernetes
BASTA! 2022 - Einführung in Helm, der Paket-Manger für KubernetesBASTA! 2022 - Einführung in Helm, der Paket-Manger für Kubernetes
BASTA! 2022 - Einführung in Helm, der Paket-Manger für KubernetesMarc Müller
 
BASTA! 2022 - Automatisiertes Datenbank-Deployment im DevOps-Prozess
 BASTA! 2022 - Automatisiertes Datenbank-Deployment im DevOps-Prozess BASTA! 2022 - Automatisiertes Datenbank-Deployment im DevOps-Prozess
BASTA! 2022 - Automatisiertes Datenbank-Deployment im DevOps-ProzessMarc Müller
 
BASTA! 2022 - GitHub Actions für Nutzer der Azure DevOps Pipelines
 BASTA! 2022 - GitHub Actions für Nutzer der Azure DevOps Pipelines BASTA! 2022 - GitHub Actions für Nutzer der Azure DevOps Pipelines
BASTA! 2022 - GitHub Actions für Nutzer der Azure DevOps PipelinesMarc Müller
 
.NET Day 2022 - Fast feedback with pull request deployments
.NET Day 2022 - Fast feedback with pull request deployments.NET Day 2022 - Fast feedback with pull request deployments
.NET Day 2022 - Fast feedback with pull request deploymentsMarc Müller
 
DWX 2022 - DevSecOps mit GitHub
DWX 2022 - DevSecOps mit GitHubDWX 2022 - DevSecOps mit GitHub
DWX 2022 - DevSecOps mit GitHubMarc Müller
 
DWX 2022 - Automatisiertes Datenbank-Deployment im DevOps-Prozess
DWX 2022 - Automatisiertes Datenbank-Deployment im DevOps-ProzessDWX 2022 - Automatisiertes Datenbank-Deployment im DevOps-Prozess
DWX 2022 - Automatisiertes Datenbank-Deployment im DevOps-ProzessMarc Müller
 
Einführung in Helm - der Paket-Manger für Kubernetes
Einführung in Helm - der Paket-Manger für KubernetesEinführung in Helm - der Paket-Manger für Kubernetes
Einführung in Helm - der Paket-Manger für KubernetesMarc Müller
 
DWX 2022 - Top 10 Best-Practices für YAML-Pipelines in Azure DevOps
DWX 2022 - Top 10 Best-Practices für YAML-Pipelines in Azure DevOpsDWX 2022 - Top 10 Best-Practices für YAML-Pipelines in Azure DevOps
DWX 2022 - Top 10 Best-Practices für YAML-Pipelines in Azure DevOpsMarc Müller
 
ADCD 2022 - Handling secrets in the release process with Azure DevOps and Azu...
ADCD 2022 - Handling secrets in the release process with Azure DevOps and Azu...ADCD 2022 - Handling secrets in the release process with Azure DevOps and Azu...
ADCD 2022 - Handling secrets in the release process with Azure DevOps and Azu...Marc Müller
 
BASTA Spring 2022 - Top 10 Best-Practices für YAML-Pipelines in Azure DevOps
BASTA Spring 2022 - Top 10 Best-Practices für YAML-Pipelines in Azure DevOpsBASTA Spring 2022 - Top 10 Best-Practices für YAML-Pipelines in Azure DevOps
BASTA Spring 2022 - Top 10 Best-Practices für YAML-Pipelines in Azure DevOpsMarc Müller
 
Azure Pipelines Multistage YAML - Top 10 Features
Azure Pipelines Multistage YAML - Top 10 FeaturesAzure Pipelines Multistage YAML - Top 10 Features
Azure Pipelines Multistage YAML - Top 10 FeaturesMarc Müller
 
Azure DevOps Multistage YAML Pipelines – Top 10 Features
Azure DevOps Multistage YAML Pipelines – Top 10 FeaturesAzure DevOps Multistage YAML Pipelines – Top 10 Features
Azure DevOps Multistage YAML Pipelines – Top 10 FeaturesMarc Müller
 

Mehr von Marc Müller (20)

.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra....NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
 
DWX 2023 - GitHub Actions für Azure-DevOps-Pipelines-Benutzer
DWX 2023 - GitHub Actions für Azure-DevOps-Pipelines-BenutzerDWX 2023 - GitHub Actions für Azure-DevOps-Pipelines-Benutzer
DWX 2023 - GitHub Actions für Azure-DevOps-Pipelines-Benutzer
 
DWX 2023 - Schnelles Feedback mit Pull-Request Deployments
DWX 2023 - Schnelles Feedback mit Pull-Request DeploymentsDWX 2023 - Schnelles Feedback mit Pull-Request Deployments
DWX 2023 - Schnelles Feedback mit Pull-Request Deployments
 
DWX 2023 - .NET-Microservices mit Dapr: Zu viel Abstraktion oder der richtige...
DWX 2023 - .NET-Microservices mit Dapr: Zu viel Abstraktion oder der richtige...DWX 2023 - .NET-Microservices mit Dapr: Zu viel Abstraktion oder der richtige...
DWX 2023 - .NET-Microservices mit Dapr: Zu viel Abstraktion oder der richtige...
 
Global Azure Austria 2023 - Fast feedback with pull request deployments
Global Azure Austria 2023 - Fast feedback with pull request deploymentsGlobal Azure Austria 2023 - Fast feedback with pull request deployments
Global Azure Austria 2023 - Fast feedback with pull request deployments
 
BASTA Spring 2023 - SCHNELLES FEEDBACK MIT PULL REQUEST DEPLOYMENTS
BASTA Spring 2023 - SCHNELLES FEEDBACK MIT PULL REQUEST DEPLOYMENTSBASTA Spring 2023 - SCHNELLES FEEDBACK MIT PULL REQUEST DEPLOYMENTS
BASTA Spring 2023 - SCHNELLES FEEDBACK MIT PULL REQUEST DEPLOYMENTS
 
BASTA Spring 2023 - AUTOMATISIERTES DATENBANK-DEPLOYMENT IM DEVOPS-PROZESS
BASTA Spring 2023 - AUTOMATISIERTES DATENBANK-DEPLOYMENT IM DEVOPS-PROZESSBASTA Spring 2023 - AUTOMATISIERTES DATENBANK-DEPLOYMENT IM DEVOPS-PROZESS
BASTA Spring 2023 - AUTOMATISIERTES DATENBANK-DEPLOYMENT IM DEVOPS-PROZESS
 
BASTA! 2022 - Einführung in Helm, der Paket-Manger für Kubernetes
BASTA! 2022 - Einführung in Helm, der Paket-Manger für KubernetesBASTA! 2022 - Einführung in Helm, der Paket-Manger für Kubernetes
BASTA! 2022 - Einführung in Helm, der Paket-Manger für Kubernetes
 
BASTA! 2022 - Automatisiertes Datenbank-Deployment im DevOps-Prozess
 BASTA! 2022 - Automatisiertes Datenbank-Deployment im DevOps-Prozess BASTA! 2022 - Automatisiertes Datenbank-Deployment im DevOps-Prozess
BASTA! 2022 - Automatisiertes Datenbank-Deployment im DevOps-Prozess
 
BASTA! 2022 - GitHub Actions für Nutzer der Azure DevOps Pipelines
 BASTA! 2022 - GitHub Actions für Nutzer der Azure DevOps Pipelines BASTA! 2022 - GitHub Actions für Nutzer der Azure DevOps Pipelines
BASTA! 2022 - GitHub Actions für Nutzer der Azure DevOps Pipelines
 
.NET Day 2022 - Fast feedback with pull request deployments
.NET Day 2022 - Fast feedback with pull request deployments.NET Day 2022 - Fast feedback with pull request deployments
.NET Day 2022 - Fast feedback with pull request deployments
 
DWX 2022 - DevSecOps mit GitHub
DWX 2022 - DevSecOps mit GitHubDWX 2022 - DevSecOps mit GitHub
DWX 2022 - DevSecOps mit GitHub
 
DWX 2022 - Automatisiertes Datenbank-Deployment im DevOps-Prozess
DWX 2022 - Automatisiertes Datenbank-Deployment im DevOps-ProzessDWX 2022 - Automatisiertes Datenbank-Deployment im DevOps-Prozess
DWX 2022 - Automatisiertes Datenbank-Deployment im DevOps-Prozess
 
Einführung in Helm - der Paket-Manger für Kubernetes
Einführung in Helm - der Paket-Manger für KubernetesEinführung in Helm - der Paket-Manger für Kubernetes
Einführung in Helm - der Paket-Manger für Kubernetes
 
DWX 2022 - Top 10 Best-Practices für YAML-Pipelines in Azure DevOps
DWX 2022 - Top 10 Best-Practices für YAML-Pipelines in Azure DevOpsDWX 2022 - Top 10 Best-Practices für YAML-Pipelines in Azure DevOps
DWX 2022 - Top 10 Best-Practices für YAML-Pipelines in Azure DevOps
 
Helm introduction
Helm introductionHelm introduction
Helm introduction
 
ADCD 2022 - Handling secrets in the release process with Azure DevOps and Azu...
ADCD 2022 - Handling secrets in the release process with Azure DevOps and Azu...ADCD 2022 - Handling secrets in the release process with Azure DevOps and Azu...
ADCD 2022 - Handling secrets in the release process with Azure DevOps and Azu...
 
BASTA Spring 2022 - Top 10 Best-Practices für YAML-Pipelines in Azure DevOps
BASTA Spring 2022 - Top 10 Best-Practices für YAML-Pipelines in Azure DevOpsBASTA Spring 2022 - Top 10 Best-Practices für YAML-Pipelines in Azure DevOps
BASTA Spring 2022 - Top 10 Best-Practices für YAML-Pipelines in Azure DevOps
 
Azure Pipelines Multistage YAML - Top 10 Features
Azure Pipelines Multistage YAML - Top 10 FeaturesAzure Pipelines Multistage YAML - Top 10 Features
Azure Pipelines Multistage YAML - Top 10 Features
 
Azure DevOps Multistage YAML Pipelines – Top 10 Features
Azure DevOps Multistage YAML Pipelines – Top 10 FeaturesAzure DevOps Multistage YAML Pipelines – Top 10 Features
Azure DevOps Multistage YAML Pipelines – Top 10 Features
 

Kürzlich hochgeladen

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 

Kürzlich hochgeladen (20)

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 

DWX 2023 - Datenbank-Schema Deployment im Kubernetes Release

  • 1. DB Schema deployment within Kubernetes Releases Marc Müller Principal Consultant marc.mueller@4tecture.ch @muellermarc www.4tecture.ch
  • 2.
  • 4. Agenda ▪ Intro ▪ Evolving Databases ▪ K8s specific deployment approaches ▪ Autonomous Deployment ▪ Implementing a DB schema deployment solution ▪ SQL Server Data Tools
  • 5. Intro DB schema deployment with Kubernetes releases
  • 6. Write Code Customer use the code Write Code Customer use the code
  • 8.
  • 9. Being ready for 100 deployments a day Fully automated process ▪ Build Automation ▪ Deployment Automation ▪ Test Automation Small and frequent releases ▪ Reduce Complexity ▪ Daily Business There is no place like production ▪ Testing in Production ▪ Zero Downtime ▪ Feature Flags
  • 10. What about the DB development? Database development is fully integrated No manual schema changes Automated deployment of schema changes
  • 11. Reality? Different Teams DB development not integrated / manual Schema mismatch between dev and prod
  • 12. Challenges DB schema and code change belong together Dry-Run on (production) data Data Migrations / Reference Data Zero Downtime Deployment
  • 13. Evolving Databases DB schema deployment with Kubernetes releases
  • 14. Database Migrations New version of the app = different database schema Many tools to diff and apply new schemas Zero-downtime deployments is often a critical requirement
  • 15. Code First DB First Release v2 Deployment Approaches Deploy DB Schema Deploy Binaries Prod Environment v2 Binaries v1 Prod Environment v2 Binaries v2 Release v2 Deploy Binaries Deploy DB Schema Prod Environment v1 Binaries v1 Binaries v2 Factory Prod Environment v2 Binaries v1 Binaries v2 Factory
  • 16. Where to put the fallback logic? Database ▪ Use views / triggers to support old schema Advantages ▪ Old code just works during deployment Disadvantages ▪ Have a lot of if statement in database logic ▪ Harder to test Code ▪ Use factory to determine the implementation for the current database version ▪ Couple database version to features / implementation Advantages ▪ Code is easier to test Disadvantages ▪ More complexity in code ▪ Factory / Toggles needed
  • 17. Support Rollback Scenarios «If you can’t get upgrade right, what leads you to believe you could get rollback right as well?” – Buck Hodges Implement Rollback logic only if needed ▪ DB deployment is often complex and multi-step ▪ Hopefully never used – wasted time for implementation and testing?
  • 18. When to run the migration? On service startup As part of the deployment process script As dedicated jobs within your application (i.e. k8s jobs)
  • 19. Best Practices ▪ DB Frist deployment mode ▪ Easer to develop ▪ DB Migration is critical – fail fast / don’t deploy binaries ▪ No rollback – forward only ▪ Saves huge effort ▪ PR validation / staging will bring up errors before production deployment ▪ Fully automated process – fast rollout of fixes ▪ Dedicated Deployment Job ▪ Application is self-contained ▪ No dependencies to other deployment scripts ▪ Functionality of target environment
  • 20. Kubernetes specific deployment approaches DB schema deployment with Kubernetes releases
  • 21. CD PR Classic CI / CD Pipeline CI Checkout Build App Run Unit Test Build Dacpac Publish Dacpac Publish App Create DB Deploy DB Schema Deploy App QA Deploy DB Schema Deploy App Pre-Prod Clone Prod DB Deploy DB Schema Deploy App Prod Deploy DB Schema Deploy App CI Type
  • 22. k8s Pod Pod Push Approach CI Pipeline CD Pipeline Container Registry SQL DB SQL DB SQL DB Pod Pod Pod Pod
  • 23. Pull Approach k8s Pod Pod CI Pipeline CD Pipeline Container Registry SQL DB SQL DB SQL DB Pod Pod Pod Pod Git Repo (config) Operator
  • 24. Push vs Pull Approaches Push Approach ▪ Classical CI/CD ▪ Agent pushes artifacts to target ▪ Pipeline owns deployment logic Pull Approach ▪ GitOps approach ▪ Observe configuration changes and pull application artifacts ▪ Application package owns deployment logic
  • 25. Current Deployment Pod #1 v1 Pod #2 v1 Pod #3 v1 Pod #4 v1 Rolling Update 1/4 Pod #1 v1 Pod #2 v1 Pod #3 v1 Pod #4 v1 Rolling Update 2/4 Pod #1 v2 Pod #2 v2 Pod #3 v1 Pod #4 v1 Rolling Update 3/4 Pod #1 v2 Pod #2 v2 Pod #3 v2 Pod #4 v1 Rolling Update 4/4 Pod #1 v2 Pod #2 v2 Pod #3 v2 Pod #4 v2 Rolling Update
  • 26. Migration on service start Call “db.Database.Migrate” at startup Problems: ▪ Every instance of the service will attempt to migrate the database ▪ The application has permissions to perform destructive updates to the database
  • 27. Migration run by deployment scripts Use Azure Pipelines / GitHub Actions to run a deployment script before service rollout Pro: ▪ Single and dedicated DB deployment ▪ Dedicated security principal for schema deployment Challenges: ▪ Knowledge in pipeline, application has a dependency to pipelines to run correctly
  • 28. Using Jobs as part of your application Use Kubernetes jobs and init containers / Helm chart hooks Pro: ▪ Dedicated job with dedicated identity / permissions ▪ Part of target environment, no external dependencies Challenges: ▪ More complexity
  • 29. Automomous Deployment DB schema deployment with Kubernetes releases
  • 30. Autonomous Application Packages ▪ CI/CD pipelines work great for internal services ▪ If an application package is distributed, the schema deployment should be part of it ▪ Logic from the CI/CD pipeline is moved to the application package ▪ CI/CD pipelines can be simplified
  • 31. Helm Release Deployment Helm Release App Pod App Container Init Container Job DB Migration Pod DB Migration Container Service Ingress DB
  • 32. Security Considerations ▪ Strict security boundary between dev/test and prod ▪ Use dedicated users for each database / service ▪ Use dedicated users for ▪ Schema deployment with DDL ▪ Application / service with read/write permissions
  • 34.
  • 35. Implementing a DB schema deployment solution DB schema deployment with Kubernetes releases
  • 36. Create a custom migration runner ▪ Independent (and app specific) tool to run the DB migration ▪ Developed side-by-side with application and DB schema ▪ Containerized ▪ Packaged in service deployment
  • 38.
  • 39.
  • 40. Define a Kubernetes Job ▪ Run your DB migration tool as a Kubernetes job ▪ Use dedicated service identities with corresponding permissions on database
  • 42.
  • 43. Use init containers ▪ Use init containers to wait for the migration to successfully finish ▪ Init container will block the deployment / execution of new application containers without a successful deployment ▪ Dedicated permissions needed to monitor jobs
  • 45.
  • 46.
  • 47. Publish single package ▪ Package contains all configurations and container references to deploy and run the application ▪ Supports any deployment paradigm / automated and manual deployment ▪ Ideal solution to distribute your applications at customer site
  • 48. SQS Server Data Tools (SSDT) DB schema deployment with Kubernetes releases
  • 49. SSDT - Characteristic • SSDT Project Type for relational Database Development • Integrated in Visual Studio IDE • Others: SSMS, Redgate, DDL/DML Scripts • SSDT Advantages: IDE MSBuild IntelliSense Validation Code Base Consistency Design Compare CI CD
  • 50. • Officially Supported since VS 2015 • 1:1 Database Representation • SSDT Deployment / Prerequisites: SSDT - Characteristic DB Schema Migrations (Static & Dynamic SQL) Single Pre- and Post Script Logic Microsoft.Data.Tools.Msbuild (NuGet)
  • 51. SSDT - Features • Build time validation / IntelliSense Support • Bidirectional Scheme Comparison (SSDT  DB) • Bidirectional Scheme Synchronization (SSDT  DB) • Versioned migration and schemes artifact (DACPAC) • Code-base integration / Change tracking (GIT)
  • 52. Schema Compare • Schema Compare • Local Development • Bidirectional Sync. • Choose your favorite IDE • Prevent data loss: rename in SSDT
  • 53. Code Analysis • Standardized Design Patterns • Code Quality • Reduce Code Smells • Supports Static-/ and Dynamic SQL • Tables, SP, UDDT, Views…
  • 54. Developer Workflow 1. Create a Feature Branch from Development 2. Publish/Deploy (F5) Database Project 3. Develop Database changes (Renames have to performed in SSDT) 4. Perform a Schema Compare from DB to Database Project, Sync. 5. Commit > PR > Review Local DEV DB Visual Studio DB Project Git Repo → QA Dump Prod Dump
  • 56. SSDT is nice, but… SSDT supports basic script extensibility ▪ Single Pre-Script ▪ Single Post-Script Enterprise-grade migrations imply complexity ▪ Extended Script Management is needed ▪ State Tracking of Custom Migrations ▪ «DB Version» Tracking SSDT can easily be extended….
  • 58. Our Learnings combined… Features • Configurable Setup and Naming Convention • Logging / Full Transactional Scripts • Custom execution filters • Fully configurable Extension
  • 59. Q & A DB schema deployment with Kubernetes releases
  • 60. Recap ▪ Dedicated migration runner outside the service ▪ Use k8s functionality: jobs and init container ▪ Self-contained package, no additional deployment logic ▪ Database Development fully integrated into development process ▪ No manual schema changes in deployment process
  • 61. Thank you for your attention! If you have any questions do not hesitate to contact us: 4tecture GmbH Marc Müller Industriestrasse 25 Principal Consultant CH-8604 Volketswil +41 44 508 37 00 marc.mueller@4tecture.ch info@4tecture.ch @muellermarc www.4tecture.ch www.powerofdevops.com