Skip to content

Commit

Permalink
Some fixes for distributed deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
sven-n committed Nov 23, 2023
1 parent f66ff9c commit 11a6f01
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 11 deletions.
2 changes: 1 addition & 1 deletion deploy/all-in-one/nginx.dev.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ http {
resolver 127.0.0.11 ipv6=off;

location / {
proxy_pass http://openmu-startup;
proxy_pass http://openmu-startup:8080;
}
}
}
2 changes: 1 addition & 1 deletion deploy/distributed/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
- prometheus

grafana:
image: grafana/grafana:latest
image: grafana/grafana:9.5.14
container_name: grafana
volumes:
- ./grafana.ini:/etc/grafana/grafana.ini
Expand Down
6 changes: 3 additions & 3 deletions deploy/distributed/nginx.dev.conf
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ http {
}

location ~ (/admin)(.*) {
proxy_pass http://adminPanel/admin$2;
proxy_pass http://adminPanel:8080/admin$2;
}

# Public API
location ~ (/serverInfo)(.*) {
proxy_pass http://connectServer/serverInfo$2;
proxy_pass http://connectServer:8080/serverInfo$2;
auth_basic off;
}

# Game Servers:
location ~ (/gameServer/(\d+)(.*)) {
proxy_pass http://gameServer$2$1;
proxy_pass http://gameServer$2:8080$1;
}
}
}
2 changes: 1 addition & 1 deletion deploy/distributed/nginx.prod443.conf
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ http {

# Game Servers:
location ~ (/gameServer/(\d+)(.*)) {
proxy_pass http://gameServer:8080$2$1;
proxy_pass http://gameServer$2:8080$1;
}
}
}
6 changes: 6 additions & 0 deletions src/Dapr/AdminPanel.Host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>

using Microsoft.AspNetCore.Builder;
using MUnique.OpenMU.Dapr.Common;
using MUnique.OpenMU.PlugIns;
using MUnique.OpenMU.Web.AdminPanel;
Expand All @@ -18,7 +19,12 @@

builder.AddAdminPanel();

var metricsRegistry = new MetricsRegistry();
// todo: add some meaningful metrics
builder.AddOpenTelemetryMetrics(metricsRegistry);

var app = builder.BuildAndConfigure(true);
app.UseStaticFiles();

await app.WaitForDatabaseConnectionInitializationAsync().ConfigureAwait(false);

Expand Down
2 changes: 1 addition & 1 deletion src/Dapr/Common/DaprService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static WebApplicationBuilder CreateBuilder(string serviceName, string[] a
{
var builder = WebApplication.CreateBuilder(args);

builder.WebHost.UseUrls($"http://*:80");
builder.WebHost.UseUrls($"http://*:8080");

var services = builder.Services;
services.AddControllers();
Expand Down
6 changes: 5 additions & 1 deletion src/Dapr/Common/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,11 @@ public static WebApplication ConfigureDaprService(this WebApplication app, bool

if (addBlazor)
{
if (!app.Environment.IsDevelopment())
if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
}
Expand Down
4 changes: 4 additions & 0 deletions src/Dapr/FriendServer.Host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
.AddSingleton<IFriendNotifier, FriendNotifier>()
.AddPeristenceProvider();

var metricsRegistry = new MetricsRegistry();
// todo: add some meaningful metrics
builder.AddOpenTelemetryMetrics(metricsRegistry);

var app = builder.BuildAndConfigure();

await app.WaitForUpdatedDatabaseAsync().ConfigureAwait(false);
Expand Down
3 changes: 2 additions & 1 deletion src/Dapr/GameServer.Host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>

using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using MUnique.OpenMU.Dapr.Common;
using MUnique.OpenMU.DataModel.Configuration;
Expand Down Expand Up @@ -53,7 +54,7 @@
builder.AddOpenTelemetryMetrics(metricsRegistry);

var app = builder.BuildAndConfigure(true);

app.UseStaticFiles();
await app.WaitForUpdatedDatabaseAsync().ConfigureAwait(false);

await app.Services.TryLoadPlugInConfigurationsAsync(plugInConfigurations).ConfigureAwait(false);
Expand Down
4 changes: 4 additions & 0 deletions src/Dapr/GuildServer.Host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
.AddSingleton<IGuildChangePublisher, GuildChangePublisher>()
.AddPeristenceProvider();

var metricsRegistry = new MetricsRegistry();
// todo: add some meaningful metrics
builder.AddOpenTelemetryMetrics(metricsRegistry);

var app = builder.BuildAndConfigure();
await app.WaitForUpdatedDatabaseAsync().ConfigureAwait(false);

Expand Down
4 changes: 4 additions & 0 deletions src/Dapr/LoginServer.Host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
.AddHostedService<LoginStateCleanup>()
.AddSingleton<GameServerRegistry>();

var metricsRegistry = new MetricsRegistry();
// todo: add some meaningful metrics
builder.AddOpenTelemetryMetrics(metricsRegistry);

var app = builder.BuildAndConfigure();

app.Run();
6 changes: 5 additions & 1 deletion src/Web/AdminPanel/WebApplicationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ public static WebApplicationBuilder AddAdminPanel(this WebApplicationBuilder bui
/// <returns>The configured web application.</returns>
public static WebApplication ConfigureAdminPanel(this WebApplication app)
{
if (!app.Environment.IsDevelopment())
if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
}
Expand Down
6 changes: 5 additions & 1 deletion src/Web/Map/MapApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ public async Task StartAsync(CancellationToken cancellationToken)
app.Configuration["urls"] = $"http://*:{port}";

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
}
Expand Down

0 comments on commit 11a6f01

Please sign in to comment.