nakama/start.sh

55 lines
1.4 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Nakama - Скрипт быстрого запуска
echo "🚀 Запуск Nakama..."
# Проверка MongoDB
if ! pgrep -x "mongod" > /dev/null; then
echo "⚠️ MongoDB не запущена, пытаюсь запустить..."
# Для macOS
if [[ "$OSTYPE" == "darwin"* ]]; then
brew services start mongodb-community
# Для Linux
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo systemctl start mongod
fi
sleep 2
fi
# Проверка .env файла
if [ ! -f .env ]; then
echo "⚠️ Файл .env не найден, создаю из примера..."
cp .env.example .env
echo "❗ Не забудьте настроить .env файл!"
fi
# Проверка frontend/.env файла
if [ ! -f frontend/.env ]; then
echo "⚠️ Файл frontend/.env не найден, создаю из примера..."
cp frontend/.env.example frontend/.env
fi
# Проверка node_modules
if [ ! -d node_modules ]; then
echo "📦 Установка зависимостей backend..."
npm install
fi
if [ ! -d frontend/node_modules ]; then
echo "📦 Установка зависимостей frontend..."
cd frontend && npm install && cd ..
fi
echo "✅ Всё готово!"
echo ""
echo "Запускаю приложение..."
echo "Backend: http://localhost:3000"
echo "Frontend: http://localhost:5173"
echo ""
npm run dev