From 4bebe34553d5b79458ae84d3708958e69c936b66 Mon Sep 17 00:00:00 2001 From: "daniele.corsini@corsinvest.it" Date: Wed, 19 Jul 2023 19:07:32 +0200 Subject: [PATCH] Fix --- .gitignore | 4 +- Corsinvest.ProxmoxVE.Admin.sln | 7 ---- Build.ps1 => cmd/Build.ps1 | 0 doc-utils.ps1 => cmd/doc-utils.ps1 | 30 ++++++--------- docker-utils.ps1 => cmd/docker-utils.ps1 | 16 ++++---- ...Corsinvest.ProxmoxVE.Admin.AutoSnap.csproj | 4 +- .../Corsinvest.ProxmoxVE.Admin.Botgram.csproj | 2 +- ...nvest.ProxmoxVE.Admin.ClusterStatus.csproj | 2 +- ...invest.ProxmoxVE.Admin.ClusterUsage.csproj | 4 +- .../Corsinvest.ProxmoxVE.Admin.Core.csproj | 8 ++-- .../Options/RenderNodesOptions.razor.cs | 4 +- .../Services/PveClientService.cs | 4 +- .../Subscription/Info.cs | 38 ++++++------------- .../Subscription/RenderIndex.razor | 13 ++++--- .../Subscription/RenderIndex.razor.cs | 19 +++++++--- .../Subscription/Status.cs | 1 - .../Subscription/SubscriptionService.cs | 3 +- ...rsinvest.ProxmoxVE.Admin.Diagnostic.csproj | 4 +- ...sinvest.ProxmoxVE.Admin.DisksStatus.csproj | 2 +- ...est.ProxmoxVE.Admin.MetricsExporter.csproj | 2 +- ...vest.ProxmoxVE.Admin.NodeFreeMemory.csproj | 2 +- ...sinvest.ProxmoxVE.Admin.NodeProtect.csproj | 4 +- ...sinvest.ProxmoxVE.Admin.QemuMonitor.csproj | 2 +- ...Corsinvest.ProxmoxVE.Admin.VmUnlock.csproj | 2 +- ...sinvest.ProxmoxVE.Admin.VzDumpTrend.csproj | 2 +- .../Corsinvest.ProxmoxVE.Admin.csproj | 18 ++++----- .../Pages/{_Index.cshtml => _Host.cshtml} | 0 src/Corsinvest.ProxmoxVE.Admin/Program.cs | 10 ++++- .../wwwroot/doc/index.adoc | 2 +- .../wwwroot/doc/index.html | 4 +- .dockerignore => src/Docker/.dockerignore | 0 Dockerfile => src/Docker/Dockerfile | 0 src/Docker/Nginx/ReverseProxy/.env | 5 +++ .../Nginx/ReverseProxy/docker-compose.yml | 23 +++++++++++ src/Docker/Nginx/ReverseProxy/nginx.conf | 36 ++++++++++++++++++ src/Docker/README.md | 5 +++ src/common.props | 2 +- 37 files changed, 169 insertions(+), 115 deletions(-) rename Build.ps1 => cmd/Build.ps1 (100%) rename doc-utils.ps1 => cmd/doc-utils.ps1 (51%) rename docker-utils.ps1 => cmd/docker-utils.ps1 (84%) rename src/Corsinvest.ProxmoxVE.Admin/Pages/{_Index.cshtml => _Host.cshtml} (100%) rename .dockerignore => src/Docker/.dockerignore (100%) rename Dockerfile => src/Docker/Dockerfile (100%) create mode 100644 src/Docker/Nginx/ReverseProxy/.env create mode 100644 src/Docker/Nginx/ReverseProxy/docker-compose.yml create mode 100644 src/Docker/Nginx/ReverseProxy/nginx.conf create mode 100644 src/Docker/README.md diff --git a/.gitignore b/.gitignore index b787e3a..8dc4a83 100644 --- a/.gitignore +++ b/.gitignore @@ -363,5 +363,5 @@ MigrationBackup/ /src/Corsinvest.ProxmoxVE.Admin/wwwroot/lib /src/Corsinvest.ProxmoxVE.Admin/appsettings.json /src/Corsinvest.ProxmoxVE.Admin/data -setKey.ps1 -create-lxc.sh \ No newline at end of file +/cmd/setKey.ps1 +/cmd/create-lxc.sh \ No newline at end of file diff --git a/Corsinvest.ProxmoxVE.Admin.sln b/Corsinvest.ProxmoxVE.Admin.sln index bffe4eb..470d07b 100644 --- a/Corsinvest.ProxmoxVE.Admin.sln +++ b/Corsinvest.ProxmoxVE.Admin.sln @@ -7,19 +7,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Corsinvest.ProxmoxVE.Admin" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{B81E7A2B-6A9F-42CE-BC5A-EF2BC272E0F6}" ProjectSection(SolutionItems) = preProject - .dockerignore = .dockerignore .gitignore = .gitignore 3rd-party-licenses.md = 3rd-party-licenses.md - Build.ps1 = Build.ps1 src\common.props = src\common.props - create-lxc.sh = create-lxc.sh - doc-utils.ps1 = doc-utils.ps1 - docker-utils.ps1 = docker-utils.ps1 - Dockerfile = Dockerfile icon.png = icon.png LICENSE = LICENSE README.md = README.md - setKey.ps1 = setKey.ps1 Todo.md = Todo.md EndProjectSection EndProject diff --git a/Build.ps1 b/cmd/Build.ps1 similarity index 100% rename from Build.ps1 rename to cmd/Build.ps1 diff --git a/doc-utils.ps1 b/cmd/doc-utils.ps1 similarity index 51% rename from doc-utils.ps1 rename to cmd/doc-utils.ps1 index 8513a02..a52c632 100644 --- a/doc-utils.ps1 +++ b/cmd/doc-utils.ps1 @@ -2,45 +2,39 @@ # SPDX-License-Identifier: AGPL-3.0-only param( - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [ValidateSet('build')] [System.String]$operation ) #Read project version -$xml = [xml](Get-Content .\src\common.props) +$xml = [xml](Get-Content ../src/common.props) $version = $xml.Project.PropertyGroup.Version Write-Host "Project version: $version" Write-Host "Operation: $operation" -function Build-Doc() -{ +function Build-Doc() { Write-Host "Build Documenattion" Write-Host "Fix version" #replace version - $pathDoc = ".\src\Corsinvest.ProxmoxVE.Admin\wwwroot\doc\" - $indexDoc = "$pathDoc\index.adoc" - - $content= [System.IO.File]::ReadAllLines($indexDoc) - - For ($i=0; $i -le $content.Length; $i++) { - if ($content[$i].StartsWith(":app-version: v")) - { - $content[$i]=":app-version: v$version" - break - } + $indexDoc = "..\src\Corsinvest.ProxmoxVE.Admin\wwwroot\doc\index.adoc" + $content = Get-Content $indexDoc + For ($i = 0; $i -le $content.Length; $i++) { + if ($content[$i].StartsWith(":app-version: v")) { + $content[$i] = ":app-version: v$version" + break + } } Set-Content -Path $indexDoc -Value $content #create html Write-Host "Create html" - docker run --rm -it -v .\src\Corsinvest.ProxmoxVE.Admin\wwwroot\doc\:/documents/ asciidoctor/docker-asciidoctor asciidoctor index.adoc + docker run --rm -it -v .\..\src\Corsinvest.ProxmoxVE.Admin\wwwroot\doc\:/documents/ asciidoctor/docker-asciidoctor asciidoctor index.adoc #docker run --rm -it -v .\src\Corsinvest.ProxmoxVE.Admin\wwwroot\doc\:/documents/ asciidoctor/docker-asciidoctor asciidoctor-pdf index.adoc } -if($operation -eq 'build') -{ +if ($operation -eq 'build') { Build-Doc } \ No newline at end of file diff --git a/docker-utils.ps1 b/cmd/docker-utils.ps1 similarity index 84% rename from docker-utils.ps1 rename to cmd/docker-utils.ps1 index b4dadad..efa5835 100644 --- a/docker-utils.ps1 +++ b/cmd/docker-utils.ps1 @@ -8,7 +8,7 @@ param( ) #Read project version -$xml = [xml](Get-Content .\src\common.props) +$xml = [xml](Get-Content ../src/common.props) $version = $xml.Project.PropertyGroup.Version Write-Host "Project version: $version" @@ -28,7 +28,7 @@ function Build-Docker() Write-Host "Build Docker cv4pve-admin" docker rmi corsinvest/cv4pve-admin:$version --force - docker build --rm -f "Dockerfile" -t corsinvest/cv4pve-admin:$version "." + docker build --rm -f .\..\src\docker\Dockerfile -t corsinvest/cv4pve-admin:$version "..\" #remove unused images docker image prune -f @@ -55,15 +55,15 @@ function Test-Docker() corsinvest/cv4pve-admin:$version } -if($operation -eq 'test') -{ +if($operation -eq 'test') +{ Test-Docker } -elseif($operation -eq 'build') -{ +elseif($operation -eq 'build') +{ Build-Docker } -elseif($operation -eq 'publish') -{ +elseif($operation -eq 'publish') +{ Publish-Docker } \ No newline at end of file diff --git a/src/Corsinvest.ProxmoxVE.Admin.AutoSnap/Corsinvest.ProxmoxVE.Admin.AutoSnap.csproj b/src/Corsinvest.ProxmoxVE.Admin.AutoSnap/Corsinvest.ProxmoxVE.Admin.AutoSnap.csproj index 25c9d1d..06b4fec 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.AutoSnap/Corsinvest.ProxmoxVE.Admin.AutoSnap.csproj +++ b/src/Corsinvest.ProxmoxVE.Admin.AutoSnap/Corsinvest.ProxmoxVE.Admin.AutoSnap.csproj @@ -3,8 +3,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Corsinvest.ProxmoxVE.Admin.Botgram/Corsinvest.ProxmoxVE.Admin.Botgram.csproj b/src/Corsinvest.ProxmoxVE.Admin.Botgram/Corsinvest.ProxmoxVE.Admin.Botgram.csproj index ff52f80..dfd94aa 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.Botgram/Corsinvest.ProxmoxVE.Admin.Botgram.csproj +++ b/src/Corsinvest.ProxmoxVE.Admin.Botgram/Corsinvest.ProxmoxVE.Admin.Botgram.csproj @@ -3,7 +3,7 @@ - + diff --git a/src/Corsinvest.ProxmoxVE.Admin.ClusterStatus/Corsinvest.ProxmoxVE.Admin.ClusterStatus.csproj b/src/Corsinvest.ProxmoxVE.Admin.ClusterStatus/Corsinvest.ProxmoxVE.Admin.ClusterStatus.csproj index c6ce6e2..3ca4444 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.ClusterStatus/Corsinvest.ProxmoxVE.Admin.ClusterStatus.csproj +++ b/src/Corsinvest.ProxmoxVE.Admin.ClusterStatus/Corsinvest.ProxmoxVE.Admin.ClusterStatus.csproj @@ -2,7 +2,7 @@ - + diff --git a/src/Corsinvest.ProxmoxVE.Admin.ClusterUsage/Corsinvest.ProxmoxVE.Admin.ClusterUsage.csproj b/src/Corsinvest.ProxmoxVE.Admin.ClusterUsage/Corsinvest.ProxmoxVE.Admin.ClusterUsage.csproj index 1f4d808..6691e2d 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.ClusterUsage/Corsinvest.ProxmoxVE.Admin.ClusterUsage.csproj +++ b/src/Corsinvest.ProxmoxVE.Admin.ClusterUsage/Corsinvest.ProxmoxVE.Admin.ClusterUsage.csproj @@ -2,8 +2,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Corsinvest.ProxmoxVE.Admin.Core/Corsinvest.ProxmoxVE.Admin.Core.csproj b/src/Corsinvest.ProxmoxVE.Admin.Core/Corsinvest.ProxmoxVE.Admin.Core.csproj index 6ea0457..6af6122 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.Core/Corsinvest.ProxmoxVE.Admin.Core.csproj +++ b/src/Corsinvest.ProxmoxVE.Admin.Core/Corsinvest.ProxmoxVE.Admin.Core.csproj @@ -7,7 +7,7 @@ - + @@ -17,9 +17,9 @@ - - + + - + \ No newline at end of file diff --git a/src/Corsinvest.ProxmoxVE.Admin.Core/Options/RenderNodesOptions.razor.cs b/src/Corsinvest.ProxmoxVE.Admin.Core/Options/RenderNodesOptions.razor.cs index 074c14e..268dc05 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.Core/Options/RenderNodesOptions.razor.cs +++ b/src/Corsinvest.ProxmoxVE.Admin.Core/Options/RenderNodesOptions.razor.cs @@ -46,12 +46,12 @@ private async Task FindNewNodes() break; case 0: - UINotifier.Show(L["All nodes have been inserted!"], UINotifierSeverity.Info); + UINotifier.Show(L["All nodes have been inserted and updated!"], UINotifierSeverity.Info); break; case 1: await DataGridManager.Refresh(); - UINotifier.Show(L["New nodes added! Please save."], UINotifierSeverity.Info); + UINotifier.Show(L["New nodes added and updated! Please save."], UINotifierSeverity.Info); break; default: break; diff --git a/src/Corsinvest.ProxmoxVE.Admin.Core/Services/PveClientService.cs b/src/Corsinvest.ProxmoxVE.Admin.Core/Services/PveClientService.cs index 6327eef..be19e62 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.Core/Services/PveClientService.cs +++ b/src/Corsinvest.ProxmoxVE.Admin.Core/Services/PveClientService.cs @@ -63,7 +63,7 @@ public async Task PopulateInfoNodes(ClusterOptions clusterOptions) var status = await client.Cluster.Status.Get(); //check new nodes - foreach (var item in status) + foreach (var item in status.Where(a=> !string.IsNullOrWhiteSpace(a.IpAddress))) { if (clusterOptions.GetNodeOptions(item.IpAddress, item.Name) == null) { @@ -79,7 +79,7 @@ public async Task PopulateInfoNodes(ClusterOptions clusterOptions) foreach (var node in clusterOptions.Nodes) { var nodeStatus = status.FirstOrDefault(x => x.IpAddress == node.IpAddress); - if (nodeStatus != null) + if (nodeStatus != null && nodeStatus.IsOnline) { var serverId = (await client.Nodes[nodeStatus.Name].Subscription.GetEx()).Serverid; if (node.ServerId != serverId) diff --git a/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/Info.cs b/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/Info.cs index f87323d..c580b30 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/Info.cs +++ b/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/Info.cs @@ -2,7 +2,6 @@ * SPDX-FileCopyrightText: Copyright Corsinvest Srl * SPDX-License-Identifier: AGPL-3.0-only */ - using System.Xml.Serialization; namespace Corsinvest.ProxmoxVE.Admin.Core.Subscription; @@ -19,38 +18,25 @@ public class Info public string ProductName { get; set; } = default!; [XmlIgnore] - public DateTime RegistrationDate { get; set; } = default!; + public DateTime? RegistrationDate { get; set; } = default!; [XmlElement("regdate")] public string RegistrationDateString { - get { return RegistrationDate.ToString("yyyy-MM-dd HH:mm:ss"); } - set { RegistrationDate = DateTime.Parse(value); } + get => RegistrationDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? string.Empty; + set => RegistrationDate = DateTime.TryParse(value, out var date) ? date : null; } - [XmlElement("nextduedate")] + [XmlIgnore] public DateTime? NextDueDate { get; set; } = default!; + [XmlElement("nextduedate")] + public string NextDueDatetring + { + get => NextDueDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? string.Empty; + set => NextDueDate = DateTime.TryParse(value, out var date) ? date : null; + } + [XmlElement("message")] public string Message { get; set; } = default!; -} - -/* -Suspended -Frank Lupo - -franklupog@gmail.com -5 -1 -cv4pve-admin HOME -2023-06-25 00:00:00 -2023-06-27 -Annually -corsinvest.it,www.corsinvest.it -localhost -A0A12C8D4C93E75AD7737C2294969A0F - -Notes=|Internal Order Number= - - - */ \ No newline at end of file +} \ No newline at end of file diff --git a/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/RenderIndex.razor b/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/RenderIndex.razor index 97b2f1c..6940c30 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/RenderIndex.razor +++ b/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/RenderIndex.razor @@ -1,5 +1,4 @@ -@using MudExtensions.Enums; -@* +@* * SPDX-FileCopyrightText: Copyright Corsinvest Srl * SPDX-License-Identifier: AGPL-3.0-only *@ @@ -80,10 +79,12 @@ - + @L["Retrieve cluster Info"] - + } - \ No newline at end of file + + +
\ No newline at end of file diff --git a/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/RenderIndex.razor.cs b/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/RenderIndex.razor.cs index a2f309f..19b0d87 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/RenderIndex.razor.cs +++ b/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/RenderIndex.razor.cs @@ -1,8 +1,7 @@ /* - * SPDX - FileCopyrightText: Copyright Corsinvest Srl - * SPDX-License-Identifier: AGPL - 3.0 - only + * SPDX-FileCopyrightText: Copyright Corsinvest Srl + * SPDX-License-Identifier: AGPL-3.0-only */ - using Corsinvest.AppHero.Core.Options; using Corsinvest.AppHero.Core.UI; using Corsinvest.ProxmoxVE.Admin.Core.Options; @@ -19,6 +18,7 @@ public partial class RenderIndex public Dictionary Checks { get; } = new(); private bool Initialized { get; set; } private bool InSave { get; set; } + private bool InRetrieveNodeInfo { get; set; } protected override async Task OnInitializedAsync() { @@ -45,18 +45,23 @@ private async Task RetrieveNodeInfo(ClusterOptions clusterOptions) { try { - switch (await PveClientService.PopulateInfoNodes(clusterOptions)) + InRetrieveNodeInfo = true; + var ret = await PveClientService.PopulateInfoNodes(clusterOptions); + InRetrieveNodeInfo = false; + + switch (ret) { case -1: UINotifier.Show(L["Credential or host not valid!"], UINotifierSeverity.Error); break; case 0: - UINotifier.Show(L["All nodes have been inserted!"], UINotifierSeverity.Info); + UINotifier.Show(L["All nodes have been inserted and updated!"], UINotifierSeverity.Info); break; case 1: - UINotifier.Show(L["New nodes added! Please save."], UINotifierSeverity.Info); + UINotifier.Show(L["New nodes added and updated! Saved."], UINotifierSeverity.Info); + WritableOptionsService.Update(AdminOptions.Value); break; default: break; @@ -71,5 +76,7 @@ private async Task Save(ClusterNodeOptions nodeOptions) WritableOptionsService.Update(AdminOptions.Value); await SaveOnline(nodeOptions); InSave = false; + + UINotifier.Show(L["Data of node has been saved!"], UINotifierSeverity.Info); } } \ No newline at end of file diff --git a/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/Status.cs b/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/Status.cs index 4615aa4..89ce3e9 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/Status.cs +++ b/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/Status.cs @@ -2,7 +2,6 @@ * SPDX-FileCopyrightText: Copyright Corsinvest Srl * SPDX-License-Identifier: AGPL-3.0-only */ - namespace Corsinvest.ProxmoxVE.Admin.Core.Subscription; public enum Status diff --git a/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/SubscriptionService.cs b/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/SubscriptionService.cs index cb6fa66..11fa943 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/SubscriptionService.cs +++ b/src/Corsinvest.ProxmoxVE.Admin.Core/Subscription/SubscriptionService.cs @@ -2,7 +2,6 @@ * SPDX-FileCopyrightText: Copyright Corsinvest Srl * SPDX-License-Identifier: AGPL-3.0-only */ - using ApexCharts; using System.IO; using System.Xml.Serialization; @@ -33,7 +32,7 @@ public async Task RegisterAsync(string serverId, string licenseKey) if (response.IsSuccessStatusCode) { var xml = await response.Content.ReadAsStringAsync(); - xml = "" + xml + ""; + xml = "" + xml.Replace('\n', ' ') + ""; var serializer = new XmlSerializer(typeof(Info)); using var reader = new StringReader(xml); info = (Info)serializer.Deserialize(reader)!; diff --git a/src/Corsinvest.ProxmoxVE.Admin.Diagnostic/Corsinvest.ProxmoxVE.Admin.Diagnostic.csproj b/src/Corsinvest.ProxmoxVE.Admin.Diagnostic/Corsinvest.ProxmoxVE.Admin.Diagnostic.csproj index da92167..f4f702f 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.Diagnostic/Corsinvest.ProxmoxVE.Admin.Diagnostic.csproj +++ b/src/Corsinvest.ProxmoxVE.Admin.Diagnostic/Corsinvest.ProxmoxVE.Admin.Diagnostic.csproj @@ -3,8 +3,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Corsinvest.ProxmoxVE.Admin.DisksStatus/Corsinvest.ProxmoxVE.Admin.DisksStatus.csproj b/src/Corsinvest.ProxmoxVE.Admin.DisksStatus/Corsinvest.ProxmoxVE.Admin.DisksStatus.csproj index c6ce6e2..3ca4444 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.DisksStatus/Corsinvest.ProxmoxVE.Admin.DisksStatus.csproj +++ b/src/Corsinvest.ProxmoxVE.Admin.DisksStatus/Corsinvest.ProxmoxVE.Admin.DisksStatus.csproj @@ -2,7 +2,7 @@ - + diff --git a/src/Corsinvest.ProxmoxVE.Admin.MetricsExporter/Corsinvest.ProxmoxVE.Admin.MetricsExporter.csproj b/src/Corsinvest.ProxmoxVE.Admin.MetricsExporter/Corsinvest.ProxmoxVE.Admin.MetricsExporter.csproj index 467dd8e..5f8ca70 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.MetricsExporter/Corsinvest.ProxmoxVE.Admin.MetricsExporter.csproj +++ b/src/Corsinvest.ProxmoxVE.Admin.MetricsExporter/Corsinvest.ProxmoxVE.Admin.MetricsExporter.csproj @@ -3,7 +3,7 @@ - + diff --git a/src/Corsinvest.ProxmoxVE.Admin.NodeFreeMemory/Corsinvest.ProxmoxVE.Admin.NodeFreeMemory.csproj b/src/Corsinvest.ProxmoxVE.Admin.NodeFreeMemory/Corsinvest.ProxmoxVE.Admin.NodeFreeMemory.csproj index c6ce6e2..3ca4444 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.NodeFreeMemory/Corsinvest.ProxmoxVE.Admin.NodeFreeMemory.csproj +++ b/src/Corsinvest.ProxmoxVE.Admin.NodeFreeMemory/Corsinvest.ProxmoxVE.Admin.NodeFreeMemory.csproj @@ -2,7 +2,7 @@ - + diff --git a/src/Corsinvest.ProxmoxVE.Admin.NodeProtect/Corsinvest.ProxmoxVE.Admin.NodeProtect.csproj b/src/Corsinvest.ProxmoxVE.Admin.NodeProtect/Corsinvest.ProxmoxVE.Admin.NodeProtect.csproj index 9f6548b..d5696b8 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.NodeProtect/Corsinvest.ProxmoxVE.Admin.NodeProtect.csproj +++ b/src/Corsinvest.ProxmoxVE.Admin.NodeProtect/Corsinvest.ProxmoxVE.Admin.NodeProtect.csproj @@ -3,8 +3,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Corsinvest.ProxmoxVE.Admin.QemuMonitor/Corsinvest.ProxmoxVE.Admin.QemuMonitor.csproj b/src/Corsinvest.ProxmoxVE.Admin.QemuMonitor/Corsinvest.ProxmoxVE.Admin.QemuMonitor.csproj index d571189..1018dc7 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.QemuMonitor/Corsinvest.ProxmoxVE.Admin.QemuMonitor.csproj +++ b/src/Corsinvest.ProxmoxVE.Admin.QemuMonitor/Corsinvest.ProxmoxVE.Admin.QemuMonitor.csproj @@ -2,7 +2,7 @@ - + diff --git a/src/Corsinvest.ProxmoxVE.Admin.VmUnlock/Corsinvest.ProxmoxVE.Admin.VmUnlock.csproj b/src/Corsinvest.ProxmoxVE.Admin.VmUnlock/Corsinvest.ProxmoxVE.Admin.VmUnlock.csproj index c6ce6e2..3ca4444 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.VmUnlock/Corsinvest.ProxmoxVE.Admin.VmUnlock.csproj +++ b/src/Corsinvest.ProxmoxVE.Admin.VmUnlock/Corsinvest.ProxmoxVE.Admin.VmUnlock.csproj @@ -2,7 +2,7 @@ - + diff --git a/src/Corsinvest.ProxmoxVE.Admin.VzDumpTrend/Corsinvest.ProxmoxVE.Admin.VzDumpTrend.csproj b/src/Corsinvest.ProxmoxVE.Admin.VzDumpTrend/Corsinvest.ProxmoxVE.Admin.VzDumpTrend.csproj index d571189..1018dc7 100644 --- a/src/Corsinvest.ProxmoxVE.Admin.VzDumpTrend/Corsinvest.ProxmoxVE.Admin.VzDumpTrend.csproj +++ b/src/Corsinvest.ProxmoxVE.Admin.VzDumpTrend/Corsinvest.ProxmoxVE.Admin.VzDumpTrend.csproj @@ -2,7 +2,7 @@ - + diff --git a/src/Corsinvest.ProxmoxVE.Admin/Corsinvest.ProxmoxVE.Admin.csproj b/src/Corsinvest.ProxmoxVE.Admin/Corsinvest.ProxmoxVE.Admin.csproj index f2e4b0a..cf4edf7 100644 --- a/src/Corsinvest.ProxmoxVE.Admin/Corsinvest.ProxmoxVE.Admin.csproj +++ b/src/Corsinvest.ProxmoxVE.Admin/Corsinvest.ProxmoxVE.Admin.csproj @@ -7,13 +7,13 @@ - - - - - - - + + + + + + + @@ -22,8 +22,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Corsinvest.ProxmoxVE.Admin/Pages/_Index.cshtml b/src/Corsinvest.ProxmoxVE.Admin/Pages/_Host.cshtml similarity index 100% rename from src/Corsinvest.ProxmoxVE.Admin/Pages/_Index.cshtml rename to src/Corsinvest.ProxmoxVE.Admin/Pages/_Host.cshtml diff --git a/src/Corsinvest.ProxmoxVE.Admin/Program.cs b/src/Corsinvest.ProxmoxVE.Admin/Program.cs index 2a6d295..bc77269 100644 --- a/src/Corsinvest.ProxmoxVE.Admin/Program.cs +++ b/src/Corsinvest.ProxmoxVE.Admin/Program.cs @@ -9,6 +9,7 @@ using Corsinvest.ProxmoxVE.Admin; using Corsinvest.ProxmoxVE.Admin.Persistence; using Microsoft.AspNetCore.DataProtection; +using Microsoft.AspNetCore.HttpOverrides; using Serilog; //appsetting default @@ -92,14 +93,19 @@ #endregion } -app.UseHttpsRedirection(); +//app.UseHttpsRedirection(); + +app.UseForwardedHeaders(new ForwardedHeadersOptions +{ + ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto +}); app.UseRouting(); await app.OnApplicationInitializationAsync(); app.MapBlazorHub(); -app.MapFallbackToPage("/_Index"); +app.MapFallbackToPage("/_Host"); await app.OnPostApplicationInitializationAsync(); diff --git a/src/Corsinvest.ProxmoxVE.Admin/wwwroot/doc/index.adoc b/src/Corsinvest.ProxmoxVE.Admin/wwwroot/doc/index.adoc index 203eab6..5993df2 100644 --- a/src/Corsinvest.ProxmoxVE.Admin/wwwroot/doc/index.adoc +++ b/src/Corsinvest.ProxmoxVE.Admin/wwwroot/doc/index.adoc @@ -11,7 +11,7 @@ Powered by Corsinvest Srl :icons: font :pve-name: Proxmox VE :app-name: cv4pve-admin -:app-version: v1.0.0-rc.3 +:app-version: v1.0.0 :app-url-site: https://www.corsinvest.it/cv4pve-admin :company-url: https://www.corsinvest.it :company-name: Corsinvest Srl diff --git a/src/Corsinvest.ProxmoxVE.Admin/wwwroot/doc/index.html b/src/Corsinvest.ProxmoxVE.Admin/wwwroot/doc/index.html index ddad6e0..eee75c3 100644 --- a/src/Corsinvest.ProxmoxVE.Admin/wwwroot/doc/index.html +++ b/src/Corsinvest.ProxmoxVE.Admin/wwwroot/doc/index.html @@ -439,7 +439,7 @@ diff --git a/.dockerignore b/src/Docker/.dockerignore similarity index 100% rename from .dockerignore rename to src/Docker/.dockerignore diff --git a/Dockerfile b/src/Docker/Dockerfile similarity index 100% rename from Dockerfile rename to src/Docker/Dockerfile diff --git a/src/Docker/Nginx/ReverseProxy/.env b/src/Docker/Nginx/ReverseProxy/.env new file mode 100644 index 0000000..e69b11d --- /dev/null +++ b/src/Docker/Nginx/ReverseProxy/.env @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: Copyright Corsinvest Srl +# SPDX-License-Identifier: AGPL-3.0-only + +DATA_STORE=d:/DockerData/cv4pve-admin/ +VERSION=1.0.0-rc.3 \ No newline at end of file diff --git a/src/Docker/Nginx/ReverseProxy/docker-compose.yml b/src/Docker/Nginx/ReverseProxy/docker-compose.yml new file mode 100644 index 0000000..613531a --- /dev/null +++ b/src/Docker/Nginx/ReverseProxy/docker-compose.yml @@ -0,0 +1,23 @@ +# SPDX-FileCopyrightText: Copyright Corsinvest Srl +# SPDX-License-Identifier: AGPL-3.0-only + +version: "3.9" +services: + cv4pve-admin: + image: corsinvest/cv4pve-admin:${VERSION} + ports: + - "5000:5000" + environment: + - TZ=Europe/Rome + volumes: + - ${DATA_STORE}/data:/app/data + - ${DATA_STORE}/appsettings.json:/app/appsettings.json + + nginx: + image: nginx:alpine + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro + depends_on: + - cv4pve-admin + ports: + - "4000:4000" \ No newline at end of file diff --git a/src/Docker/Nginx/ReverseProxy/nginx.conf b/src/Docker/Nginx/ReverseProxy/nginx.conf new file mode 100644 index 0000000..c7ca6ef --- /dev/null +++ b/src/Docker/Nginx/ReverseProxy/nginx.conf @@ -0,0 +1,36 @@ +# SPDX-FileCopyrightText: Copyright Corsinvest Srl +# SPDX-License-Identifier: AGPL-3.0-only + +events { + worker_connections 1024; +} + +http { + + proxy_buffer_size 128k; + proxy_buffers 4 256k; + proxy_busy_buffers_size 256k; + large_client_header_buffers 4 16k; + + server { + listen 4000; + server_name _; + large_client_header_buffers 4 32k; + + location / { + proxy_pass http://cv4pve-admin:5000; + #proxy_pass http://10.92.100.21:5271; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host:5000; + proxy_cache_bypass $http_upgrade; + + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + fastcgi_buffers 16 16k; + fastcgi_buffer_size 32k; + } + } +} \ No newline at end of file diff --git a/src/Docker/README.md b/src/Docker/README.md new file mode 100644 index 0000000..a1a97a8 --- /dev/null +++ b/src/Docker/README.md @@ -0,0 +1,5 @@ +# Docker + +- Dokerfile (docker for cv4pve-admin) +- Nginx + - Reverse Proxy (doker-compose example reverse proxy use cv4pve-admin and Nginx redirect 5000 to 4000 diff --git a/src/common.props b/src/common.props index b43fe34..ac7ddeb 100644 --- a/src/common.props +++ b/src/common.props @@ -6,7 +6,7 @@ false latest - 1.0.0-rc.3 + 1.0.0 $(NoWarn);CS1591