diff options
| author | xuatz <xzlow10@gmail.com> | 2025-09-14 19:41:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-14 18:41:45 +0100 |
| commit | 6ba61b46154e076fca47d3841b158105dbeeef80 (patch) | |
| tree | 172a8f8523117b3860e04c1bec277c558f73d16c /start-dev.sh | |
| parent | 7671f4ff7ac5b106c3faa6b59a01f154cb34be99 (diff) | |
| download | karakeep-6ba61b46154e076fca47d3841b158105dbeeef80.tar.zst | |
fix(dev): worker not started properly in helper start script (#1946)
* fix(dev): worker not started causing incomplete migration
* apply pr comments
Diffstat (limited to 'start-dev.sh')
| -rwxr-xr-x | start-dev.sh | 31 |
1 files changed, 17 insertions, 14 deletions
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 |
