Skip to content

Commit

Permalink
Merge pull request #1721 from tgstation/ActuallyLogSomethingUseful [T…
Browse files Browse the repository at this point in the history
…GSDeploy]

v5.18.1: Add `X-Accel-Buffering: no`
  • Loading branch information
Cyberboss authored Nov 18, 2023
2 parents 47f5c55 + bd6fbd2 commit 860ba8c
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ System administrators will most likely have their own configuration plans, but h

Once complete, test that your configuration worked by visiting your proxy site from a browser on a different computer. You should recieve a 401 Unauthorized response.

_NOTE: For SignalR to function properly, make sure your reverse proxy setup supports SSE (Server-Sent Events)_
_NOTE: Your reverse proxy setup may interfere with SSE (Server-Sent Events) which is used for real-time job updates. If you find this to be the case, please open an issue describing what you did to fix it as there may be a way for us to bypass the need for a workaround from our end._

#### IIS (Reccommended for Windows)

Expand Down
2 changes: 1 addition & 1 deletion build/Version.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- Integration tests will ensure they match across the board -->
<Import Project="WebpanelVersion.props" />
<PropertyGroup>
<TgsCoreVersion>5.18.0</TgsCoreVersion>
<TgsCoreVersion>5.18.1</TgsCoreVersion>
<TgsConfigVersion>4.7.1</TgsConfigVersion>
<TgsApiVersion>9.14.0</TgsApiVersion>
<TgsCommonLibraryVersion>7.0.0</TgsCommonLibraryVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ async Task CleanupLingeringDeployment()
else
Logger.LogTrace("Nothing to do as pendingSwappable is null.");

return MonitorAction.Continue;
return await base.HandleNormalReboot(cancellationToken);
}

/// <inheritdoc />
Expand Down
3 changes: 3 additions & 0 deletions src/Tgstation.Server.Host/Core/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,9 @@ public void Configure(
// Add the X-Powered-By response header
applicationBuilder.UseServerBranding(assemblyInformationProvider);

// Add the X-Accel-Buffering response header
applicationBuilder.UseDisabledNginxProxyBuffering();

// suppress OperationCancelledExceptions, they are just aborted HTTP requests
applicationBuilder.UseCancelledRequestSuppression();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,27 @@ public static void UseServerBranding(this IApplicationBuilder applicationBuilder
ArgumentNullException.ThrowIfNull(applicationBuilder);
ArgumentNullException.ThrowIfNull(assemblyInformationProvider);

applicationBuilder.Use(async (context, next) =>
applicationBuilder.Use((context, next) =>
{
context.Response.Headers.Add("X-Powered-By", assemblyInformationProvider.VersionPrefix);
await next();
return next();
});
}

/// <summary>
/// Add the X-Accel-Buffering response header.
/// </summary>
/// <param name="applicationBuilder">The <see cref="IApplicationBuilder"/> to configure.</param>
/// <remarks>This is used to avoid interruption to SignalR streams by Nginx.</remarks>
public static void UseDisabledNginxProxyBuffering(this IApplicationBuilder applicationBuilder)
{
ArgumentNullException.ThrowIfNull(applicationBuilder);

// https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/#x-accel-buffering
applicationBuilder.Use((context, next) =>
{
context.Response.Headers.Add("X-Accel-Buffering", "no");
return next();
});
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Tgstation.Server.Tests/Live/HardFailLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
&& !(logMessage.StartsWith("An exception occurred in the database while saving changes for context type") && (exception is OperationCanceledException || exception?.InnerException is OperationCanceledException)))
|| (logLevel == LogLevel.Critical && logMessage != "DropDatabase configuration option set! Dropping any existing database..."))
{
failureSink(new AssertFailedException("TGS logged an unexpected error!"));
failureSink(new AssertFailedException($"TGS ERR: {logMessage}"));
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions tools/Tgstation.Server.ReleaseNotes/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,12 @@ static string GenerateComponentNotes(ReleaseNotes releaseNotes, Component compon
PrintChanges(newNotes, relevantChangelog);
}

if(component == Component.DreamMakerApi)
{
newNotes.AppendLine();
newNotes.AppendLine("#tgs-dmapi-release");
}

var markdown = newNotes.ToString();
return markdown;
}
Expand Down

0 comments on commit 860ba8c

Please sign in to comment.