I have 3 services. DB, API, Liquibase. API is dependant on DDB and Liquibase. Below is my compose.yml. The issue I am facing is, even though I have wait-for.sh script under API service which waits for DB port to be available for connections, it comes up as soon as the port is ready for connections. But liquibase which creates Db schema and applies DB related changes is still under process. So the API service is not able to connect to DB as the schema is still not created by the liquibase service. how do I make API service to wait until liquibase applies all the changes on DB.
version: '3'
services:
db:
build: drs-db
user: "1000:50"
volumes:
- /data/mysql:/var/lib/mysql
container_name: drs-db
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
ports:
- "3307:3306"
drs-api:
container_name: drs-api
hostname: drs-api
domainname: XX.com
build:
context: ./drs-api
args:
DRS_API_URL: XX/${DRS_API_VERSION}
DRS_API_WAR: drs-web-${DRS_API_VERSION}.war
DRS_CLIENT_URL: CC/drs-client/${DRS_CLIENT_VERSION}
DRS_CLIENT_WAR: drs-client-${DRS_CLIENT_VERSION}.war
ports:
- "8096:8443"
depends_on:
- db
- drs-liquibase
command: [/usr/local/bin/wait-for-it.sh]
links:
- "drs-liquibase"
drs-liquibase:
container_name: drs-liquibase
build:
context: ./drs-liquibase
environment:
DRS_CLIENT_VERSION : ${DRS_LIQUIBASE_VERSION}
depends_on:
- db
links:
- "db"
command: ["/usr/local/bin/wait_for_liquibase.sh"]