Compare commits
2 Commits
2fef8bf255
..
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 36b7a05ce0 | |||
| 21107773db |
@@ -0,0 +1,31 @@
|
||||
---
|
||||
description: Start the MinAttest project (Backend + Frontend)
|
||||
---
|
||||
|
||||
# Start MinAttest
|
||||
|
||||
This workflow starts the backend (with database) and the frontend.
|
||||
|
||||
## 1. Start Backend (API + Database)
|
||||
The backend uses .NET Aspire to orchestrate the API and the PostgreSQL container.
|
||||
|
||||
```bash
|
||||
// turbo
|
||||
dotnet run --project backend/MinAttest.AppHost/MinAttest.AppHost.csproj
|
||||
```
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Check the console output for the API URL (e.g., `https://localhost:7172` or similar).
|
||||
> You may need to update `frontend/minattest-app/vite.config.ts` if the port doesn't match `10001`.
|
||||
|
||||
## 2. Start Frontend
|
||||
Open a new terminal for the frontend.
|
||||
|
||||
```bash
|
||||
cd frontend/minattest-app
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> The frontend will be available at `http://localhost:5173`.
|
||||
@@ -0,0 +1,53 @@
|
||||
# Start MinAttest Development Environment (Windows)
|
||||
|
||||
Write-Host "🚀 Starting MinAttest Development Environment..." -ForegroundColor Cyan
|
||||
|
||||
# Function to check if a port is in use
|
||||
function Test-PortInUse {
|
||||
param (
|
||||
[int]$Port
|
||||
)
|
||||
$tcpConnection = Get-NetTCPConnection -LocalPort $Port -ErrorAction SilentlyContinue
|
||||
return $tcpConnection -ne $null
|
||||
}
|
||||
|
||||
# 1. Start Backend (Aspire AppHost) - Port 7172
|
||||
if (Test-PortInUse -Port 7172) {
|
||||
Write-Host "✅ Backend (API) is already running on port 7172." -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "🚀 Starting Backend (Aspire AppHost)..." -ForegroundColor Yellow
|
||||
Start-Process -FilePath "dotnet" -ArgumentList "run --project backend/MinAttest.AppHost/MinAttest.AppHost.csproj" -NoNewWindow
|
||||
|
||||
# Wait loop (simple pause as checking port immediately might be flaky during startup)
|
||||
Start-Sleep -Seconds 5
|
||||
}
|
||||
|
||||
# 2. Start BFF (Reverse Proxy) - Port 10001
|
||||
if (Test-PortInUse -Port 10001) {
|
||||
Write-Host "✅ BFF is already running on port 10001." -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "🚀 Starting BFF..." -ForegroundColor Yellow
|
||||
Start-Process -FilePath "dotnet" -ArgumentList "run --project frontend/minattest-app-host/minattest-app-host.csproj" -NoNewWindow
|
||||
Start-Sleep -Seconds 2
|
||||
}
|
||||
|
||||
# 3. Start Frontend (Vite) - Port 5173
|
||||
if (Test-PortInUse -Port 5173) {
|
||||
Write-Host "✅ Frontend is already running on port 5173." -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "🚀 Starting Frontend..." -ForegroundColor Yellow
|
||||
Set-Location "frontend/minattest-app"
|
||||
|
||||
if (-not (Test-Path "node_modules")) {
|
||||
Write-Host "📦 Installing dependencies..." -ForegroundColor Yellow
|
||||
Start-Process -FilePath "npm" -ArgumentList "install" -NoNewWindow -Wait
|
||||
}
|
||||
|
||||
Start-Process -FilePath "npm" -ArgumentList "run dev" -NoNewWindow
|
||||
Set-Location "../.."
|
||||
}
|
||||
|
||||
Write-Host "✨ All services are starting up!" -ForegroundColor Cyan
|
||||
Write-Host " - Backend API: https://localhost:7172"
|
||||
Write-Host " - BFF: https://localhost:10001"
|
||||
Write-Host " - Frontend: http://localhost:5173"
|
||||
Executable
+72
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo -e "${BLUE}🚀 Starting MinAttest Development Environment...${NC}"
|
||||
|
||||
# Function to check if a port is in use
|
||||
is_port_in_use() {
|
||||
lsof -i :$1 -sTCP:LISTEN >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# 1. Start Backend (Aspire AppHost) - Port 7172 (API)
|
||||
# Note: AppHost also starts Postgres
|
||||
if is_port_in_use 7172; then
|
||||
echo -e "${GREEN}✅ Backend (API) is already running on port 7172.${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}🚀 Starting Backend (Aspire AppHost)...${NC}"
|
||||
dotnet run --project backend/MinAttest.AppHost/MinAttest.AppHost.csproj > backend.log 2>&1 &
|
||||
BACKEND_PID=$!
|
||||
echo " Started with PID $BACKEND_PID. Logs: backend.log"
|
||||
|
||||
# Wait for port to be ready (optional, but good for ordering)
|
||||
echo " Waiting for API to be ready on port 7172..."
|
||||
while ! is_port_in_use 7172; do
|
||||
sleep 1
|
||||
done
|
||||
echo -e "${GREEN} Backend is ready!${NC}"
|
||||
fi
|
||||
|
||||
# 2. Start BFF (Reverse Proxy) - Port 10001
|
||||
if is_port_in_use 10001; then
|
||||
echo -e "${GREEN}✅ BFF is already running on port 10001.${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}🚀 Starting BFF...${NC}"
|
||||
dotnet run --project frontend/minattest-app-host/minattest-app-host.csproj > bff.log 2>&1 &
|
||||
BFF_PID=$!
|
||||
echo " Started with PID $BFF_PID. Logs: bff.log"
|
||||
|
||||
echo " Waiting for BFF to be ready on port 10001..."
|
||||
while ! is_port_in_use 10001; do
|
||||
sleep 1
|
||||
done
|
||||
echo -e "${GREEN} BFF is ready!${NC}"
|
||||
fi
|
||||
|
||||
# 3. Start Frontend (Vite) - Port 5173
|
||||
if is_port_in_use 5173; then
|
||||
echo -e "${GREEN}✅ Frontend is already running on port 5173.${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}🚀 Starting Frontend...${NC}"
|
||||
cd frontend/minattest-app
|
||||
|
||||
if [ ! -d "node_modules" ]; then
|
||||
echo -e "${YELLOW}📦 Installing dependencies...${NC}"
|
||||
npm install
|
||||
fi
|
||||
|
||||
npm run dev > ../../frontend.log 2>&1 &
|
||||
FRONTEND_PID=$!
|
||||
cd ../..
|
||||
echo " Started with PID $FRONTEND_PID. Logs: frontend.log"
|
||||
fi
|
||||
|
||||
echo -e "${BLUE}✨ All services are up and running!${NC}"
|
||||
echo -e " - Backend API: https://localhost:7172"
|
||||
echo -e " - BFF: https://localhost:10001"
|
||||
echo -e " - Frontend: http://localhost:5173"
|
||||
echo -e " - Aspire Dash: (Check backend.log for port)"
|
||||
@@ -0,0 +1,39 @@
|
||||
# Stop MinAttest Development Environment (Windows)
|
||||
|
||||
Write-Host "🛑 Stopping MinAttest Development Environment..." -ForegroundColor Red
|
||||
|
||||
# Function to kill process on a port
|
||||
function Stop-PortProcess {
|
||||
param (
|
||||
[int]$Port,
|
||||
[string]$Name
|
||||
)
|
||||
$tcpConnection = Get-NetTCPConnection -LocalPort $Port -ErrorAction SilentlyContinue
|
||||
|
||||
if ($tcpConnection) {
|
||||
$pid = $tcpConnection.OwningProcess
|
||||
Write-Host " Killing $Name (Port $Port, PID $pid)..." -ForegroundColor Yellow
|
||||
Stop-Process -Id $pid -Force -ErrorAction SilentlyContinue
|
||||
Write-Host " $Name stopped." -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " $Name is not running (Port $Port free)."
|
||||
}
|
||||
}
|
||||
|
||||
# 1. Stop Backend (API) - Port 7172
|
||||
Stop-PortProcess -Port 7172 -Name "Backend (API)"
|
||||
|
||||
# 2. Stop BFF - Port 10001
|
||||
Stop-PortProcess -Port 10001 -Name "BFF"
|
||||
|
||||
# 3. Stop Frontend - Port 5173
|
||||
Stop-PortProcess -Port 5173 -Name "Frontend"
|
||||
|
||||
# 4. Stop Aspire Dashboard & Resources (Cleanup)
|
||||
Write-Host " Cleaning up Aspire ports..." -ForegroundColor Yellow
|
||||
Stop-PortProcess -Port 17105 -Name "Aspire AppHost (HTTPS)"
|
||||
Stop-PortProcess -Port 15182 -Name "Aspire AppHost (HTTP)"
|
||||
Stop-PortProcess -Port 21157 -Name "Aspire Dashboard (OTLP)"
|
||||
Stop-PortProcess -Port 22256 -Name "Aspire Resource Service"
|
||||
|
||||
Write-Host "✨ All services stopped." -ForegroundColor Green
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
RED='\033[0;31m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo -e "${RED}🛑 Stopping MinAttest Development Environment...${NC}"
|
||||
|
||||
# Function to kill process on a port
|
||||
kill_port() {
|
||||
PORT=$1
|
||||
NAME=$2
|
||||
PID=$(lsof -ti:$PORT)
|
||||
if [ -n "$PID" ]; then
|
||||
echo -e "${YELLOW} Killing $NAME (Port $PORT, PID $PID)...${NC}"
|
||||
kill -9 $PID
|
||||
echo -e "${GREEN} $NAME stopped.${NC}"
|
||||
else
|
||||
echo -e " $NAME is not running (Port $PORT free)."
|
||||
fi
|
||||
}
|
||||
|
||||
# 1. Stop Backend (API) - Port 7172
|
||||
kill_port 7172 "Backend (API)"
|
||||
|
||||
# 2. Stop BFF - Port 10001
|
||||
kill_port 10001 "BFF"
|
||||
|
||||
# 3. Stop Frontend - Port 5173
|
||||
kill_port 5173 "Frontend"
|
||||
|
||||
# 4. Stop Aspire Dashboard & Resources (Cleanup)
|
||||
echo -e "${YELLOW} Cleaning up Aspire ports...${NC}"
|
||||
kill_port 17105 "Aspire AppHost (HTTPS)"
|
||||
kill_port 15182 "Aspire AppHost (HTTP)"
|
||||
kill_port 21157 "Aspire Dashboard (OTLP)"
|
||||
kill_port 22256 "Aspire Resource Service"
|
||||
|
||||
echo -e "${GREEN}✨ All services stopped.${NC}"
|
||||
Reference in New Issue
Block a user