From 6ba61b46154e076fca47d3841b158105dbeeef80 Mon Sep 17 00:00:00 2001 From: xuatz Date: Sun, 14 Sep 2025 19:41:45 +0200 Subject: fix(dev): worker not started properly in helper start script (#1946) * fix(dev): worker not started causing incomplete migration * apply pr comments --- start-dev.sh | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'start-dev.sh') diff --git a/start-dev.sh b/start-dev.sh index 0f5f9d2e..52f5a6d8 100755 --- a/start-dev.sh +++ b/start-dev.sh @@ -33,7 +33,7 @@ fi # Start Chrome if not already running if ! port_in_use 9222; then echo "Starting headless Chrome..." - docker run -d -p 9222:9222 --name karakeep-chrome gcr.io/zenika-hub/alpine-chrome:123 \ + docker run -d -p 9222:9222 --name karakeep-chrome gcr.io/zenika-hub/alpine-chrome:124 \ --no-sandbox \ --disable-gpu \ --disable-dev-shm-usage \ @@ -61,22 +61,11 @@ if [ -n "$DATA_DIR" ] && [ ! -d "$DATA_DIR" ]; then mkdir -p "$DATA_DIR" fi -# Start the web app -echo "Starting web app..." -pnpm web & WEB_PID=$! - -# Wait for web app to be ready -echo "Waiting for web app to start..." -until curl -s http://localhost:3000 > /dev/null 2>&1; do - sleep 1 -done - -# Run database migrations echo "Running database migrations..." pnpm run db:migrate -# Start workers -echo "Starting workers..." +echo "Starting web app and workers..." +pnpm web & WEB_PID=$! pnpm workers & WORKERS_PID=$! # Function to handle script termination @@ -88,6 +77,20 @@ cleanup() { exit 0 } +# Wait for web app to be ready (max 30 seconds) +echo "Waiting for web app to start..." +ATTEMPT=0 +while [ $ATTEMPT -lt 30 ]; do + if nc -z localhost 3000 2>/dev/null; then + break + fi + sleep 1 + ATTEMPT=$((ATTEMPT + 1)) + if [ $ATTEMPT -eq 30 ]; then + echo "Warning: Web app may not have started properly after 30 seconds" + fi +done + # Set up trap to catch termination signals trap cleanup SIGINT SIGTERM -- cgit v1.2.3-70-g09d2