Kubernetes allows a lot. After discovering its features, it’s easy to think it can magically transform your application deployment process into a painless no-event. For Hello World applications, that is the case. Unfortunately, not many of us do deploy such applications day-to-day. You need to think about application backward compatibility, possible rollback, database schema migration, etc. I believe the later is one of the biggest pain point. In this talk, I’ll demo how to update a Spring Boot app deployed on a Kubernetes cluster with a non-trivial database schema migration with the help of Flyway, while keeping the service up during the entire update process.
2. @nicolas_frankel
Me, myself and I
Former developer, team lead, architect,
blah-blah
Developer Advocate
Curious about Kubernetes
Loves the Spring framework
3. @nicolas_frankel
Hazelcast
HAZELCAST IMDG is an operational,
in-memory, distributed computing
platform that manages data using
in-memory storage and performs
execution for breakthrough
and scale.
HAZELCAST JET is the ultra
fast, application embeddable,
3rd generation stream
processing engine for low
latency batch and stream
processing.
15. @nicolas_frankel
Apps don’t start instantly
Kubernetes need to know the
application’s state
• To mark the pod ready
Spring Boot offers the actuator
• With the /health endpoint
25. @nicolas_frankel
Steps decomposition
1. Create ADDRESS table
• App use the PERSON table data as previously
• Trigger copy data to ADDRESS table
2. The ADDRESS becomes the “source of truth”
• App now uses the ADDRESS table data
• Trigger copy data to the PERSON table
3. Stop copying the data
4. (Remove extra columns in the PERSON table)
27. @nicolas_frankel
Flyway
“Version control for your database.
Robust schema evolution across all your
environments.
With ease, pleasure and plain SQL.”
-- https://flywaydb.org/
28. @nicolas_frankel
Flyway 101
Based on migrations
A migration is a SQL script
Each migration is versioned
Flyway records migrations in a dedicated
table