Compare commits

6 Commits

Author SHA1 Message Date
steinhelge 21107773db La inn script for start og stopp av MinAttest i development. 2025-11-22 12:17:48 +01:00
steinhelge 158bd873e2 Endret 9.0.9 til 9.0.11 i build.yml for å oppdatere .NET SDK-versjonen. 2025-11-17 21:27:01 +01:00
steinhelge ffa48d5370 Byggeløype for main og dev i samme fil 2025-11-17 21:25:39 +01:00
steinhelge 240d93ace1 Update .gitea/workflows/build.yml
Build & Push MinAttest / build-and-push (push) Failing after 3m49s
2025-11-17 19:31:47 +00:00
steinhelge 693e906ab7 Merge branch 'main' of https://gitea.theriise.net/steinhelge/minattest
Build & Push MinAttest / build-and-push (push) Has been cancelled
2025-11-17 20:23:39 +01:00
steinhelge a06c329e97 Trigger CI after runner is online 2025-11-17 20:22:27 +01:00
16 changed files with 270 additions and 24 deletions
+31
View File
@@ -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`.
+22 -13
View File
@@ -4,10 +4,19 @@ on:
push: push:
branches: branches:
- main - main
- develop
- dev
jobs: jobs:
build-and-push: build-and-push:
runs-on: docker # matcher labelen på runneren din runs-on: self-hosted
env:
# Denne gir f.eks:
# main → latest
# develop → dev
# dev → dev
TAG: ${{ github.ref_name == 'main' && 'latest' || 'dev' }}
steps: steps:
- name: Checkout - name: Checkout
@@ -18,37 +27,37 @@ jobs:
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.theriise.net -u steinhelge --password-stdin echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.theriise.net -u steinhelge --password-stdin
# ---------- Frontend ---------- # ---------- Frontend ----------
- name: Build Frontend - name: Build Frontend (${{ env.TAG }})
run: | run: |
docker build \ docker build \
-t gitea.theriise.net/steinhelge/minattest-frontend:latest \ -t gitea.theriise.net/steinhelge/minattest-frontend:${TAG} \
-f frontend/minattest-app/Dockerfile \ -f frontend/minattest-app/Dockerfile \
frontend/minattest-app frontend/minattest-app
- name: Push Frontend - name: Push Frontend (${{ env.TAG }})
run: | run: |
docker push gitea.theriise.net/steinhelge/minattest-frontend:latest docker push gitea.theriise.net/steinhelge/minattest-frontend:${TAG}
# ---------- Backend API ---------- # ---------- Backend API ----------
- name: Build API - name: Build API (${{ env.TAG }})
run: | run: |
docker build \ docker build \
-t gitea.theriise.net/steinhelge/minattest-api:latest \ -t gitea.theriise.net/steinhelge/minattest-api:${TAG} \
-f backend/Dockerfile \ -f backend/Dockerfile \
backend backend
- name: Push API - name: Push API (${{ env.TAG }})
run: | run: |
docker push gitea.theriise.net/steinhelge/minattest-api:latest docker push gitea.theriise.net/steinhelge/minattest-api:${TAG}
# ---------- App Host / BFF ---------- # ---------- App Host / BFF ----------
- name: Build App Host - name: Build App Host (${{ env.TAG }})
run: | run: |
docker build \ docker build \
-t gitea.theriise.net/steinhelge/minattest-app-host:latest \ -t gitea.theriise.net/steinhelge/minattest-app-host:${TAG} \
-f frontend/minattest-app-host/Dockerfile \ -f frontend/minattest-app-host/Dockerfile \
frontend/minattest-app-host frontend/minattest-app-host
- name: Push App Host - name: Push App Host (${{ env.TAG }})
run: | run: |
docker push gitea.theriise.net/steinhelge/minattest-app-host:latest docker push gitea.theriise.net/steinhelge/minattest-app-host:${TAG}
+1
View File
@@ -0,0 +1 @@
# ci ping ma. 17. nov. 20:22:27 +0100 2025
+1 -1
View File
@@ -3,7 +3,7 @@
"isRoot": true, "isRoot": true,
"tools": { "tools": {
"dotnet-ef": { "dotnet-ef": {
"version": "9.0.9", "version": "9.0.11",
"commands": [ "commands": [
"dotnet-ef" "dotnet-ef"
], ],
@@ -8,7 +8,7 @@
<PackageReference Include="MediatR" Version="12.*" /> <PackageReference Include="MediatR" Version="12.*" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.*" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.*" />
<PackageReference Include="FluentValidation" Version="12.*" /> <PackageReference Include="FluentValidation" Version="12.*" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.9" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.11" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\MinAttest.Domain\MinAttest.Domain.csproj" /> <ProjectReference Include="..\MinAttest.Domain\MinAttest.Domain.csproj" />
@@ -20,7 +20,7 @@ namespace MinAttest.Infrastructure.Data.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "9.0.9") .HasAnnotation("ProductVersion", "9.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
@@ -20,7 +20,7 @@ namespace MinAttest.Infrastructure.Data.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "9.0.9") .HasAnnotation("ProductVersion", "9.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
@@ -20,7 +20,7 @@ namespace MinAttest.Infrastructure.Data.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "9.0.9") .HasAnnotation("ProductVersion", "9.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
@@ -20,7 +20,7 @@ namespace MinAttest.Infrastructure.Data.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "9.0.9") .HasAnnotation("ProductVersion", "9.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
@@ -20,7 +20,7 @@ namespace MinAttest.Infrastructure.Data.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "9.0.9") .HasAnnotation("ProductVersion", "9.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
@@ -17,7 +17,7 @@ namespace MinAttest.Infrastructure.Data.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "9.0.9") .HasAnnotation("ProductVersion", "9.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
@@ -12,9 +12,9 @@
<PackageReference Include="xunit.runner.visualstudio" Version="2.*" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.*" />
<PackageReference Include="FluentAssertions" Version="8.*" /> <PackageReference Include="FluentAssertions" Version="8.*" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.*" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.*" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.9" /> <PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.11" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.9" /> <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.11" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="9.0.9" /> <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="9.0.11" />
<PackageReference Include="Azure.Core" Version="1.48.0" /> <PackageReference Include="Azure.Core" Version="1.48.0" />
<PackageReference Include="Testcontainers" Version="4.*" /> <PackageReference Include="Testcontainers" Version="4.*" />
<PackageReference Include="Testcontainers.MsSql" Version="4.*" /> <PackageReference Include="Testcontainers.MsSql" Version="4.*" />
+53
View File
@@ -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
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)"
+39
View File
@@ -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
View File
@@ -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}"