I'm setting up a dockerized environment with 3 docker container:
我正在设置一个带有3个码头集装箱的码头环境:
- mysql db
- flyway db migration
- java application
I need the java application container to start after flyway migration has finished
我需要在Flyway迁移完成后启动Java应用程序容器
I already fixed the problem that flyway starts after the mysql database is up, by setting the
我已经修复了在MySQL数据库启动后Flyway启动的问题,方法是设置
-connectRetries=60
parameter.
-ConnectRetries=60参数。
The only thing I have to fix now is to start the java application after the flyway migration has finished. But due to the fact that the flyway docker container exits after the execution I have no idea how to notify (via Health Checks or something else) my java container to start.
我现在需要解决的唯一问题是在Flyway迁移完成后启动Java应用程序。但是,由于Flyway docker容器在执行后退出,我不知道如何通知(通过运行状况检查或其他方式)我的Java容器启动。
Edit:
编辑:
My goal is to start flyway after the database is up (not the container) and start the java container after the migration has finished. The Flyway part (after mysql is up) has been done via the said connectRetries and a timeout.
我的目标是在数据库(而不是容器)启动后启动Flyway,并在迁移完成后启动Java容器。Flyway部分(在MySQL启动后)已通过所述的ConnectRetries和超时完成。
更多回答
Could you please describe what kind of problem you try to solve this way? Because, what you've described - sounds weird, why flyway migration runs in a different container? -connectRetries=60
looks like a workaround
你能描述一下你试图用这种方式解决什么样的问题吗?因为,正如您所描述的-听起来很奇怪,为什么Flyway迁移在不同的容器中运行?-ConnectRetries=60看起来像是一种解决办法
I try to solve the problem of calling flyway after the database is up, and call java after the migration is done. Why is using flyway in a seperate container a bad idea?
我试图解决在数据库启动后调用Flyway的问题,并在迁移完成后调用Java。为什么在单独的集装箱中使用Flyway是一个坏主意?
优秀答案推荐
我是一名优秀的程序员,十分优秀!