Compare commits
13 Commits
f26cf6404e
...
v0.0.1-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| a354004201 | |||
| 942be59715 | |||
| 70e376c939 | |||
| 62a1ad83ab | |||
| 47c5a47ffa | |||
| 9bd6e1fc04 | |||
| 73600055fc | |||
| 80907a89a9 | |||
| 2472374157 | |||
| b72a10db94 | |||
| d097988dfd | |||
| cb9e8e1107 | |||
| 7bb7df788e |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -4,6 +4,9 @@ frontend/.tanstack/
|
|||||||
frontend/.output/
|
frontend/.output/
|
||||||
frontend/.nitro/
|
frontend/.nitro/
|
||||||
releases/
|
releases/
|
||||||
|
LstWrapper/bin
|
||||||
|
LstWrapper/publish
|
||||||
|
LstWrapper/obj
|
||||||
|
|
||||||
# ---> Go
|
# ---> Go
|
||||||
# If you prefer the allow list template instead of the deny list, see community template:
|
# If you prefer the allow list template instead of the deny list, see community template:
|
||||||
@@ -184,3 +187,5 @@ test-results/
|
|||||||
backend/go.sum
|
backend/go.sum
|
||||||
BUILD_NUMBER
|
BUILD_NUMBER
|
||||||
scripts/resetDanger.js
|
scripts/resetDanger.js
|
||||||
|
LstWrapper/Program_vite_as_Static.txt
|
||||||
|
scripts/stopPool.go
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [0.0.1-alpha.2](https://git.tuffraid.net/cowch/logistics_support_tool/compare/v0.0.1-alpha.1...v0.0.1-alpha.2) (2025-07-16)
|
||||||
|
|
||||||
## [0.0.3-alpha.22](https://git.tuffraid.net/cowch/logistics_support_tool/compare/v0.0.3-alpha.21...v0.0.3-alpha.22) (2025-07-12)
|
## [0.0.3-alpha.22](https://git.tuffraid.net/cowch/logistics_support_tool/compare/v0.0.3-alpha.21...v0.0.3-alpha.22) (2025-07-12)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|||||||
9
LstWrapper/LstWrapper.csproj
Normal file
9
LstWrapper/LstWrapper.csproj
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
85
LstWrapper/Program.cs
Normal file
85
LstWrapper/Program.cs
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using System.Net.Http;
|
||||||
|
|
||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
// to build the binary dotnet publish -c Release -o ./publish
|
||||||
|
// Go backend
|
||||||
|
builder.Services.AddHttpClient("GoBackend", client =>
|
||||||
|
{
|
||||||
|
client.BaseAddress = new Uri("http://localhost:8080");
|
||||||
|
client.Timeout = TimeSpan.FromSeconds(30);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Node frontend
|
||||||
|
builder.Services.AddHttpClient("NodeFrontend", client =>
|
||||||
|
{
|
||||||
|
client.BaseAddress = new Uri("http://localhost:3000");
|
||||||
|
client.Timeout = TimeSpan.FromSeconds(30);
|
||||||
|
});
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
|
app.UseStaticFiles();
|
||||||
|
|
||||||
|
app.Use((Func<HttpContext, Func<Task>, Task>)(async (context, next) =>
|
||||||
|
{
|
||||||
|
var clientFactory = context.RequestServices.GetRequiredService<IHttpClientFactory>();
|
||||||
|
|
||||||
|
var isApiRequest =
|
||||||
|
context.Request.Path.StartsWithSegments("/api") ||
|
||||||
|
context.Request.Path.StartsWithSegments("/graphql") ||
|
||||||
|
context.Request.Path.StartsWithSegments("/auth") ||
|
||||||
|
!context.Request.Method.Equals("GET", StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var client = clientFactory.CreateClient(isApiRequest ? "GoBackend" : "NodeFrontend");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var requestUri = context.Request.Path + context.Request.QueryString;
|
||||||
|
|
||||||
|
var request = new HttpRequestMessage(
|
||||||
|
new HttpMethod(context.Request.Method),
|
||||||
|
requestUri);
|
||||||
|
|
||||||
|
foreach (var header in context.Request.Headers)
|
||||||
|
{
|
||||||
|
if (!request.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray()))
|
||||||
|
{
|
||||||
|
request.Content ??= new StreamContent(context.Request.Body);
|
||||||
|
request.Content.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context.Request.ContentLength > 0 || context.Request.Headers.ContainsKey("Transfer-Encoding"))
|
||||||
|
{
|
||||||
|
request.Content = new StreamContent(context.Request.Body);
|
||||||
|
}
|
||||||
|
|
||||||
|
var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, context.RequestAborted);
|
||||||
|
|
||||||
|
context.Response.StatusCode = (int)response.StatusCode;
|
||||||
|
|
||||||
|
foreach (var header in response.Headers)
|
||||||
|
{
|
||||||
|
context.Response.Headers[header.Key] = header.Value.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var header in response.Content.Headers)
|
||||||
|
{
|
||||||
|
context.Response.Headers[header.Key] = header.Value.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
context.Response.Headers.Remove("transfer-encoding");
|
||||||
|
|
||||||
|
await response.Content.CopyToAsync(context.Response.Body);
|
||||||
|
}
|
||||||
|
catch (HttpRequestException ex)
|
||||||
|
{
|
||||||
|
context.Response.StatusCode = isApiRequest ? 503 : 502;
|
||||||
|
await context.Response.WriteAsync($"{(isApiRequest ? "Go API" : "Frontend")} unavailable: {ex.Message}");
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
app.Run();
|
||||||
23
LstWrapper/Properties/launchSettings.json
Normal file
23
LstWrapper/Properties/launchSettings.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||||
|
"profiles": {
|
||||||
|
"http": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"applicationUrl": "http://localhost:5015",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"https": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"applicationUrl": "https://localhost:7208;http://localhost:5015",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
LstWrapper/appsettings.Development.json
Normal file
8
LstWrapper/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
LstWrapper/appsettings.json
Normal file
9
LstWrapper/appsettings.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
||||||
15
LstWrapper/web.config
Normal file
15
LstWrapper/web.config
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<location path="." inheritInChildApplications="false">
|
||||||
|
<system.webServer>
|
||||||
|
<handlers>
|
||||||
|
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||||
|
</handlers>
|
||||||
|
<aspNetCore processPath="dotnet"
|
||||||
|
arguments=".\LstWrapper.dll"
|
||||||
|
stdoutLogEnabled="true"
|
||||||
|
stdoutLogFile=".\logs\stdout"
|
||||||
|
hostingModel="inprocess" />
|
||||||
|
</system.webServer>
|
||||||
|
</location>
|
||||||
|
</configuration>
|
||||||
6
LstWrapper/wwwroot/index.html
Normal file
6
LstWrapper/wwwroot/index.html
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<p>The new begining to lst</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -16,10 +16,14 @@ func main() {
|
|||||||
c.JSON(200, gin.H{"message": "pong"})
|
c.JSON(200, gin.H{"message": "pong"})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
r.Any("/api", errorApiLoc)
|
||||||
r.Any("/", errorLoc)
|
r.Any("/", errorLoc)
|
||||||
r.Run(":8080")
|
r.Run(":8080")
|
||||||
}
|
}
|
||||||
|
|
||||||
func errorLoc(c *gin.Context) {
|
func errorLoc(c *gin.Context) {
|
||||||
c.JSON(http.StatusOK, gin.H{"message": "welcome to lst system you might have just encountered an incorrect area of the app"})
|
c.JSON(http.StatusBadRequest, gin.H{"message": "welcome to lst system you might have just encountered an incorrect area of the app"})
|
||||||
|
}
|
||||||
|
func errorApiLoc(c *gin.Context) {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"message": "looks like you have encountered an api route that dose not exist"})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,16 +2,22 @@
|
|||||||
services:
|
services:
|
||||||
lst_backend:
|
lst_backend:
|
||||||
# build: . # Tell Docker Compose to build the image using the Dockerfile in the current directory
|
# build: . # Tell Docker Compose to build the image using the Dockerfile in the current directory
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./backend/Dockerfile
|
||||||
image: git.tuffraid.net/cowch/logistics_support_tool:backend-latest
|
image: git.tuffraid.net/cowch/logistics_support_tool:backend-latest
|
||||||
container_name: lst_backend # A friendly name for your running container
|
container_name: lst_backend # A friendly name for your running container
|
||||||
volumes:
|
volumes:
|
||||||
- /path/to/frontend/backend:/data
|
- /path/to/backend/data:/data
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
lst_frontend:
|
lst_frontend:
|
||||||
# build: . # Tell Docker Compose to build the image using the Dockerfile in the current directory
|
# build: . # Tell Docker Compose to build the image using the Dockerfile in the current directory
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./frontend/Dockerfile
|
||||||
image: git.tuffraid.net/cowch/logistics_support_tool:frontend-latest
|
image: git.tuffraid.net/cowch/logistics_support_tool:frontend-latest
|
||||||
container_name: lst_frontend # A friendly name for your running container
|
container_name: lst_frontend # A friendly name for your running container
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "logistics_support_tool",
|
"name": "logistics_support_tool",
|
||||||
"version": "0.0.3-alpha.22",
|
"version": "0.0.1-alpha.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "logistics_support_tool",
|
"name": "logistics_support_tool",
|
||||||
"version": "0.0.3-alpha.22",
|
"version": "0.0.1-alpha.2",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dotenv": "^17.2.0",
|
"dotenv": "^17.2.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "logistics_support_tool",
|
"name": "logistics_support_tool",
|
||||||
"version": "0.0.1-alpha.1",
|
"version": "0.0.1-alpha.2",
|
||||||
"description": "This is the new logisitcs support tool",
|
"description": "This is the new logisitcs support tool",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"docker": "powershell -File ./scripts/dockerBuild.ps1",
|
"docker": "powershell -File ./scripts/dockerBuild.ps1",
|
||||||
"release:createZip": "powershell -File ./scripts/release.ps1",
|
"release:createZip": "powershell -File ./scripts/release.ps1",
|
||||||
"release:gitea": "node ./scripts/create-gitea-release.js",
|
"release:gitea": "node ./scripts/create-gitea-release.js",
|
||||||
"release": "release-it --verbose --non-interactive --preRelease=alpha",
|
"release:publish": "release-it --verbose --non-interactive --preRelease=alpha",
|
||||||
"commit": "cz"
|
"commit": "cz"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ if (Test-Path $envFile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (-not $env:BUILD_NAME) {
|
if (-not $env:BUILD_NAME) {
|
||||||
Write-Warning "BUILD_NAME environment variable is not set. Cannot create BUILD_NUMBER file"
|
Write-Warning "BUILD_NAME environment variable is not set. Please make sure you have entered the correct info the env"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,11 +110,25 @@ function Update-BuildNumber {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Fronend build finished successfully."
|
Write-Host "Fronend build finished successfully."
|
||||||
|
Pop-Location
|
||||||
|
|
||||||
|
Write-Host "Building wrapper"
|
||||||
|
Push-Location $rootDir/LstWrapper
|
||||||
|
dotnet publish -c Release -o ./publish
|
||||||
|
|
||||||
Pop-Location
|
Pop-Location
|
||||||
Update-BuildNumber
|
Update-BuildNumber
|
||||||
|
|
||||||
Write-Host "Zipping up the release"
|
Write-Host "Zipping up the release"
|
||||||
npm run release:createZip
|
npm run release:createZip
|
||||||
|
|
||||||
|
$choice = Read-Host "Are we going to create a release? y/N"
|
||||||
|
|
||||||
|
if ($choice -eq "y" -or $choice -eq "Y") {
|
||||||
|
npm run release:gitea $version
|
||||||
|
npm run release:publish
|
||||||
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Write-Host "Building the docker images for front and backend"
|
Write-Host "Building the docker images for front and backend"
|
||||||
docker build -t logistics_support_tool:frontend-latest -f ../frontend/Dockerfile --no-cache ../frontend
|
docker build -t logistics_support_tool:frontend-latest -f ./frontend/Dockerfile --no-cache ./frontend
|
||||||
docker build -t logistics_support_tool:backend-latest -f ../backend/Dockerfile --no-cache ../backend
|
docker build -t logistics_support_tool:backend-latest -f ./backend/Dockerfile --no-cache ./backend
|
||||||
|
|
||||||
Write-Host "Tagging the builds with latest this is for testing test basically."
|
Write-Host "Tagging the builds with latest this is for testing test basically."
|
||||||
docker tag logistics_support_tool:frontend-latest git.tuffraid.net/cowch/logistics_support_tool:frontend-latest
|
docker tag logistics_support_tool:frontend-latest git.tuffraid.net/cowch/logistics_support_tool:frontend-latest
|
||||||
|
|||||||
46
scripts/iisControls.ps1
Normal file
46
scripts/iisControls.ps1
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
param (
|
||||||
|
[string]$ServerName,
|
||||||
|
[string]$AppPoolName,
|
||||||
|
[string]$StopOrStart
|
||||||
|
)
|
||||||
|
|
||||||
|
write-host $StopOrStart
|
||||||
|
if ($StopOrStart -eq "stop") {
|
||||||
|
Invoke-Command -ComputerName $ServerName -Credential $cred -ScriptBlock {
|
||||||
|
param($AppPoolName)
|
||||||
|
|
||||||
|
Import-Module WebAdministration
|
||||||
|
Write-Host "Stopping AppPool '$AppPoolName' on $($env:COMPUTERNAME)"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Stop-WebAppPool -Name $AppPoolName -ErrorAction Stop
|
||||||
|
|
||||||
|
Start-Sleep -Seconds 2
|
||||||
|
$state = (Get-WebAppPoolState -Name $AppPoolName).Value
|
||||||
|
Write-Host "Result: $state"
|
||||||
|
} catch {
|
||||||
|
Write-Error $_.Exception.Message
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
} -ArgumentList $AppPoolName
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($StopOrStart -eq "start"){
|
||||||
|
Invoke-Command -ComputerName $ServerName -Credential $cred -ScriptBlock {
|
||||||
|
param($AppPoolName)
|
||||||
|
|
||||||
|
Import-Module WebAdministration
|
||||||
|
Write-Host "Starting AppPool '$AppPoolName' on $($env:COMPUTERNAME)"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Start-WebAppPool -Name $AppPoolName
|
||||||
|
Start-Sleep -Seconds 2
|
||||||
|
$state = (Get-WebAppPoolState -Name $AppPoolName).Value
|
||||||
|
Write-Host "Result: $state"
|
||||||
|
} catch {
|
||||||
|
Write-Error $_.Exception.Message
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
} -ArgumentList $AppPoolName
|
||||||
|
}
|
||||||
|
|
||||||
@@ -66,17 +66,38 @@ if ($existingZips.Count -gt $keepReleases) {
|
|||||||
|
|
||||||
Write-Host "`nPackaging release: $($zipName)"
|
Write-Host "`nPackaging release: $($zipName)"
|
||||||
|
|
||||||
$filesToInclude = @(
|
# Create a temporary staging directory
|
||||||
"backend\lst_backend.exe",
|
$tempStageDir = New-Item -ItemType Directory -Path (Join-Path $env:TEMP "lst_staging") -Force
|
||||||
"frontend\.nitro",
|
|
||||||
"frontend\.tanstack",
|
# Copy files to organized structure
|
||||||
"frontend\.output",
|
$filesToCopy = @(
|
||||||
"frontend\public",
|
@{ Source = "backend\lst_backend.exe"; Destination = "backend\lst_backend.exe" },
|
||||||
"package.json",
|
@{ Source = "LstWrapper\publish"; Destination = "lstwrapper\" },
|
||||||
"CHANGELOG.md",
|
@{ Source = "frontend\.nitro"; Destination = "frontend\.nitro" },
|
||||||
"README.md"
|
@{ Source = "frontend\.tanstack"; Destination = "frontend\.tanstack" },
|
||||||
|
@{ Source = "frontend\.output"; Destination = "frontend\.output" },
|
||||||
|
@{ Source = "frontend\public"; Destination = "frontend\public" },
|
||||||
|
@{ Source = "package.json"; Destination = "package.json" },
|
||||||
|
@{ Source = "CHANGELOG.md"; Destination = "CHANGELOG.md" },
|
||||||
|
@{ Source = "README.md"; Destination = "README.md" }
|
||||||
)
|
)
|
||||||
|
|
||||||
Compress-Archive -Path $filesToInclude -DestinationPath $zipPath
|
foreach ($file in $filesToCopy) {
|
||||||
|
$destPath = Join-Path $tempStageDir $file.Destination
|
||||||
|
New-Item -ItemType Directory -Path (Split-Path $destPath -Parent) -Force | Out-Null
|
||||||
|
Copy-Item -Path $file.Source -Destination $destPath -Recurse -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create the zip from the staged directory
|
||||||
|
Compress-Archive -Path "$tempStageDir\*" -DestinationPath $zipPath
|
||||||
|
|
||||||
|
# Clean up temporary directory
|
||||||
|
Remove-Item $tempStageDir -Recurse -Force
|
||||||
|
|
||||||
Write-Host "`nRelease package created at: $($zipPath)"
|
Write-Host "`nRelease package created at: $($zipPath)"
|
||||||
|
Write-Host "Organized structure:"
|
||||||
|
Write-Host "- backend/"
|
||||||
|
Write-Host "- frontend/"
|
||||||
|
Write-Host "- lstwrapper/"
|
||||||
|
Write-Host "- CHANGELOG.md"
|
||||||
|
Write-Host "- README.md"
|
||||||
Reference in New Issue
Block a user