Checking a different way
This commit is contained in:
parent
e6d444c4af
commit
8de7fc675b
|
|
@ -32,20 +32,13 @@ ssh $SERVER \
|
||||||
cd /home/cmc/$WORK_DIR
|
cd /home/cmc/$WORK_DIR
|
||||||
echo "Running migrations in $WORK_DIR..."
|
echo "Running migrations in $WORK_DIR..."
|
||||||
|
|
||||||
# Wait for Go service to be ready
|
# Check if Go service is running
|
||||||
echo "Waiting for Go service to be ready..."
|
if ! docker ps --filter "name=$GO_SERVICE" --filter "status=running" --format "{{.Names}}" | grep -q "$GO_SERVICE"; then
|
||||||
for i in {1..30}; do
|
echo "ERROR: Go service ($GO_SERVICE) is not running."
|
||||||
if docker compose $ENV_FILE -f "$COMPOSE_FILE" exec -T "$GO_SERVICE" test -f /app/go.mod 2>/dev/null; then
|
exit 1
|
||||||
echo "Go service is ready."
|
fi
|
||||||
break
|
|
||||||
fi
|
|
||||||
if [ $i -eq 30 ]; then
|
|
||||||
echo "ERROR: Go service is not running or not ready."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
|
|
||||||
|
echo "Go service is running. Executing migrations..."
|
||||||
docker compose $ENV_FILE -f "$COMPOSE_FILE" exec -T "$GO_SERVICE" sh -c "cd /app && make migrate"
|
docker compose $ENV_FILE -f "$COMPOSE_FILE" exec -T "$GO_SERVICE" sh -c "cd /app && make migrate"
|
||||||
echo "Migrations completed successfully."
|
echo "Migrations completed successfully."
|
||||||
ENDSSH
|
ENDSSH
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue