15 Commits

Author SHA1 Message Date
a354004201 chore(release): v0.0.1-alpha.2 2025-07-16 07:08:01 -05:00
942be59715 refactor(build): changes to add in releasing from build 2025-07-16 07:07:08 -05:00
70e376c939 fix(build): removed the * at the end of source so no more errors 2025-07-16 06:56:13 -05:00
62a1ad83ab build(wrapper): added the wrapper to our build script 2025-07-16 06:55:52 -05:00
47c5a47ffa test(scripts): added in a go script to test my other scripts 2025-07-16 06:49:24 -05:00
9bd6e1fc04 feat(scripts): added in iis contorls 2025-07-16 06:48:43 -05:00
73600055fc fix(release script): correction to the script so it now puts the package to correct location 2025-07-15 10:39:20 -05:00
80907a89a9 refactor(backend): changes to how the api incorrect routes are handled 2025-07-14 21:58:01 -05:00
2472374157 refactor(zips): changes on how the compiler dose the zip to keep it cleaner 2025-07-14 21:57:04 -05:00
b72a10db94 refactor(build): changed the wording to understand the error when the .env missing 2025-07-14 21:56:16 -05:00
d097988dfd feat(lstwrapper): added a c# wrapper so we can run on windows server and get ssl
this will also allow us to still use docker
2025-07-14 21:55:25 -05:00
cb9e8e1107 fix(docker compose): corrected the data path wording and added a build option in 2025-07-14 21:54:18 -05:00
7bb7df788e fix(docker): corrections to the docker script
as we run it in the root we dont want to have it go up 2 levels only be at the same level
2025-07-12 21:50:58 -05:00
f26cf6404e ci(docker): changes to remove cache so we are always creating a new build 2025-07-12 21:42:25 -05:00
7f867b02d6 refactor(backend): changes to have a catch all and not return a 404 always 2025-07-12 21:41:47 -05:00
17 changed files with 296 additions and 38 deletions

5
.gitignore vendored
View File

@@ -4,6 +4,9 @@ frontend/.tanstack/
frontend/.output/
frontend/.nitro/
releases/
LstWrapper/bin
LstWrapper/publish
LstWrapper/obj
# ---> Go
# If you prefer the allow list template instead of the deny list, see community template:
@@ -184,3 +187,5 @@ test-results/
backend/go.sum
BUILD_NUMBER
scripts/resetDanger.js
LstWrapper/Program_vite_as_Static.txt
scripts/stopPool.go

View File

@@ -1,5 +1,7 @@
# 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)
### Bug Fixes

View 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
View 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();

View 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"
}
}
}
}

View File

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

15
LstWrapper/web.config Normal file
View 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>

View File

@@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<p>The new begining to lst</p>
</body>
</html>

View File

@@ -11,10 +11,19 @@ func main() {
fmt.Println("Welcome to lst backend where all the fun happens.")
r := gin.Default()
r.GET("/", errorLoc)
r.GET("/api/ping", func(c *gin.Context) {
c.JSON(200, gin.H{"message": "pong"})
})
r.Any("/api", errorApiLoc)
r.Any("/", errorLoc)
r.Run(":8080")
}
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"})
}

View File

@@ -1,21 +1,27 @@
---
services:
lst_backend:
# build: . # Tell Docker Compose to build the image using the Dockerfile in the current directory
image: git.tuffraid.net/cowch/logistics_support_tool:backend-latest
container_name: lst_backend # A friendly name for your running container
volumes:
- /path/to/frontend/backend:/data
ports:
- "8080:8080"
restart: unless-stopped
lst_backend:
# 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
container_name: lst_backend # A friendly name for your running container
volumes:
- /path/to/backend/data:/data
ports:
- "8080:8080"
restart: unless-stopped
lst_frontend:
# build: . # Tell Docker Compose to build the image using the Dockerfile in the current directory
image: git.tuffraid.net/cowch/logistics_support_tool:frontend-latest
container_name: lst_frontend # A friendly name for your running container
volumes:
- /path/to/frontend/data:/data
ports:
- "3120:3000"
restart: unless-stopped
lst_frontend:
# 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
container_name: lst_frontend # A friendly name for your running container
volumes:
- /path/to/frontend/data:/data
ports:
- "3120:3000"
restart: unless-stopped

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "logistics_support_tool",
"version": "0.0.3-alpha.22",
"version": "0.0.1-alpha.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "logistics_support_tool",
"version": "0.0.3-alpha.22",
"version": "0.0.1-alpha.2",
"license": "ISC",
"dependencies": {
"dotenv": "^17.2.0",

View File

@@ -1,6 +1,6 @@
{
"name": "logistics_support_tool",
"version": "0.0.1-alpha.1",
"version": "0.0.1-alpha.2",
"description": "This is the new logisitcs support tool",
"private": true,
"main": "index.js",
@@ -13,7 +13,7 @@
"docker": "powershell -File ./scripts/dockerBuild.ps1",
"release:createZip": "powershell -File ./scripts/release.ps1",
"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"
},
"repository": {

View File

@@ -21,7 +21,7 @@ if (Test-Path $envFile) {
}
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
}
@@ -110,11 +110,25 @@ function Update-BuildNumber {
}
Write-Host "Fronend build finished successfully."
Pop-Location
Write-Host "Building wrapper"
Push-Location $rootDir/LstWrapper
dotnet publish -c Release -o ./publish
Pop-Location
Update-BuildNumber
Write-Host "Zipping up the release"
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

View File

@@ -1,6 +1,6 @@
Write-Host "Building the docker images for front and backend"
docker build -t logistics_support_tool:frontend-latest -f ../frontend/Dockerfile ../frontend
docker build -t logistics_support_tool:backend-latest -f ../backend/Dockerfile ../backend
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
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

46
scripts/iisControls.ps1 Normal file
View 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
}

View File

@@ -66,17 +66,38 @@ if ($existingZips.Count -gt $keepReleases) {
Write-Host "`nPackaging release: $($zipName)"
$filesToInclude = @(
"backend\lst_backend.exe",
"frontend\.nitro",
"frontend\.tanstack",
"frontend\.output",
"frontend\public",
"package.json",
"CHANGELOG.md",
"README.md"
# Create a temporary staging directory
$tempStageDir = New-Item -ItemType Directory -Path (Join-Path $env:TEMP "lst_staging") -Force
# Copy files to organized structure
$filesToCopy = @(
@{ Source = "backend\lst_backend.exe"; Destination = "backend\lst_backend.exe" },
@{ Source = "LstWrapper\publish"; Destination = "lstwrapper\" },
@{ Source = "frontend\.nitro"; Destination = "frontend\.nitro" },
@{ 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
}
Write-Host "`nRelease package created at: $($zipPath)"
# 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 "Organized structure:"
Write-Host "- backend/"
Write-Host "- frontend/"
Write-Host "- lstwrapper/"
Write-Host "- CHANGELOG.md"
Write-Host "- README.md"