Files
hr-portal/app/start.sh
T
2026-05-04 20:37:44 +00:00

29 lines
711 B
Bash

#!/bin/sh
# Create required directories
mkdir -p /run/nginx /data/db
# Start MongoDB
echo "Starting MongoDB..."
mongod --dbpath /data/db --logpath /var/log/mongod.log --fork --bind_ip 127.0.0.1
echo "Waiting for MongoDB to be ready..."
sleep 3
# Start backend (NestJS)
echo "Starting backend on port 3001..."
cd /app/backend && MONGODB_URI=mongodb://127.0.0.1:27017/hr_portal NODE_ENV=production node dist/main.js &
# Give backend a moment to start
sleep 3
# Start frontend (Next.js standalone)
echo "Starting frontend on port 3000..."
cd /app/frontend && PORT=3000 HOSTNAME=0.0.0.0 node server.js &
# Give frontend a moment to start
sleep 2
# Start nginx
echo "Starting nginx..."
nginx -g 'daemon off;'