- Created pnpm workspace configuration to manage packages. - Added a placeholder .gitkeep file in the scripts directory. - Implemented a smoke test script to validate core API and web endpoints. - Established TypeScript base configuration for consistent compilation settings. - Introduced Turbo configuration for task management and build processes.
36 lines
834 B
Bash
36 lines
834 B
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
# Known limitation: Multi-process under a single shell entrypoint means if one
|
|
# process crashes, the container may remain partially alive. Production-grade
|
|
# process supervision is a future concern, not a scaffold blocker.
|
|
|
|
cleanup() {
|
|
echo "Shutting down..."
|
|
kill "$NGINX_PID" "$API_PID" "$WEB_PID" 2>/dev/null || true
|
|
wait "$NGINX_PID" "$API_PID" "$WEB_PID" 2>/dev/null || true
|
|
exit 0
|
|
}
|
|
|
|
trap cleanup SIGTERM SIGINT
|
|
|
|
# Start nginx
|
|
nginx -g 'daemon off;' &
|
|
NGINX_PID=$!
|
|
|
|
# Run Prisma migrations
|
|
cd /app/packages/api
|
|
npx prisma migrate deploy
|
|
|
|
# Start NestJS API
|
|
PORT=3001 node dist/main.js &
|
|
API_PID=$!
|
|
|
|
# Start Next.js standalone
|
|
cd /app/packages/web/standalone
|
|
PORT=3000 HOSTNAME=0.0.0.0 node packages/web/server.js &
|
|
WEB_PID=$!
|
|
|
|
# Wait for any process to exit
|
|
wait -n "$NGINX_PID" "$API_PID" "$WEB_PID"
|