diff --git a/.github/actions/build_docker/action.yml b/.github/actions/build_docker/action.yml index e0048e92..2f33613b 100644 --- a/.github/actions/build_docker/action.yml +++ b/.github/actions/build_docker/action.yml @@ -51,9 +51,9 @@ runs: registry: ${{ inputs.registry_prod }} username: ${{ inputs.registry_username }} password: ${{ inputs.registry_password }} - + - name: Build Image - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: push: true context: . diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 312cd8d2..2e9adeff 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,12 +4,12 @@ on: [push] jobs: build: - runs-on: windows-2019 + runs-on: ubuntu-latest steps: - name: Setup .NET - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x - - uses: actions/checkout@v1 + dotnet-version: 8.0.x + - uses: actions/checkout@v4 - name: Build with dotnet run: dotnet build diff --git a/.github/workflows/workflow_build_and_release_containers.yaml b/.github/workflows/workflow_build_and_release_containers.yaml index a8fd77f4..e88532e7 100644 --- a/.github/workflows/workflow_build_and_release_containers.yaml +++ b/.github/workflows/workflow_build_and_release_containers.yaml @@ -63,19 +63,20 @@ jobs: - name: Create Octo Release if main or deploy to sandbox label present if: env.SHOULD_CREATE_RELEASE == 'true' run: | - octoSpaceId="Spaces-1" - octoProjectId="Projects-2241" + octoSpaceId="Default" + octoProjectId="Opserver" dotnet octo create-release --project=$octoProjectId --space=$octoSpaceId --version=${{ needs.generate_date_version.outputs.version }} \ --gitRef=main --server=${{ vars.OCTOPUS_CLOUD_URL }} --apiKey=${{ secrets.OCTOPUS_CLOUD_API_KEY }} # Note: The gitRef param is for the Octo config repo and not the git repo for the code - - name: Deploy via Octopus if main or deploy to sandbox label present + + - name: Deploy via Octopus if main or deploy to ascn-dev if label present if: env.SHOULD_CREATE_RELEASE == 'true' run: | - octoSpaceId="Spaces-1" - octoProjectId="Projects-2241" + octoSpaceId="Default" + octoProjectId="OpServer" environmentId="${{ github.ref_name == 'main' && 'main-test' || 'ascn-dev' }}" dotnet octo deploy-release --project=$octoProjectId --space=$octoSpaceId --version=${{ needs.generate_date_version.outputs.version }} \ --server=${{ vars.OCTOPUS_CLOUD_URL }} --apiKey=${{ secrets.OCTOPUS_CLOUD_API_KEY }} --deployTo=$environmentId - # Note: The gitRef param is for the Octo config repo and not the git repo for the code + # Note: The gitRef param is for the Octo config repo and not the git repo for the code diff --git a/Dockerfile b/Dockerfile index 4cf76866..80e655e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /app # Global @@ -22,7 +22,7 @@ WORKDIR /app/src/Opserver.Web RUN dotnet publish -c Release -o publish # Build runtime image -FROM cr.stackoverflow.software/so-aspnet:6.0-jammy-chiseled-extra AS base +FROM cr.stackoverflow.software/so-aspnet:8.0-jammy-chiseled-extra AS base USER $APP_UID diff --git a/cnab/app/gcp-cluster-discovery.ps1 b/cnab/app/gcp-cluster-discovery.ps1 new file mode 100644 index 00000000..cec7eee1 --- /dev/null +++ b/cnab/app/gcp-cluster-discovery.ps1 @@ -0,0 +1,38 @@ +function Find-DeploymentGroup([string]$filter) { + Write-MinorStep "Finding GCP deployment group (project) using filter: $filter" + $projects = (gcloud projects list --filter=$filter --format=json | ConvertFrom-Json) + if ($null -eq $projects -Or $projects.Count -eq 0) { + Write-MinorStep "No projects found" + exit 1 + } + elseif ($projects.Count -gt 1) { + Write-MinorStep "$project_count projects found, cannot continue" + exit 1 + } + $project = $projects[0].projectId + Write-MinorStep "Project: $project" + return $project +} + +function Find-DeploymentTarget([string]$filter, [string]$deploymentGroup) { + Write-MinorStep "Finding GCP deployment target (cluster) using filter: $filter and deployment group (project): $deploymentGroup" + + $clusters = (gcloud container clusters list --filter=$filter --project=$deploymentGroup --format=json | ConvertFrom-Json) + $cluster_count = $clusters.Count + if ($cluster_count -eq 0) { + Write-MinorStep "No clusters found" + exit 1 + } + elseif ($cluster_count -gt 1) { + Write-MinorStep "$cluster_count clusters found, cannot continue" + exit 1 + } + $firstCluster = $clusters[0] + $target = new-object psobject -property @{ + Name = $firstCluster.name + Location = $firstCluster.location + } + Write-MinorStep "DeploymentTarget: $($target | ConvertTo-Json)" + + return $target +} diff --git a/docs/Configuration.md b/docs/Configuration.md index a22807a5..8c1eba4f 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -197,7 +197,7 @@ The dashboard can currently monitor via SignalFx, Bosun, Orion or limited amount /* If using Orion, a host (for links, not API) and a connection string needs to be provided */ //"orion": { // "host": "orion.mydomain.com", - // "connectionString": "Data Source=ny-orionsql01;Initial Catalog=SolarWindsOrion;Integrated Security=SSPI;Timeout=10" + // "connectionString": "Data Source=ny-orionsql01;Initial Catalog=SolarWindsOrion;Integrated Security=SSPI;Timeout=10;TrustServerCertificate=True" //} }, /* General dashboard UI settings */ @@ -319,7 +319,7 @@ Exceptions from a [StackExchange.Exceptional](https://nickcraver.com/StackExchan "queryTimeoutMs": 2000, // (Optional - default: 30000) The query timeout before giving up on this store (when shit hits the fan...maybe a store isn't available) "pollIntervalSeconds": 30, // (Optional - default: 300) How often to poll this store for new/changed exceptions // SQL Server connection string to the Exceptional store - "connectionString": "Server=ny-sql01;Database=NY.Exceptions;Integrated Security=SSPI;" + "connectionString": "Server=ny-sql01;Database=NY.Exceptions;Integrated Security=SSPI;TrustServerCertificate=True" } ], /* (Optional) Replacements for Stack Trace descriptions. It's general purpose with specific uses in mind. @@ -494,7 +494,7 @@ Because AlwaysOn AGs can get into a state where the master does not know about t { // (Optional) The default connection string used unless specifically provided on a node // $ServerName$ gets replaces with the name property of the instance - "defaultConnectionString": "Data Source=$ServerName$;Initial Catalog=master;Integrated Security=SSPI;", + "defaultConnectionString": "Data Source=$ServerName$;Initial Catalog=master;Integrated Security=SSPI;TrustServerCertificate=True", "refreshIntervalSeconds": 30, // (Optional - default: 60) How often to poll all servers "clusters": [ // (Optional) Always On Availability Group Clusters { @@ -510,7 +510,7 @@ Because AlwaysOn AGs can get into a state where the master does not know about t "instances": [ // (Optional) Standalone instances { // An example with all the options configured "name": "NY-DB05", - "connectionString": "Data Source=NY-DB05;Initial Catalog=bob;Integrated Security=SSPI;", + "connectionString": "Data Source=NY-DB05;Initial Catalog=bob;Integrated Security=SSPI;TrustServerCertificate=True", "refreshIntervalSeconds": 200 }, // Some standalone servers (default instance) using default refresh and connection strings: diff --git a/docs/Docs.csproj b/docs/Docs.csproj index 016f2741..f1d2de68 100644 --- a/docs/Docs.csproj +++ b/docs/Docs.csproj @@ -1,5 +1,5 @@ - net6.0 + net8.0 \ No newline at end of file diff --git a/src/Opserver.Core/Helpers/OpserverConfigException.cs b/src/Opserver.Core/Helpers/OpserverConfigException.cs index f758f111..2ad1ea3a 100644 --- a/src/Opserver.Core/Helpers/OpserverConfigException.cs +++ b/src/Opserver.Core/Helpers/OpserverConfigException.cs @@ -8,6 +8,6 @@ public class OpserverConfigException : Exception public OpserverConfigException() { } public OpserverConfigException(string message) : base(message) { } public OpserverConfigException(string message, Exception innerException) : base(message, innerException) { } - protected OpserverConfigException(SerializationInfo info, StreamingContext context) : base(info, context) { } + } } diff --git a/src/Opserver.Core/Opserver.Core.csproj b/src/Opserver.Core/Opserver.Core.csproj index 36d621c2..a849883a 100644 --- a/src/Opserver.Core/Opserver.Core.csproj +++ b/src/Opserver.Core/Opserver.Core.csproj @@ -2,31 +2,35 @@ Opserver Opserver.Core - net6.0 + net8.0 true embedded - - + + - - - - - - + + + + + + - - + + - - - + + + + + + + \ No newline at end of file diff --git a/src/Opserver.Web/Opserver.Web.csproj b/src/Opserver.Web/Opserver.Web.csproj index 4527022d..b05a87da 100644 --- a/src/Opserver.Web/Opserver.Web.csproj +++ b/src/Opserver.Web/Opserver.Web.csproj @@ -2,30 +2,29 @@ Exe Opserver - net6.0 + net8.0 - - + - - - + + + - + - + - - + + @@ -37,4 +36,8 @@ + + + + \ No newline at end of file diff --git a/src/Opserver.Web/Startup.cs b/src/Opserver.Web/Startup.cs index d55d80ae..1ce18317 100644 --- a/src/Opserver.Web/Startup.cs +++ b/src/Opserver.Web/Startup.cs @@ -166,7 +166,7 @@ public void ConfigureServices(IServiceCollection services) foreach (var knownNetwork in knownNetworks) { var ipNet = IPNet.Parse(knownNetwork); - options.KnownNetworks.Add(new IPNetwork(ipNet.IPAddress, ipNet.CIDR)); + options.KnownNetworks.Add(new Microsoft.AspNetCore.HttpOverrides.IPNetwork(ipNet.IPAddress, ipNet.CIDR)); } } } diff --git a/src/Opserver.Web/opserverSettings.json b/src/Opserver.Web/opserverSettings.json index 3efc89ba..e68f5677 100644 --- a/src/Opserver.Web/opserverSettings.json +++ b/src/Opserver.Web/opserverSettings.json @@ -7,7 +7,7 @@ "Modules": { /* Configuration for the SQL Server dashboard */ "Sql": { - //"defaultConnectionString": "Data Source=$ServerName$;Initial Catalog=master;Integrated Security=SSPI;", + //"defaultConnectionString": "Data Source=$ServerName$;Initial Catalog=master;Integrated Security=SSPI;TrustServerCertificate=True", //"refreshIntervalSeconds": 30, //"instances": [ // { "name": "localhost" } @@ -42,7 +42,7 @@ // { // "name": "Local", // "queryTimeoutMs": 2000, - // "connectionString": "Server=.;Database=Local.Exceptions;Integrated Security=SSPI;" + // "connectionString": "Server=.;Database=Local.Exceptions;Integrated Security=SSPI;TrustServerCertificate=True" // } //], "stackTraceReplacements": [ diff --git a/tests/Opserver.Tests/Opserver.Tests.csproj b/tests/Opserver.Tests/Opserver.Tests.csproj index dd7970eb..4102b646 100644 --- a/tests/Opserver.Tests/Opserver.Tests.csproj +++ b/tests/Opserver.Tests/Opserver.Tests.csproj @@ -2,11 +2,11 @@ Opserver.Tests Opserver.Tests - net6.0 + net8.0 - - - + + + \ No newline at end of file