La inn script for start og stopp av MinAttest i development.

This commit is contained in:
steinhelge
2025-11-22 12:17:48 +01:00
parent 158bd873e2
commit 21107773db
5 changed files with 236 additions and 0 deletions
Executable
+72
View File
@@ -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)"