fix: Update start-dev.sh to use correct paths and better verification
Some checks failed
ParentFlow CI/CD Pipeline / Backend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Frontend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Security Scanning (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-app/maternal-app-backend dockerfile:Dockerfile.production name:backend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-web dockerfile:Dockerfile.production name:frontend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Development (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled
Some checks failed
ParentFlow CI/CD Pipeline / Backend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Frontend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Security Scanning (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-app/maternal-app-backend dockerfile:Dockerfile.production name:backend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-web dockerfile:Dockerfile.production name:frontend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Development (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled
- Use node_modules/next/dist/bin/next instead of npx for frontend and admin - Backend uses npm run start:dev directly (no HOST/PORT env vars needed) - Increase verification wait time to 30 seconds - Check actual port listening status with ss command instead of just PID - Provide better error messages with log file paths
This commit is contained in:
38
start-dev.sh
38
start-dev.sh
@@ -124,7 +124,7 @@ if [ ! -d "node_modules" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Start backend in background
|
# Start backend in background
|
||||||
HOST=0.0.0.0 PORT=3020 API_PORT=3020 npm run start:dev > /tmp/backend-dev.log 2>&1 &
|
npm run start:dev > /tmp/backend-dev.log 2>&1 &
|
||||||
BACKEND_PID=$!
|
BACKEND_PID=$!
|
||||||
echo $BACKEND_PID > /tmp/backend-dev.pid
|
echo $BACKEND_PID > /tmp/backend-dev.pid
|
||||||
success "Backend API started (PID: $BACKEND_PID)"
|
success "Backend API started (PID: $BACKEND_PID)"
|
||||||
@@ -152,8 +152,8 @@ EOF
|
|||||||
log "Created .env.local for frontend"
|
log "Created .env.local for frontend"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start frontend in background (override the port in package.json)
|
# Start frontend in background using full path to next
|
||||||
npx next dev -p 3030 -H 0.0.0.0 > /tmp/frontend-dev.log 2>&1 &
|
node_modules/next/dist/bin/next dev -p 3030 -H 0.0.0.0 > /tmp/frontend-dev.log 2>&1 &
|
||||||
FRONTEND_PID=$!
|
FRONTEND_PID=$!
|
||||||
echo $FRONTEND_PID > /tmp/frontend-dev.pid
|
echo $FRONTEND_PID > /tmp/frontend-dev.pid
|
||||||
success "Frontend started (PID: $FRONTEND_PID)"
|
success "Frontend started (PID: $FRONTEND_PID)"
|
||||||
@@ -179,8 +179,8 @@ EOF
|
|||||||
log "Created .env.local for admin dashboard"
|
log "Created .env.local for admin dashboard"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start admin dashboard in background (use npx to ensure correct port)
|
# Start admin dashboard in background using full path to next
|
||||||
npx next dev -p 3335 -H 0.0.0.0 > /tmp/admin-dev.log 2>&1 &
|
node_modules/next/dist/bin/next dev -p 3335 -H 0.0.0.0 > /tmp/admin-dev.log 2>&1 &
|
||||||
ADMIN_PID=$!
|
ADMIN_PID=$!
|
||||||
echo $ADMIN_PID > /tmp/admin-dev.pid
|
echo $ADMIN_PID > /tmp/admin-dev.pid
|
||||||
success "Admin Dashboard started (PID: $ADMIN_PID)"
|
success "Admin Dashboard started (PID: $ADMIN_PID)"
|
||||||
@@ -188,25 +188,33 @@ log "Admin accessible at: http://pfadmin.noru1.ro (0.0.0.0:3335)"
|
|||||||
|
|
||||||
# Step 4: Verify all services are running
|
# Step 4: Verify all services are running
|
||||||
log "${CYAN}Step 4: Verifying services...${NC}"
|
log "${CYAN}Step 4: Verifying services...${NC}"
|
||||||
sleep 5
|
log "Waiting 30 seconds for services to start..."
|
||||||
|
sleep 30
|
||||||
|
|
||||||
verify_service() {
|
verify_service() {
|
||||||
local SERVICE=$1
|
local SERVICE=$1
|
||||||
local PORT=$2
|
local PORT=$2
|
||||||
local PID_FILE=$3
|
local PID_FILE=$3
|
||||||
|
|
||||||
if [ -f "$PID_FILE" ]; then
|
# Check if port is listening
|
||||||
PID=$(cat $PID_FILE)
|
if ss -tulpn | grep -q ":$PORT.*LISTEN"; then
|
||||||
if kill -0 $PID 2>/dev/null; then
|
success "$SERVICE is listening on port $PORT"
|
||||||
success "$SERVICE is running (PID: $PID)"
|
return 0
|
||||||
return 0
|
else
|
||||||
|
# Check if process is still starting
|
||||||
|
if [ -f "$PID_FILE" ]; then
|
||||||
|
PID=$(cat $PID_FILE)
|
||||||
|
if kill -0 $PID 2>/dev/null; then
|
||||||
|
warning "$SERVICE is running (PID: $PID) but not yet listening on port $PORT"
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
error "$SERVICE process (PID: $PID) died. Check logs: tail -50 /tmp/${SERVICE,,}-dev.log"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
warning "$SERVICE process died"
|
warning "$SERVICE PID file not found"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
warning "$SERVICE PID file not found"
|
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user