SlideShare a Scribd company logo
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

More Related Content

Similar to 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 introduction
Marc 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 Slovenia
Dr. 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 Slovenia
Dr. 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-native
cornelia 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-native
VMware Tanzu
 
Developing Microservices Directly in AKS/Kubernetes
Developing Microservices Directly in AKS/KubernetesDeveloping Microservices Directly in AKS/Kubernetes
Developing Microservices Directly in AKS/Kubernetes
Chakradhar Rao Jonagam
 
The Rocky Cloud Road
The Rocky Cloud RoadThe Rocky Cloud Road
The Rocky Cloud Road
Gert 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 docker
Agile 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 WORLD
Aleksandr Maklakov
 
Azure DevOps Tasks.pptx
 Azure DevOps Tasks.pptx Azure DevOps Tasks.pptx
Azure DevOps Tasks.pptx
PrasanthOneness
 
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 Database
Michaela 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 FaaS
Dileepa 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 realists
Karthik Gaekwad
 
Devops Days, 2019 - Charlotte
Devops Days, 2019 - CharlotteDevops Days, 2019 - Charlotte
Devops Days, 2019 - Charlotte
botsplash.com
 

Similar to 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
 

More from 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-Benutzer
Marc 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 Deployments
Marc 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 deployments
Marc 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 DEPLOYMENTS
Marc 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-PROZESS
Marc 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 Kubernetes
Marc 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-Prozess
Marc 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 Pipelines
Marc 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 deployments
Marc Müller
 
DWX 2022 - DevSecOps mit GitHub
DWX 2022 - DevSecOps mit GitHubDWX 2022 - DevSecOps mit GitHub
DWX 2022 - DevSecOps mit GitHub
Marc 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-Prozess
Marc 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 Kubernetes
Marc 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 DevOps
Marc Müller
 
Helm introduction
Helm introductionHelm introduction
Helm introduction
Marc 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 DevOps
Marc 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 Features
Marc 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 Features
Marc Müller
 

More from 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
 

Recently uploaded

Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 

Recently uploaded (20)

Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 

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