Solving Error caused by DB upgrade before connection with Docker

고승우·2023년 9월 17일
0

Error while setting up test environment

Our team used a shell script to set up our test environment. Everyone except me didn't encounter any errors during the setup.

I investigated the issue and discovered something strange. When I executed same commands in script shell in the same order, the environment was successfully set without any errors.

I dedicated significant amount of time solving this. And I finally discovered some problem was in the shell script, with the assistance of coworker.

Problems

The issue was stemmed from attempting the upgrade before docker-compose up -d had completed. So I added 5-seccond sleep command before executing make upgrade. Finally it works!
While using sleep 5 provided temporary workaround by allowing docker-compose up -d more time to complete, it can't be sustainalbe solution. As our system grows or performance of laptop is insufficient to execute docker-compose up -d within 5 seconds, sleep 5 is ineffective in addressing problem.

Solution


I included dependency in redis to ensure DB connection and implemented health checks for postgres. Additionally I appended --await option in the setup shell script.

profile
٩( ᐛ )و 

0개의 댓글