Compare commits
15 Commits
bugix/pipe
...
enhancemen
Author | SHA1 | Date | |
---|---|---|---|
f207440ae6 | |||
ef187f8750 | |||
570b5abfa0 | |||
2249d1a776 | |||
37de21f06b | |||
b9d5ade0f1 | |||
921b4a9664 | |||
0e9555e3f7 | |||
19c7aaaca1 | |||
068c67d0d9 | |||
d49977815d | |||
fe45d901e4 | |||
5867cfc3e1 | |||
2be4331a6e | |||
9ee2750534 |
@@ -8,7 +8,7 @@ on:
|
||||
|
||||
env:
|
||||
DOTNET_VERSION: '8.0.x'
|
||||
DOCKER_IMAGE_NAME: watcher
|
||||
DOCKER_IMAGE_NAME: watcher-server
|
||||
REGISTRY_URL: git.triggermeelmo.com
|
||||
DOCKER_PLATFORMS: 'linux/amd64,linux/arm64'
|
||||
|
||||
@@ -122,7 +122,10 @@ jobs:
|
||||
|
||||
tag:
|
||||
name: Create Tag
|
||||
needs: [docker-build-and-push]
|
||||
needs: [docker-build-and-push, set-tag]
|
||||
if: |
|
||||
needs.set-tag.outputs.should_tag == 'true' &&
|
||||
github.event_name != 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.OpenApi.Models;
|
||||
|
||||
using Serilog;
|
||||
|
||||
@@ -36,11 +37,17 @@ builder.Services.AddHttpContextAccessor();
|
||||
|
||||
// Storage Singleton
|
||||
builder.Services.AddSingleton<IDashboardStore, DashboardStore>();
|
||||
builder.Services.AddSingleton<ISystemStore, SystemStore>();
|
||||
|
||||
// Background Services
|
||||
builder.Services.AddHostedService<NetworkCheck>();
|
||||
builder.Services.AddHostedService<DatabaseCheck>();
|
||||
|
||||
// Swagger API-Dokumentation
|
||||
builder.Services.AddSwaggerGen(options =>
|
||||
{
|
||||
options.SwaggerDoc("v1", new OpenApiInfo { Title = "Watcher-Server API", Version = "v1" });
|
||||
});
|
||||
|
||||
// ---------- Konfiguration ----------
|
||||
DotNetEnv.Env.Load();
|
||||
@@ -212,6 +219,8 @@ if (!app.Environment.IsDevelopment())
|
||||
app.UseHttpsRedirection();
|
||||
app.UseRouting();
|
||||
|
||||
app.UseSwagger();
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
@@ -222,4 +231,11 @@ app.MapControllerRoute(
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}"
|
||||
);
|
||||
|
||||
app.MapSwagger();
|
||||
|
||||
app.UseSwaggerUI(options =>
|
||||
{
|
||||
options.SwaggerEndpoint("v1/swagger.json", "Watcher-Server API v1");
|
||||
});
|
||||
|
||||
app.Run();
|
9
Watcher/Services/ISystemStore.cs
Normal file
9
Watcher/Services/ISystemStore.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Watcher.Services;
|
||||
|
||||
public interface ISystemStore
|
||||
{
|
||||
Boolean NewVersionAvailable { get; set; }
|
||||
|
||||
Double DatabaseSize { get; set; }
|
||||
|
||||
}
|
42
Watcher/Services/SystemMangement.cs
Normal file
42
Watcher/Services/SystemMangement.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System.Net.Http;
|
||||
|
||||
namespace Watcher.Services;
|
||||
|
||||
public class SystemManagement : BackgroundService
|
||||
{
|
||||
private readonly ILogger<NetworkCheck> _logger;
|
||||
|
||||
private ISystemStore _SystemStore;
|
||||
|
||||
public SystemManagement(ILogger<NetworkCheck> logger, ISystemStore SystemStore)
|
||||
{
|
||||
_logger = logger;
|
||||
_SystemStore = SystemStore;
|
||||
|
||||
}
|
||||
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
// Todo: Umstellen auf einmal alle 24h
|
||||
var timer = new PeriodicTimer(TimeSpan.FromSeconds(30));
|
||||
|
||||
while (await timer.WaitForNextTickAsync(stoppingToken))
|
||||
{
|
||||
// Hintergrundprozess abwarten
|
||||
await checkForNewDockerImageVersion();
|
||||
|
||||
// 5 Sekdunden Offset
|
||||
await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken);
|
||||
}
|
||||
}
|
||||
|
||||
public Task checkForNewDockerImageVersion()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task createDailySqliteBackup()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
9
Watcher/Services/SystemStore.cs
Normal file
9
Watcher/Services/SystemStore.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Watcher.Services;
|
||||
|
||||
public class SystemStore: ISystemStore
|
||||
{
|
||||
public Boolean NewVersionAvailable { get; set; }
|
||||
|
||||
public Double DatabaseSize { get; set; }
|
||||
|
||||
}
|
@@ -23,6 +23,7 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.6" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.6" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
Reference in New Issue
Block a user