forked from noxious/server
24 lines
577 B
Bash
24 lines
577 B
Bash
#!/bin/sh
|
|
|
|
# Start Redis in the background
|
|
redis-server --daemonize yes
|
|
|
|
# Start MySQL
|
|
mysqld --user=mysql --datadir=/var/lib/mysql &
|
|
|
|
# Wait for MySQL to be ready
|
|
while ! mysqladmin ping -h localhost --silent; do
|
|
echo "Waiting for MySQL to be ready..."
|
|
sleep 2
|
|
done
|
|
echo "MySQL is ready!"
|
|
|
|
# Run database migrations
|
|
npx mikro-orm migration:up
|
|
|
|
# Start the Node.js application in a tmux session
|
|
tmux new-session -d -s nodeapp "node src/server.js"
|
|
echo "App is running in tmux session. Attach with: tmux attach-session -t nodeapp"
|
|
|
|
# Keep container running
|
|
tail -f /dev/null |