Skip to content

Commit 5160174

Browse files
Merge pull request #311 from petabridge/dev
1.7.2 Release
2 parents aefd4a6 + 51d6bfa commit 5160174

6 files changed

+60
-18
lines changed

RELEASE_NOTES.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#### 1.7.1 October 24 2022 ####
1+
#### 1.7.2 December 20 2022 ####
22

3-
* [Bumped Akka.NET version to 1.4.45](https://github.com/akkadotnet/akka.net/releases/tag/1.4.45)
4-
* [Bumped Akka.Hosting to 0.5.1](https://github.com/akkadotnet/Akka.Hosting/releases/tag/0.5.1).
5-
* [Upgraded to Petabridge.Cmd 1.1.3](https://cmd.petabridge.com/articles/RELEASE_NOTES.html) and used Akka.Hosting support;
3+
* [Bumped Akka.NET version to 1.4.47](https://github.com/akkadotnet/akka.net/releases/tag/1.4.47)
4+
* [Added Serilog logging, configurable by `/app/serilog.json`](https://github.com/petabridge/lighthouse/pull/304)
5+
* [Upgraded to Petabridge.Cmd 1.2.1](https://cmd.petabridge.com/articles/RELEASE_NOTES.html) and used Akka.Hosting support.

src/Lighthouse/Lighthouse.csproj

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66
</PropertyGroup>
77
<ItemGroup>
88
<PackageReference Include="Akka.Cluster.Hosting" Version="0.5.1" />
9-
<PackageReference Include="Microsoft.Extensions.Configuration.Xml" Version="6.0.0" />
9+
<PackageReference Include="Akka.Logger.Serilog" Version="1.4.42" />
10+
<PackageReference Include="Microsoft.Extensions.Configuration.Xml" Version="7.0.0" />
1011
<PackageReference Include="Petabridge.Cmd.Cluster" Version="$(PbmVersion)" />
1112
<PackageReference Include="Petabridge.Cmd.Remote" Version="$(PbmVersion)" />
1213
<PackageReference Include="Akka.Bootstrap.Docker">
1314
<Version>0.5.3</Version>
1415
</PackageReference>
16+
<PackageReference Include="Serilog" Version="2.12.0" />
17+
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
18+
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
1519
</ItemGroup>
1620

1721
<ItemGroup>

src/Lighthouse/LighthouseConfigurator.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Akka.Actor;
1111
using Akka.Bootstrap.Docker;
1212
using Akka.Configuration;
13+
using Serilog;
1314
using static System.String;
1415

1516
namespace Lighthouse
@@ -58,10 +59,10 @@ public static (Config config, string actorSystemName) LaunchLighthouse(string ip
5859
/*
5960
* Sanity check
6061
*/
61-
Console.WriteLine($"[Lighthouse] ActorSystem: {systemName}; IP: {ipAddress}; PORT: {port}");
62-
Console.WriteLine("[Lighthouse] Performing pre-boot sanity check. Should be able to parse address [{0}]",
62+
Log.Logger.Information($"[Lighthouse] ActorSystem: {systemName}; IP: {ipAddress}; PORT: {port}");
63+
Log.Logger.Information("[Lighthouse] Performing pre-boot sanity check. Should be able to parse address [{0}]",
6364
selfAddress);
64-
Console.WriteLine("[Lighthouse] Parse successful.");
65+
Log.Logger.Information("[Lighthouse] Parse successful.");
6566

6667

6768
var seeds = clusterConfig.GetStringList("akka.cluster.seed-nodes").ToList();

src/Lighthouse/Program.cs

+35
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,23 @@
55
// -----------------------------------------------------------------------
66

77
using System;
8+
using System.IO;
89
using System.Threading.Tasks;
910
using Akka.Hosting;
11+
using Microsoft.Extensions.Configuration;
1012
using Microsoft.Extensions.Hosting;
1113
using Petabridge.Cmd.Cluster;
1214
using Petabridge.Cmd.Host;
1315
using Petabridge.Cmd.Remote;
16+
using Serilog;
1417

1518
namespace Lighthouse
1619
{
1720
public class Program
1821
{
1922
public static async Task Main(string[] args)
2023
{
24+
InitializeLogger(args);
2125
var (config, actorSystemName) = LighthouseConfigurator.LaunchLighthouse();
2226
var hostBuilder = new HostBuilder();
2327
hostBuilder.ConfigureServices(services =>
@@ -36,5 +40,36 @@ public static async Task Main(string[] args)
3640
var host = hostBuilder.Build();
3741
await host.RunAsync();
3842
}
43+
44+
private static void InitializeLogger(string[] args)
45+
{
46+
Log.Logger = new LoggerConfiguration()
47+
.MinimumLevel.Debug()
48+
.WriteTo.Console()
49+
.CreateLogger();
50+
51+
Log.Logger.Information("Initializing logging from (serilog.json) configuration");
52+
try
53+
{
54+
55+
var configuration = new ConfigurationBuilder()
56+
.SetBasePath(Directory.GetCurrentDirectory())
57+
.AddJsonFile("serilog.json")
58+
.AddJsonFile($"serilog.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production"}.json", true)
59+
.AddEnvironmentVariables()
60+
.AddCommandLine(args)
61+
.Build();
62+
63+
var configuredLogger = new LoggerConfiguration()
64+
.ReadFrom.Configuration(configuration)
65+
.CreateLogger();
66+
67+
Log.Logger = configuredLogger;
68+
}
69+
catch(Exception ex)
70+
{
71+
Log.Logger.Information("Log configuration failed ({Message}), continuing with default logger", ex.Message);
72+
}
73+
}
3974
}
4075
}

src/Lighthouse/akka.hocon

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
lighthouse{
1+
lighthouse {
22
actorsystem: "actor-system" #POPULATE NAME OF YOUR ACTOR SYSTEM HERE
33
}
44

55
# See petabridge.cmd configuration options here: https://cmd.petabridge.com/articles/install/host-configuration.html
6-
petabridge.cmd{
6+
petabridge.cmd {
77
# default IP address used to listen for incoming petabridge.cmd client connections
88
# should be a safe default as it listens on "all network interfaces".
99
host = "0.0.0.0"
@@ -13,6 +13,8 @@ petabridge.cmd{
1313
}
1414

1515
akka {
16+
loglevel = DEBUG
17+
loggers = ["Akka.Logger.Serilog.SerilogLogger, Akka.Logger.Serilog"]
1618
actor {
1719
provider = cluster
1820

src/common.props

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
<Copyright>Copyright © 2015-2022 Petabridge, LLC</Copyright>
44
<Authors>Petabridge</Authors>
55
<VersionPrefix>1.7.0</VersionPrefix>
6-
<PackageReleaseNotes>[Bumped Akka.NET version to 1.4.40](https://github.com/akkadotnet/akka.net/releases/tag/1.4.40)
7-
[Bumped Akka.Hosting to 0.4.1](https://github.com/akkadotnet/Akka.Hosting/releases/tag/0.4.1).
8-
[Upgraded to Petabridge.Cmd 1.1.0](https://cmd.petabridge.com/articles/RELEASE_NOTES.html) and used Akka.Hosting support;
9-
Added ARM64 support to Docker image `petabridge/lighthouse:latest` and all other Linux images for Lighthouse.
6+
<PackageReleaseNotes>[Bumped Akka.NET version to 1.4.40](https://github.com/akkadotnet/akka.net/releases/tag/1.4.40)
7+
[Bumped Akka.Hosting to 0.4.1](https://github.com/akkadotnet/Akka.Hosting/releases/tag/0.4.1).
8+
[Upgraded to Petabridge.Cmd 1.1.0](https://cmd.petabridge.com/articles/RELEASE_NOTES.html) and used Akka.Hosting support;
9+
Added ARM64 support to Docker image `petabridge/lighthouse:latest` and all other Linux images for Lighthouse.
1010
Migrated onto .NET 6.</PackageReleaseNotes>
1111
<PackageIconUrl>https://petabridge.com/images/logo.png</PackageIconUrl>
1212
<PackageProjectUrl>
@@ -19,13 +19,13 @@ Migrated onto .NET 6.</PackageReleaseNotes>
1919
</PropertyGroup>
2020
<PropertyGroup>
2121
<XunitVersion>2.4.2</XunitVersion>
22-
<MicrosoftSdkVersion>17.3.2</MicrosoftSdkVersion>
22+
<MicrosoftSdkVersion>17.4.1</MicrosoftSdkVersion>
2323
<FluentAssertionsVersion>6.8.0</FluentAssertionsVersion>
2424
<NetCoreVersion>net6.0</NetCoreVersion>
2525
<NetStandardVersion>netstandard1.6</NetStandardVersion>
2626
<NetFrameworkLibVersion>net461</NetFrameworkLibVersion>
2727
<NetFrameworkTestVersion>net6.0</NetFrameworkTestVersion>
28-
<AkkaVersion>1.4.45</AkkaVersion>
29-
<PbmVersion>1.1.3</PbmVersion>
28+
<AkkaVersion>1.4.47</AkkaVersion>
29+
<PbmVersion>1.2.1</PbmVersion>
3030
</PropertyGroup>
31-
</Project>
31+
</Project>

0 commit comments

Comments
 (0)