Browse Source

Unify config.

pull/883/head
Sebastian 4 years ago
parent
commit
15077e97ab
  1. 5
      Dockerfile
  2. 6
      backend/src/Squidex.Infrastructure/Diagnostics/Diagnoser.cs
  3. 4
      backend/src/Squidex.Infrastructure/Diagnostics/DiagnoserOptions.cs
  4. 2
      backend/src/Squidex.Infrastructure/Diagnostics/GCHealthCheck.cs
  5. 2
      backend/src/Squidex.Infrastructure/Diagnostics/GCHealthCheckOptions.cs
  6. 2
      backend/src/Squidex/Config/Domain/HealthCheckServices.cs
  7. 16
      backend/src/Squidex/appsettings.json

5
Dockerfile

@ -83,13 +83,12 @@ COPY --from=backend /tools .
# Default app directory # Default app directory
WORKDIR /app WORKDIR /app
# Copy backend files # Copy from build stages
COPY --from=backend /build/ . COPY --from=backend /build/ .
# Copy frontend files to backend folder.
COPY --from=frontend /build/ wwwroot/build/ COPY --from=frontend /build/ wwwroot/build/
EXPOSE 80 EXPOSE 80
EXPOSE 443
EXPOSE 11111 EXPOSE 11111
ENV DIAGNOSTICS__COUNTERSTOOL=/tools/dotnet-counters ENV DIAGNOSTICS__COUNTERSTOOL=/tools/dotnet-counters

6
backend/src/Squidex.Infrastructure/Diagnostics/Diagnoser.cs

@ -32,7 +32,7 @@ namespace Squidex.Infrastructure.Diagnostics
public Task InitializeAsync( public Task InitializeAsync(
CancellationToken ct) CancellationToken ct)
{ {
if (options.DumpTrigger > 0 || options.GCDumpTrigger > 0) if (options.DumpTriggerInMB > 0 || options.GCDumpTriggerInMB > 0)
{ {
timer = new Timer(CollectDump); timer = new Timer(CollectDump);
timer.Change(TimeSpan.Zero, TimeSpan.FromSeconds(5)); timer.Change(TimeSpan.Zero, TimeSpan.FromSeconds(5));
@ -70,12 +70,12 @@ namespace Squidex.Infrastructure.Diagnostics
{ {
var workingSet = Process.GetCurrentProcess().WorkingSet64 / (1024 * 1024); var workingSet = Process.GetCurrentProcess().WorkingSet64 / (1024 * 1024);
if (options.DumpTrigger > 0 && workingSet > options.DumpTrigger && scheduledDumpTask == null) if (options.DumpTriggerInMB > 0 && workingSet > options.DumpTriggerInMB && scheduledDumpTask == null)
{ {
scheduledDumpTask = CreateDumpAsync(); scheduledDumpTask = CreateDumpAsync();
} }
if (options.GCDumpTrigger > 0 && workingSet > options.GCDumpTrigger && scheduledGcDumpTask == null) if (options.GCDumpTriggerInMB > 0 && workingSet > options.GCDumpTriggerInMB && scheduledGcDumpTask == null)
{ {
scheduledGcDumpTask = CreateGCDumpAsync(); scheduledGcDumpTask = CreateGCDumpAsync();
} }

4
backend/src/Squidex.Infrastructure/Diagnostics/DiagnoserOptions.cs

@ -13,8 +13,8 @@ namespace Squidex.Infrastructure.Diagnostics
public string? DumpTool { get; set; } public string? DumpTool { get; set; }
public int GCDumpTrigger { get; set; } public int GCDumpTriggerInMB { get; set; }
public int DumpTrigger { get; set; } public int DumpTriggerInMB { get; set; }
} }
} }

2
backend/src/Squidex.Infrastructure/Diagnostics/GCHealthCheck.cs

@ -17,7 +17,7 @@ namespace Squidex.Infrastructure.Diagnostics
public GCHealthCheck(IOptions<GCHealthCheckOptions> options) public GCHealthCheck(IOptions<GCHealthCheckOptions> options)
{ {
threshold = 1024 * 1024 * options.Value.Threshold; threshold = 1024 * 1024 * options.Value.ThresholdInMB;
} }
public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context,

2
backend/src/Squidex.Infrastructure/Diagnostics/GCHealthCheckOptions.cs

@ -9,6 +9,6 @@ namespace Squidex.Infrastructure.Diagnostics
{ {
public sealed class GCHealthCheckOptions public sealed class GCHealthCheckOptions
{ {
public long Threshold { get; set; } = 4 * 1024L; public long ThresholdInMB { get; set; } = 8192;
} }
} }

2
backend/src/Squidex/Config/Domain/HealthCheckServices.cs

@ -16,7 +16,7 @@ namespace Squidex.Config.Domain
public static void AddSquidexHealthChecks(this IServiceCollection services, IConfiguration config) public static void AddSquidexHealthChecks(this IServiceCollection services, IConfiguration config)
{ {
services.Configure<GCHealthCheckOptions>(config, services.Configure<GCHealthCheckOptions>(config,
"healthz:gc"); "diagnostics:gc");
services.AddHealthChecks() services.AddHealthChecks()
.AddCheck<GCHealthCheck>("GC", tags: new[] { "node" }) .AddCheck<GCHealthCheck>("GC", tags: new[] { "node" })

16
backend/src/Squidex/appsettings.json

@ -204,13 +204,6 @@
"text": "User-agent: *\nAllow: /api/assets/*" "text": "User-agent: *\nAllow: /api/assets/*"
}, },
"healthz": {
"gc": {
// The maximum number of megabyte that the process can consume until it is marked as not healthy.
"threshold": 4096
}
},
"apps": { "apps": {
// True to delete apps permanently. // True to delete apps permanently.
// //
@ -326,7 +319,7 @@
"dumpTool": "", "dumpTool": "",
// When more memory is allocated that the defined value (in MB) a dump will be created once automatically and written to the asset store. // When more memory is allocated that the defined value (in MB) a dump will be created once automatically and written to the asset store.
"dumpTrigger": 0, "dumpTriggerInMB": 0,
// The path to the dotnet-gcdump tool binary. // The path to the dotnet-gcdump tool binary.
// //
@ -334,7 +327,12 @@
"gcdumpTool": "", "gcdumpTool": "",
// When more memory is allocated than the defined value (in MB) a gcdump will be created once automatically and written to the asset store. // When more memory is allocated than the defined value (in MB) a gcdump will be created once automatically and written to the asset store.
"gcumpTrigger": 0 "gcumpTriggerInMB": 0,
"gc": {
// The maximum number of megabyte that the process can consume until it is marked as not healthy.
"threshold": 8192
}
}, },
"assetStore": { "assetStore": {

Loading…
Cancel
Save