mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-23 21:16:52 +01:00
Add new API fields for HealthChecks
- Migrate database to these - Deprecate Heartbeat fields
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
namespace Tgstation.Server.Api.Models.Internal
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Tgstation.Server.Api.Models.Internal
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for DreamDaemon API models.
|
||||
@@ -16,5 +19,21 @@
|
||||
/// </summary>
|
||||
[ResponseOptions]
|
||||
public bool? SoftShutdown { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Deprecated, use <see cref="DreamDaemonLaunchParameters.HealthCheckSeconds"/>.
|
||||
/// </summary>
|
||||
[Required]
|
||||
[ResponseOptions]
|
||||
[Obsolete("Use HealthCheckSeconds")]
|
||||
public uint? HeartbeatSeconds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Deprecated, use <see cref="DreamDaemonLaunchParameters.DumpOnHealthCheckRestart"/>.
|
||||
/// </summary>
|
||||
[Required]
|
||||
[ResponseOptions]
|
||||
[Obsolete("Use DumpOnHealthCheckRestart")]
|
||||
public bool? DumpOnHeartbeatRestart { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,14 +59,14 @@ namespace Tgstation.Server.Api.Models.Internal
|
||||
/// </summary>
|
||||
[Required]
|
||||
[ResponseOptions]
|
||||
public uint? HeartbeatSeconds { get; set; }
|
||||
public uint? HealthCheckSeconds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If a process core dump should be created prior to restarting the watchdog due to health check failure.
|
||||
/// </summary>
|
||||
[Required]
|
||||
[ResponseOptions]
|
||||
public bool? DumpOnHeartbeatRestart { get; set; }
|
||||
public bool? DumpOnHealthCheckRestart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The timeout for sending and receiving BYOND topics in milliseconds.
|
||||
|
||||
@@ -74,12 +74,12 @@ namespace Tgstation.Server.Api.Rights
|
||||
SetStartupTimeout = 1 << 11,
|
||||
|
||||
/// <summary>
|
||||
/// User can change <see cref="Models.Internal.DreamDaemonLaunchParameters.HeartbeatSeconds"/>
|
||||
/// User can change <see cref="Models.Internal.DreamDaemonLaunchParameters.HealthCheckSeconds"/>
|
||||
/// </summary>
|
||||
SetHealthCheckInterval = 1 << 12,
|
||||
|
||||
/// <summary>
|
||||
/// User can create DreamDaemon process dumps or change <see cref="Models.Internal.DreamDaemonLaunchParameters.DumpOnHeartbeatRestart"/>.
|
||||
/// User can create DreamDaemon process dumps or change <see cref="Models.Internal.DreamDaemonLaunchParameters.DumpOnHealthCheckRestart"/>.
|
||||
/// </summary>
|
||||
CreateDump = 1 << 13,
|
||||
|
||||
|
||||
@@ -791,7 +791,7 @@ namespace Tgstation.Server.Host.Components.Deployment
|
||||
Visibility = DreamDaemonVisibility.Invisible,
|
||||
StartupTimeout = timeout,
|
||||
TopicRequestTimeout = 0, // not used
|
||||
HeartbeatSeconds = 0, // not used
|
||||
HealthCheckSeconds = 0, // not used
|
||||
StartProfiler = false,
|
||||
LogOutput = logOutput,
|
||||
};
|
||||
|
||||
@@ -847,7 +847,7 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
|
||||
UpdateMonitoredTasks();
|
||||
|
||||
var healthCheckSeconds = ActiveLaunchParameters.HeartbeatSeconds.Value;
|
||||
var healthCheckSeconds = ActiveLaunchParameters.HealthCheckSeconds.Value;
|
||||
var healthCheck = healthCheckSeconds == 0
|
||||
|| !controller.DMApiAvailable
|
||||
? Extensions.TaskExtensions.InfiniteTask
|
||||
@@ -1073,13 +1073,13 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
actionTaken,
|
||||
StringComparison.Ordinal));
|
||||
|
||||
if (ActiveLaunchParameters.DumpOnHeartbeatRestart.Value)
|
||||
if (ActiveLaunchParameters.DumpOnHealthCheckRestart.Value)
|
||||
{
|
||||
Logger.LogDebug("DumpOnHeartbeatRestart enabled.");
|
||||
Logger.LogDebug("DumpOnHealthCheckRestart enabled.");
|
||||
await CreateDump(cancellationToken);
|
||||
}
|
||||
else
|
||||
Logger.LogTrace("DumpOnHeartbeatRestart disabled.");
|
||||
Logger.LogTrace("DumpOnHealthCheckRestart disabled.");
|
||||
|
||||
await DisposeAndNullControllers(cancellationToken);
|
||||
return shouldShutdown ? MonitorAction.Exit : MonitorAction.Restart;
|
||||
|
||||
@@ -186,6 +186,14 @@ namespace Tgstation.Server.Host.Controllers
|
||||
return Conflict(new ErrorMessageResponse(ErrorCode.PortNotAvailable));
|
||||
}
|
||||
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
if (model.HeartbeatSeconds.HasValue && !model.HealthCheckSeconds.HasValue)
|
||||
model.HealthCheckSeconds = model.HeartbeatSeconds;
|
||||
|
||||
if (model.DumpOnHeartbeatRestart.HasValue && !model.DumpOnHealthCheckRestart.HasValue)
|
||||
model.DumpOnHealthCheckRestart = model.DumpOnHeartbeatRestart;
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
var userRights = (DreamDaemonRights)AuthenticationContext.GetRight(RightsType.DreamDaemon);
|
||||
|
||||
bool CheckModified<T>(Expression<Func<Api.Models.Internal.DreamDaemonSettings, T>> expression, DreamDaemonRights requiredRight)
|
||||
@@ -219,8 +227,8 @@ namespace Tgstation.Server.Host.Controllers
|
||||
|| (model.SoftRestart.HasValue && !AuthenticationContext.InstancePermissionSet.DreamDaemonRights.Value.HasFlag(DreamDaemonRights.SoftRestart))
|
||||
|| (model.SoftShutdown.HasValue && !AuthenticationContext.InstancePermissionSet.DreamDaemonRights.Value.HasFlag(DreamDaemonRights.SoftShutdown))
|
||||
|| CheckModified(x => x.StartupTimeout, DreamDaemonRights.SetStartupTimeout)
|
||||
|| CheckModified(x => x.HeartbeatSeconds, DreamDaemonRights.SetHealthCheckInterval)
|
||||
|| CheckModified(x => x.DumpOnHeartbeatRestart, DreamDaemonRights.CreateDump)
|
||||
|| CheckModified(x => x.HealthCheckSeconds, DreamDaemonRights.SetHealthCheckInterval)
|
||||
|| CheckModified(x => x.DumpOnHealthCheckRestart, DreamDaemonRights.CreateDump)
|
||||
|| CheckModified(x => x.TopicRequestTimeout, DreamDaemonRights.SetTopicTimeout)
|
||||
|| CheckModified(x => x.AdditionalParameters, DreamDaemonRights.SetAdditionalParameters)
|
||||
|| CheckModified(x => x.StartProfiler, DreamDaemonRights.SetProfiler)
|
||||
@@ -356,8 +364,12 @@ namespace Tgstation.Server.Host.Controllers
|
||||
result.SoftRestart = rstate == RebootState.Restart;
|
||||
result.SoftShutdown = rstate == RebootState.Shutdown;
|
||||
result.StartupTimeout = settings.StartupTimeout.Value;
|
||||
result.HeartbeatSeconds = settings.HeartbeatSeconds.Value;
|
||||
result.DumpOnHeartbeatRestart = settings.DumpOnHeartbeatRestart.Value;
|
||||
result.HealthCheckSeconds = settings.HealthCheckSeconds.Value;
|
||||
result.DumpOnHealthCheckRestart = settings.DumpOnHealthCheckRestart.Value;
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
result.HeartbeatSeconds = settings.HealthCheckSeconds.Value;
|
||||
result.DumpOnHeartbeatRestart = settings.DumpOnHealthCheckRestart.Value;
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
result.TopicRequestTimeout = settings.TopicRequestTimeout.Value;
|
||||
result.AdditionalParameters = settings.AdditionalParameters;
|
||||
result.StartProfiler = settings.StartProfiler;
|
||||
|
||||
@@ -710,8 +710,8 @@ namespace Tgstation.Server.Host.Controllers
|
||||
SecurityLevel = DreamDaemonSecurity.Safe,
|
||||
Visibility = DreamDaemonVisibility.Public,
|
||||
StartupTimeout = 60,
|
||||
HeartbeatSeconds = 60,
|
||||
DumpOnHeartbeatRestart = false,
|
||||
HealthCheckSeconds = 60,
|
||||
DumpOnHealthCheckRestart = false,
|
||||
TopicRequestTimeout = generalConfiguration.ByondTopicTimeout,
|
||||
AdditionalParameters = String.Empty,
|
||||
StartProfiler = false,
|
||||
|
||||
@@ -377,22 +377,22 @@ namespace Tgstation.Server.Host.Database
|
||||
/// <summary>
|
||||
/// Used by unit tests to remind us to setup the correct MSSQL migration downgrades.
|
||||
/// </summary>
|
||||
internal static readonly Type MSLatestMigration = typeof(MSAddSystemChannels);
|
||||
internal static readonly Type MSLatestMigration = typeof(MSRenameHeartbeatsToHealthChecks);
|
||||
|
||||
/// <summary>
|
||||
/// Used by unit tests to remind us to setup the correct MYSQL migration downgrades.
|
||||
/// </summary>
|
||||
internal static readonly Type MYLatestMigration = typeof(MYAddSystemChannels);
|
||||
internal static readonly Type MYLatestMigration = typeof(MYRenameHeartbeatsToHealthChecks);
|
||||
|
||||
/// <summary>
|
||||
/// Used by unit tests to remind us to setup the correct PostgresSQL migration downgrades.
|
||||
/// </summary>
|
||||
internal static readonly Type PGLatestMigration = typeof(PGAddSystemChannels);
|
||||
internal static readonly Type PGLatestMigration = typeof(PGRenameHeartbeatsToHealthChecks);
|
||||
|
||||
/// <summary>
|
||||
/// Used by unit tests to remind us to setup the correct SQLite migration downgrades.
|
||||
/// </summary>
|
||||
internal static readonly Type SLLatestMigration = typeof(SLAddSystemChannels);
|
||||
internal static readonly Type SLLatestMigration = typeof(SLRenameHeartbeatsToHealthChecks);
|
||||
|
||||
/// <inheritdoc />
|
||||
#pragma warning disable CA1502 // Cyclomatic complexity
|
||||
|
||||
+1071
File diff suppressed because it is too large
Load Diff
+46
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
/// <summary>
|
||||
/// Renames the Heatbeat DreamDaemonSettings to HealthCheck for MSSQL.
|
||||
/// </summary>
|
||||
public partial class MSRenameHeartbeatsToHealthChecks : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(migrationBuilder);
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "HeartbeatSeconds",
|
||||
table: "DreamDaemonSettings",
|
||||
newName: "HealthCheckSeconds");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "DumpOnHeartbeatRestart",
|
||||
table: "DreamDaemonSettings",
|
||||
newName: "DumpOnHealthCheckRestart");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(migrationBuilder);
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "HealthCheckSeconds",
|
||||
table: "DreamDaemonSettings",
|
||||
newName: "HeartbeatSeconds");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "DumpOnHealthCheckRestart",
|
||||
table: "DreamDaemonSettings",
|
||||
newName: "DumpOnHeartbeatRestart");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1104
File diff suppressed because it is too large
Load Diff
+46
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
/// <summary>
|
||||
/// Renames the Heatbeat DreamDaemonSettings to HealthCheck for MYSQL.
|
||||
/// </summary>
|
||||
public partial class MYRenameHeartbeatsToHealthChecks : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(migrationBuilder);
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "HeartbeatSeconds",
|
||||
table: "DreamDaemonSettings",
|
||||
newName: "HealthCheckSeconds");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "DumpOnHeartbeatRestart",
|
||||
table: "DreamDaemonSettings",
|
||||
newName: "DumpOnHealthCheckRestart");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(migrationBuilder);
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "HealthCheckSeconds",
|
||||
table: "DreamDaemonSettings",
|
||||
newName: "HeartbeatSeconds");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "DumpOnHealthCheckRestart",
|
||||
table: "DreamDaemonSettings",
|
||||
newName: "DumpOnHeartbeatRestart");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1065
File diff suppressed because it is too large
Load Diff
+46
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
/// <summary>
|
||||
/// Renames the Heatbeat DreamDaemonSettings to HealthCheck for PostgresSQL.
|
||||
/// </summary>
|
||||
public partial class PGRenameHeartbeatsToHealthChecks : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(migrationBuilder);
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "HeartbeatSeconds",
|
||||
table: "DreamDaemonSettings",
|
||||
newName: "HealthCheckSeconds");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "DumpOnHeartbeatRestart",
|
||||
table: "DreamDaemonSettings",
|
||||
newName: "DumpOnHealthCheckRestart");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(migrationBuilder);
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "HealthCheckSeconds",
|
||||
table: "DreamDaemonSettings",
|
||||
newName: "HeartbeatSeconds");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "DumpOnHealthCheckRestart",
|
||||
table: "DreamDaemonSettings",
|
||||
newName: "DumpOnHeartbeatRestart");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1036
File diff suppressed because it is too large
Load Diff
+46
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
/// <summary>
|
||||
/// Renames the Heatbeat DreamDaemonSettings to HealthCheck for SQLite.
|
||||
/// </summary>
|
||||
public partial class SLRenameHeartbeatsToHealthChecks : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(migrationBuilder);
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "HeartbeatSeconds",
|
||||
table: "DreamDaemonSettings",
|
||||
newName: "HealthCheckSeconds");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "DumpOnHeartbeatRestart",
|
||||
table: "DreamDaemonSettings",
|
||||
newName: "DumpOnHealthCheckRestart");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(migrationBuilder);
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "HealthCheckSeconds",
|
||||
table: "DreamDaemonSettings",
|
||||
newName: "HeartbeatSeconds");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "DumpOnHealthCheckRestart",
|
||||
table: "DreamDaemonSettings",
|
||||
newName: "DumpOnHeartbeatRestart");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.16")
|
||||
.HasAnnotation("ProductVersion", "7.0.7")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatBot", b =>
|
||||
@@ -203,11 +203,11 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool?>("DumpOnHeartbeatRestart")
|
||||
b.Property<bool?>("DumpOnHealthCheckRestart")
|
||||
.IsRequired()
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<uint?>("HeartbeatSeconds")
|
||||
b.Property<uint?>("HealthCheckSeconds")
|
||||
.IsRequired()
|
||||
.HasColumnType("int unsigned");
|
||||
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.16")
|
||||
.HasAnnotation("ProductVersion", "7.0.7")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
@@ -195,11 +195,11 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool?>("DumpOnHeartbeatRestart")
|
||||
b.Property<bool?>("DumpOnHealthCheckRestart")
|
||||
.IsRequired()
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<long>("HeartbeatSeconds")
|
||||
b.Property<long>("HealthCheckSeconds")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
|
||||
+21
-21
@@ -16,10 +16,10 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.16")
|
||||
.HasAnnotation("ProductVersion", "7.0.7")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatBot", b =>
|
||||
{
|
||||
@@ -27,7 +27,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long?>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<int>("ChannelLimit")
|
||||
.HasColumnType("int");
|
||||
@@ -68,7 +68,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<long>("ChatSettingsId")
|
||||
.HasColumnType("bigint");
|
||||
@@ -119,7 +119,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long?>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("ByondVersion")
|
||||
.IsRequired()
|
||||
@@ -182,7 +182,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("AdditionalParameters")
|
||||
.IsRequired()
|
||||
@@ -197,11 +197,11 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool?>("DumpOnHeartbeatRestart")
|
||||
b.Property<bool?>("DumpOnHealthCheckRestart")
|
||||
.IsRequired()
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<long>("HeartbeatSeconds")
|
||||
b.Property<long>("HealthCheckSeconds")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
@@ -244,7 +244,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<int>("ApiValidationPort")
|
||||
.HasColumnType("int");
|
||||
@@ -281,7 +281,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long?>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<long>("AutoUpdateInterval")
|
||||
.HasColumnType("bigint");
|
||||
@@ -323,7 +323,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<decimal>("ByondRights")
|
||||
.HasColumnType("decimal(20,0)");
|
||||
@@ -368,7 +368,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long?>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<decimal?>("CancelRight")
|
||||
.HasColumnType("decimal(20,0)");
|
||||
@@ -423,7 +423,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("ExternalUserId")
|
||||
.IsRequired()
|
||||
@@ -452,7 +452,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long?>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<decimal>("AdministrationRights")
|
||||
.HasColumnType("decimal(20,0)");
|
||||
@@ -485,7 +485,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("AccessIdentifier")
|
||||
.IsRequired()
|
||||
@@ -527,7 +527,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("AccessToken")
|
||||
.HasMaxLength(10000)
|
||||
@@ -592,7 +592,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<long>("RevisionInformationId")
|
||||
.HasColumnType("bigint");
|
||||
@@ -615,7 +615,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("CommitSha")
|
||||
.IsRequired()
|
||||
@@ -647,7 +647,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Author")
|
||||
.IsRequired()
|
||||
@@ -703,7 +703,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long?>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("CanonicalName")
|
||||
.IsRequired()
|
||||
@@ -761,7 +761,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long?>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long?>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "6.0.16");
|
||||
modelBuilder.HasAnnotation("ProductVersion", "7.0.7");
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatBot", b =>
|
||||
{
|
||||
@@ -185,11 +185,11 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool?>("DumpOnHeartbeatRestart")
|
||||
b.Property<bool?>("DumpOnHealthCheckRestart")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint?>("HeartbeatSeconds")
|
||||
b.Property<uint?>("HealthCheckSeconds")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
@@ -62,7 +63,7 @@ namespace Tgstation.Server.Tests.Live.Instance
|
||||
instanceClient.DreamDaemon.Update(new DreamDaemonRequest
|
||||
{
|
||||
StartupTimeout = 15,
|
||||
HeartbeatSeconds = 0,
|
||||
HealthCheckSeconds = 0,
|
||||
Port = TestLiveServer.DDPort,
|
||||
LogOutput = false,
|
||||
}, cancellationToken),
|
||||
@@ -370,13 +371,26 @@ namespace Tgstation.Server.Tests.Live.Instance
|
||||
async Task RunHealthCheckTest(bool checkDump, CancellationToken cancellationToken)
|
||||
{
|
||||
System.Console.WriteLine("TEST: WATCHDOG HEALTH CHECK TEST");
|
||||
// enable health checks
|
||||
await instanceClient.DreamDaemon.Update(new DreamDaemonRequest
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
// Check reverse mapping
|
||||
var status = await instanceClient.DreamDaemon.Update(new DreamDaemonRequest
|
||||
{
|
||||
HeartbeatSeconds = 1,
|
||||
DumpOnHealthCheckRestart = !checkDump,
|
||||
}, cancellationToken);
|
||||
|
||||
Assert.AreEqual(!checkDump, status.DumpOnHeartbeatRestart);
|
||||
|
||||
// enable health checks
|
||||
status = await instanceClient.DreamDaemon.Update(new DreamDaemonRequest
|
||||
{
|
||||
HealthCheckSeconds = 1,
|
||||
DumpOnHeartbeatRestart = checkDump,
|
||||
}, cancellationToken);
|
||||
|
||||
Assert.AreEqual(checkDump, status.DumpOnHeartbeatRestart);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
Assert.AreEqual(checkDump, status.DumpOnHealthCheckRestart);
|
||||
|
||||
var startJob = await StartDD(cancellationToken);
|
||||
|
||||
await WaitForJob(startJob, 40, false, null, cancellationToken);
|
||||
@@ -426,10 +440,13 @@ namespace Tgstation.Server.Tests.Live.Instance
|
||||
await Task.WhenAny(ourProcessHandler.Lifetime, Task.Delay(TimeSpan.FromMinutes(1), cancellationToken));
|
||||
|
||||
var timeout = 20;
|
||||
DreamDaemonResponse ddStatus;
|
||||
do
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken);
|
||||
var ddStatus = await instanceClient.DreamDaemon.Read(cancellationToken);
|
||||
ddStatus = await instanceClient.DreamDaemon.Read(cancellationToken);
|
||||
Assert.AreEqual(1U, ddStatus.HealthCheckSeconds.Value);
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
Assert.AreEqual(1U, ddStatus.HeartbeatSeconds.Value);
|
||||
if (ddStatus.Status.Value == WatchdogStatus.Offline)
|
||||
{
|
||||
@@ -443,10 +460,13 @@ namespace Tgstation.Server.Tests.Live.Instance
|
||||
while (timeout > 0);
|
||||
|
||||
// disable health checks
|
||||
await instanceClient.DreamDaemon.Update(new DreamDaemonRequest
|
||||
ddStatus = await instanceClient.DreamDaemon.Update(new DreamDaemonRequest
|
||||
{
|
||||
HeartbeatSeconds = 0,
|
||||
}, cancellationToken);
|
||||
Assert.AreEqual(0U, ddStatus.HealthCheckSeconds.Value);
|
||||
Assert.AreEqual(0U, ddStatus.HeartbeatSeconds.Value);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
if (checkDump)
|
||||
{
|
||||
|
||||
@@ -110,8 +110,8 @@ namespace Tgstation.Server.Tests
|
||||
{
|
||||
AllowWebClient = false,
|
||||
AutoStart = false,
|
||||
HeartbeatSeconds = 0,
|
||||
DumpOnHeartbeatRestart = false,
|
||||
HealthCheckSeconds = 0,
|
||||
DumpOnHealthCheckRestart = false,
|
||||
Port = 1447,
|
||||
SecurityLevel = DreamDaemonSecurity.Safe,
|
||||
Visibility = DreamDaemonVisibility.Public,
|
||||
|
||||
Reference in New Issue
Block a user