I would use Swarm (1.12) to deploy Java application (Spring). Moreover I would take advantage of healthchecking and load-balancing features.
However my app is using database migration tools named Flyway
. When new migration is written, Flyway
will apply migration during deployment, thus application will not be available until migration successfully completed.
So between each app version (depending of migration present or not), application deployment can take different time to deploy from less than 1 min (without migration) to more than hour (when migration).
Is there a good practice to manage such case? Because if I set HEALTHCHECK
swarm will consider application has unhealthy and restart it again and again (depending on restart-policies
.
- Should database migration be outside of application? Deploy
app-v1
, then deploymigrator-v1-v2
, wait migration then upgradeapp-v1
toapp-v2
- Other way?