mirror of
https://github.com/Polaris-Entertainment/bytefy.git
synced 2026-04-11 10:29:37 +00:00
ci: add seq logging (#12)
This commit is contained in:
75
.github/workflows/build.yml
vendored
75
.github/workflows/build.yml
vendored
@@ -4,7 +4,24 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master # Change to your default branch if different
|
- master # Change to your default branch if different
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
environment:
|
||||||
|
description: 'Environment to deploy to'
|
||||||
|
required: true
|
||||||
|
default: 'prod'
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- prod
|
||||||
|
restart_iis:
|
||||||
|
description: 'Restart IIS after deployment'
|
||||||
|
required: true
|
||||||
|
default: true
|
||||||
|
type: boolean
|
||||||
|
create_release:
|
||||||
|
description: 'Create release'
|
||||||
|
required: true
|
||||||
|
default: true
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: self-hosted # Ensure your self-hosted runner is configured
|
runs-on: self-hosted # Ensure your self-hosted runner is configured
|
||||||
@@ -31,6 +48,39 @@ jobs:
|
|||||||
- name: Publish .NET Project
|
- name: Publish .NET Project
|
||||||
run: dotnet publish ./services/bytefy.image/bytefy.image/bytefy.image.csproj --configuration Release --output ./output/dotnet
|
run: dotnet publish ./services/bytefy.image/bytefy.image/bytefy.image.csproj --configuration Release --output ./output/dotnet
|
||||||
|
|
||||||
|
|
||||||
|
- name: Create placeholder appsettings for release
|
||||||
|
if: ${{ github.event.inputs.create_release != 'false' }}
|
||||||
|
run: |
|
||||||
|
$appSettings = @{
|
||||||
|
Logging = @{
|
||||||
|
LogLevel = @{
|
||||||
|
Default = "Information"
|
||||||
|
"Microsoft.AspNetCore" = "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AllowedHosts = "*"
|
||||||
|
Cors = @{
|
||||||
|
AllowedOrigins = @(
|
||||||
|
"http://localhost:4200"
|
||||||
|
"https://localhost:4200"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Seq = @{
|
||||||
|
ServerUrl = ${{ vars.SEQ_URL }}
|
||||||
|
ApiKey = ${{ secrets.seq_api_key }}
|
||||||
|
MinimumLevel = "Trace"
|
||||||
|
LevelOverride = @{
|
||||||
|
Microsoft = "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$appSettings | ConvertTo-Json -Depth 10 | Set-Content -Path "./output/dotnet/appsettings.json"
|
||||||
|
Write-Host "Created placeholder appsettings.json successfully"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: Install Node.js
|
- name: Install Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
@@ -63,6 +113,7 @@ jobs:
|
|||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: self-hosted # Ensure your self-hosted runner is configured
|
runs-on: self-hosted # Ensure your self-hosted runner is configured
|
||||||
|
if: ${{ github.event.inputs.create_release != 'false' }}
|
||||||
needs: build
|
needs: build
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -88,3 +139,25 @@ jobs:
|
|||||||
xcopy ".\output\dotnet\*" "C:\inetpub\applications\bytefy.image" /s /i /y
|
xcopy ".\output\dotnet\*" "C:\inetpub\applications\bytefy.image" /s /i /y
|
||||||
xcopy ".\bytefy.webapp\dist\browser\*" "C:\inetpub\wwwroot\bytefy" /s /i /y
|
xcopy ".\bytefy.webapp\dist\browser\*" "C:\inetpub\wwwroot\bytefy" /s /i /y
|
||||||
|
|
||||||
|
- name: Restart IIS Application Pool
|
||||||
|
if: ${{ github.event.inputs.restart_iis != 'false' }}
|
||||||
|
run: |
|
||||||
|
Import-Module WebAdministration
|
||||||
|
$appPoolName = "${{ vars.IIS_APP_POOL_NAME }}"
|
||||||
|
if ([string]::IsNullOrEmpty($appPoolName)) {
|
||||||
|
$appPoolName = "HomeApi"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Starting application pool: $appPoolName"
|
||||||
|
|
||||||
|
# Check if app pool exists
|
||||||
|
if (Test-Path "IIS:\AppPools\$appPoolName") {
|
||||||
|
# Start app pool
|
||||||
|
Start-WebAppPool -Name $appPoolName
|
||||||
|
Write-Host "Application pool started successfully"
|
||||||
|
} else {
|
||||||
|
Write-Host "Warning: Application pool '$appPoolName' not found. Using IISReset instead."
|
||||||
|
iisreset /restart
|
||||||
|
Write-Host "IIS restarted successfully"
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ var builder = WebApplication.CreateBuilder(args);
|
|||||||
builder.Services.AddAntiforgery(options => options.HeaderName = "2311d8d8-607d-4747-8939-1bde65643254");
|
builder.Services.AddAntiforgery(options => options.HeaderName = "2311d8d8-607d-4747-8939-1bde65643254");
|
||||||
builder.Services.AddSingleton<ConversionQueueService>();
|
builder.Services.AddSingleton<ConversionQueueService>();
|
||||||
builder.Services.AddHostedService(provider => provider.GetRequiredService<ConversionQueueService>());
|
builder.Services.AddHostedService(provider => provider.GetRequiredService<ConversionQueueService>());
|
||||||
|
builder.Services.AddLogging(loggingBuilder =>
|
||||||
|
{
|
||||||
|
loggingBuilder.AddSeq(builder.Configuration.GetSection("Seq"));
|
||||||
|
});
|
||||||
|
|
||||||
var corsSettings = builder.Configuration.GetSection("Cors").Get<CorsSettings>();
|
var corsSettings = builder.Configuration.GetSection("Cors").Get<CorsSettings>();
|
||||||
|
|
||||||
|
|||||||
@@ -11,5 +11,13 @@
|
|||||||
"http://localhost:4200",
|
"http://localhost:4200",
|
||||||
"https://localhost:4200"
|
"https://localhost:4200"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"Seq": {
|
||||||
|
"ServerUrl": "https://log.azaaxin.com",
|
||||||
|
"ApiKey": "KEY",
|
||||||
|
"MinimumLevel": "Trace",
|
||||||
|
"LevelOverride": {
|
||||||
|
"Microsoft": "Warning"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,13 @@
|
|||||||
"http://bytefy.net",
|
"http://bytefy.net",
|
||||||
"https://bytefy.net"
|
"https://bytefy.net"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"Seq": {
|
||||||
|
"ServerUrl": "https://log.azaaxin.com",
|
||||||
|
"ApiKey": "KEY",
|
||||||
|
"MinimumLevel": "Trace",
|
||||||
|
"LevelOverride": {
|
||||||
|
"Microsoft": "Warning"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="14.0.0" />
|
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="14.0.0" />
|
||||||
<PackageReference Include="Magick.NET.Core" Version="14.0.0" />
|
<PackageReference Include="Magick.NET.Core" Version="14.0.0" />
|
||||||
|
<PackageReference Include="Seq.Extensions.Logging" Version="8.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user