Spaces:
Running
Running
# Start Nginx | |
echo "Starting Nginx..." | |
service nginx start | |
# Start the Node.js server in the background | |
echo "Starting Node.js server..." | |
node myNodeServer.js --port 1689 --host 0.0.0.0 & echo $! > node_server.pid | |
# Start the main application with yarn in the background | |
echo "Starting Yarn..." | |
yarn | |
echo "Starting Yarn service..." | |
yarn start -u -rb -R blocks & echo $! > yarn_service.pid | |
# The script waits here for the yarn start process to terminate | |
echo "Waiting for Yarn to terminate..." | |
wait $(cat yarn_service.pid) | |
# Cleanup: terminate and clean up background services | |
echo "Cleaning up..." | |
pkill -F node_server.pid | |
echo "killing .pid files..." | |
rm node_server.pid yarn_service.pid | |