127 lines
3.6 KiB
Batchfile
127 lines
3.6 KiB
Batchfile
@echo off
|
|
REM SerpentRace Development Environment Setup and Management Script for Windows
|
|
|
|
setlocal EnableDelayedExpansion
|
|
|
|
REM Check if Docker and Docker Compose are installed
|
|
where docker >nul 2>nul
|
|
if %errorlevel% neq 0 (
|
|
echo [ERROR] Docker is not installed. Please install Docker first.
|
|
exit /b 1
|
|
)
|
|
|
|
where docker-compose >nul 2>nul
|
|
if %errorlevel% neq 0 (
|
|
echo [ERROR] Docker Compose is not installed. Please install Docker Compose first.
|
|
exit /b 1
|
|
)
|
|
|
|
if "%1"=="dev:start" goto dev_start
|
|
if "%1"=="dev:watch" goto dev_watch
|
|
if "%1"=="dev:stop" goto dev_stop
|
|
if "%1"=="prod:start" goto prod_start
|
|
if "%1"=="prod:stop" goto prod_stop
|
|
if "%1"=="logs" goto show_logs
|
|
if "%1"=="cleanup" goto cleanup
|
|
goto show_help
|
|
|
|
:dev_start
|
|
echo [INFO] Starting SerpentRace development environment...
|
|
cd SerpentRace_Docker
|
|
docker-compose -f docker-compose.dev.yml --env-file .env.dev up --build -d
|
|
cd ..
|
|
echo [INFO] Development environment started successfully!
|
|
echo [INFO] Services available at:
|
|
echo - Frontend: http://localhost:5173
|
|
echo - Backend API: http://localhost:3000
|
|
echo - PostgreSQL: localhost:5432
|
|
echo - Redis: localhost:6379
|
|
echo - MinIO: http://localhost:9001 (admin: serpentrace / serpentrace123!)
|
|
echo - PgAdmin: http://localhost:8080 (admin@serpentrace.dev / admin)
|
|
echo - Redis Commander: http://localhost:8081
|
|
goto end
|
|
|
|
:dev_watch
|
|
echo [INFO] Starting SerpentRace development environment with file watchers...
|
|
echo [INFO] This will automatically sync file changes and rebuild containers as needed
|
|
cd SerpentRace_Docker
|
|
docker-compose -f docker-compose.watch.yml --env-file .env.dev up --build --watch
|
|
cd ..
|
|
goto end
|
|
|
|
:dev_stop
|
|
echo [INFO] Stopping SerpentRace development environment...
|
|
cd SerpentRace_Docker
|
|
docker-compose -f docker-compose.dev.yml down
|
|
cd ..
|
|
echo [INFO] Development environment stopped.
|
|
goto end
|
|
|
|
:prod_start
|
|
echo [WARNING] Starting SerpentRace production environment...
|
|
echo [WARNING] Make sure to update .env.prod with secure values!
|
|
cd SerpentRace_Docker
|
|
docker-compose -f docker-compose.prod.yml --env-file .env.prod up --build -d
|
|
cd ..
|
|
echo [INFO] Production environment started!
|
|
echo [INFO] Services available at:
|
|
echo - Frontend: http://localhost
|
|
echo - Backend API: http://localhost:3000
|
|
goto end
|
|
|
|
:prod_stop
|
|
echo [INFO] Stopping SerpentRace production environment...
|
|
cd SerpentRace_Docker
|
|
docker-compose -f docker-compose.prod.yml down
|
|
cd ..
|
|
echo [INFO] Production environment stopped.
|
|
goto end
|
|
|
|
:show_logs
|
|
if "%2"=="" (
|
|
echo [INFO] Showing logs for all services...
|
|
cd SerpentRace_Docker
|
|
docker-compose -f docker-compose.dev.yml logs -f
|
|
cd ..
|
|
) else (
|
|
echo [INFO] Showing logs for %2...
|
|
cd SerpentRace_Docker
|
|
docker-compose -f docker-compose.dev.yml logs -f %2
|
|
cd ..
|
|
)
|
|
goto end
|
|
|
|
:cleanup
|
|
echo [WARNING] Cleaning up Docker resources...
|
|
cd SerpentRace_Docker
|
|
docker-compose -f docker-compose.dev.yml down -v
|
|
docker-compose -f docker-compose.prod.yml down -v
|
|
cd ..
|
|
docker system prune -f
|
|
echo [INFO] Cleanup completed.
|
|
goto end
|
|
|
|
:show_help
|
|
echo SerpentRace Docker Management Script
|
|
echo.
|
|
echo Usage: %0 [COMMAND]
|
|
echo.
|
|
echo Commands:
|
|
echo dev:start Start development environment with hot reload
|
|
echo dev:watch Start development environment with file watchers (auto-rebuild)
|
|
echo dev:stop Stop development environment
|
|
echo prod:start Start production environment
|
|
echo prod:stop Stop production environment
|
|
echo logs [service] Show logs (optionally for specific service)
|
|
echo cleanup Clean up all Docker resources
|
|
echo help Show this help message
|
|
echo.
|
|
echo Examples:
|
|
echo %0 dev:start
|
|
echo %0 dev:watch
|
|
echo %0 logs backend
|
|
echo %0 cleanup
|
|
goto end
|
|
|
|
:end
|