Skip to content

Commit 81cb031

Browse files
Merge pull request #255 from petabridge/dev
v1.6.0 Release
2 parents 4f75b2a + b5cc87a commit 81cb031

11 files changed

+113
-168
lines changed

README.md

-3
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ services:
6969
AKKA__CLUSTER__SPLIT_BRAIN_RESOLVER__ACTIVE_STRATEGY: "keep-majority"
7070
```
7171

72-
### Running in .NET Framework
73-
You can still run Lighthouse under .NET Framework 4.6.1 if you wish. Clone this repository and build the project. Lighthouse will run as a [Topshelf Windows Service](http://topshelf-project.com/) and can be installed as such.
74-
7572
### Examples of Lighthouse in the Wild
7673
Looking for some complete examples of how to use Lighthouse? Here's some:
7774

RELEASE_NOTES.md

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
#### 1.5.5 June 16 2021 ####
2-
* Upgrade [Akka.Bootstrap.Docker to 0.5.3](https://github.com/petabridge/akkadotnet-bootstrap/releases/tag/0.5.3)
1+
#### 1.6.0 April 18 2022 ####
32

4-
#### 1.5.4 June 16 2021 ####
5-
* Upgraded to [Akka.NET v1.4.21](https://github.com/akkadotnet/akka.net/releases/tag/1.4.21)
6-
7-
#### 1.5.3 May 10 2021 ####
8-
* Upgraded to [Akka.NET v1.4.19](https://github.com/akkadotnet/akka.net/releases/tag/1.4.19)
9-
* Upgraded to [Petabridge.Cmd v0.8.5](https://cmd.petabridge.com/articles/RELEASE_NOTES.html#085-may-03-2021)
3+
* Dropped Topshelf support
4+
* Migrated to [Akka.Hosting](https://github.com/akkadotnet/Akka.Hosting) and `IHostedService`
5+
* Significantly reduced idle CPU consumption by migrating to [`channel-executor` for dispatching](https://getakka.net/articles/actors/dispatchers.html#channelexecutor).

build-system/linux-pr-validation.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ jobs:
1717
- template: azure-pipeline.template.yaml
1818
parameters:
1919
name: Ubuntu
20-
vmImage: 'ubuntu-16.04'
20+
vmImage: 'ubuntu-20.04'
2121
scriptFileName: ./build.sh
22-
scriptArgs: all
22+
scriptArgs: all

src/Lighthouse/Lighthouse.csproj

+4-12
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,21 @@
22
<Import Project="..\common.props" />
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>$(NetCoreVersion);$(NetFrameworkLibVersion)</TargetFrameworks>
5+
<TargetFrameworks>$(NetCoreVersion)</TargetFrameworks>
66
</PropertyGroup>
77
<ItemGroup>
8-
<PackageReference Include="Akka.Cluster" Version="$(AkkaVersion)" />
9-
<PackageReference Include="Microsoft.Extensions.Configuration.Xml" Version="5.0.0" />
8+
<PackageReference Include="Akka.Cluster.Hosting" Version="0.2.2" />
9+
<PackageReference Include="Microsoft.Extensions.Configuration.Xml" Version="6.0.0" />
1010
<PackageReference Include="Petabridge.Cmd.Cluster" Version="$(PbmVersion)" />
1111
<PackageReference Include="Petabridge.Cmd.Remote" Version="$(PbmVersion)" />
1212
<PackageReference Include="Akka.Bootstrap.Docker">
1313
<Version>0.5.3</Version>
1414
</PackageReference>
1515
</ItemGroup>
1616

17-
<ItemGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
18-
<PackageReference Include="Topshelf" Version="4.2.1" />
19-
</ItemGroup>
20-
21-
<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetCoreVersion)' ">
22-
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
23-
</PropertyGroup>
24-
2517
<ItemGroup>
2618
<None Update="akka.hocon">
2719
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2820
</None>
2921
</ItemGroup>
30-
</Project>
22+
</Project>

src/Lighthouse/LighthouseHostFactory.cs src/Lighthouse/LighthouseConfigurator.cs

+15-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// -----------------------------------------------------------------------
2-
// <copyright file="LighthouseHostFactory.cs" company="Petabridge, LLC">
2+
// <copyright file="LighthouseConfigurator.cs" company="Petabridge, LLC">
33
// Copyright (C) 2015 - 2019 Petabridge, LLC <https://petabridge.com>
44
// </copyright>
55
// -----------------------------------------------------------------------
@@ -15,22 +15,20 @@
1515
namespace Lighthouse
1616
{
1717
/// <summary>
18-
/// Launcher for the Lighthouse <see cref="ActorSystem" />
18+
/// Configurator for Lighthouse
1919
/// </summary>
20-
public static class LighthouseHostFactory
20+
public static class LighthouseConfigurator
2121
{
22-
public static ActorSystem LaunchLighthouse(string ipAddress = null, int? specifiedPort = null,
22+
public static (Config config, string actorSystemName) LaunchLighthouse(string ipAddress = null, int? specifiedPort = null,
2323
string systemName = null)
2424
{
2525
systemName = systemName ?? Environment.GetEnvironmentVariable("ACTORSYSTEM")?.Trim();
2626

27-
28-
// Set environment variables for use inside Akka.Bootstrap.Docker
29-
// If overrides were provided to this method.
30-
//if (!string.IsNullOrEmpty(ipAddress)) Environment.SetEnvironmentVariable("CLUSTER_IP", ipAddress);
31-
32-
//if (specifiedPort != null)
33-
// Environment.SetEnvironmentVariable("CLUSTER_PORT", specifiedPort.Value.ToString());
27+
var argConfig = "";
28+
if (ipAddress != null)
29+
argConfig += $"akka.remote.dot-netty.tcp.public-hostname = {ipAddress}\n";
30+
if (specifiedPort != null)
31+
argConfig += $"akka.remote.dot-netty.tcp.port = {specifiedPort}";
3432

3533
var useDocker = !(IsNullOrEmpty(Environment.GetEnvironmentVariable("CLUSTER_IP")?.Trim()) ||
3634
IsNullOrEmpty(Environment.GetEnvironmentVariable("CLUSTER_SEEDS")?.Trim()));
@@ -41,6 +39,11 @@ public static ActorSystem LaunchLighthouse(string ipAddress = null, int? specifi
4139
if (useDocker)
4240
clusterConfig = clusterConfig.BootstrapFromDocker();
4341

42+
// Values from method arguments should always win
43+
if (!IsNullOrEmpty(argConfig))
44+
clusterConfig = ConfigurationFactory.ParseString(argConfig)
45+
.WithFallback(clusterConfig);
46+
4447
var lighthouseConfig = clusterConfig.GetConfig("lighthouse");
4548
if (lighthouseConfig != null && IsNullOrEmpty(systemName))
4649
systemName = lighthouseConfig.GetString("actorsystem", systemName);
@@ -88,7 +91,7 @@ public static ActorSystem LaunchLighthouse(string ipAddress = null, int? specifi
8891
.WithFallback(clusterConfig)
8992
: clusterConfig;
9093

91-
return ActorSystem.Create(systemName, finalConfig);
94+
return (finalConfig, systemName);
9295
}
9396
}
9497
}

src/Lighthouse/LighthouseService.cs

-56
This file was deleted.

src/Lighthouse/Program.NetCore.cs

-24
This file was deleted.

src/Lighthouse/Program.NetFramework.cs

-42
This file was deleted.

src/Lighthouse/Program.cs

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// -----------------------------------------------------------------------
2+
// <copyright file="Program.NetCore.cs" company="Petabridge, LLC">
3+
// Copyright (C) 2015 - 2019 Petabridge, LLC <https://petabridge.com>
4+
// </copyright>
5+
// -----------------------------------------------------------------------
6+
7+
using System;
8+
using System.Threading.Tasks;
9+
using Akka.Hosting;
10+
using Microsoft.Extensions.Hosting;
11+
using Petabridge.Cmd.Cluster;
12+
using Petabridge.Cmd.Host;
13+
using Petabridge.Cmd.Remote;
14+
15+
namespace Lighthouse
16+
{
17+
public class Program
18+
{
19+
public static async Task Main(string[] args)
20+
{
21+
var (config, actorSystemName) = LighthouseConfigurator.LaunchLighthouse();
22+
var hostBuilder = new HostBuilder();
23+
hostBuilder.ConfigureServices(services =>
24+
{
25+
services.AddAkka(actorSystemName, builder =>
26+
{
27+
builder.AddHocon(config) // clustering / remoting automatically configured here
28+
.StartActors((system, registry) =>
29+
{
30+
var pbm = PetabridgeCmd.Get(system);
31+
pbm.RegisterCommandPalette(ClusterCommands.Instance); // enable Akka.Cluster management commands
32+
pbm.RegisterCommandPalette(RemoteCommands.Instance); // enable Akka.Remote management commands
33+
pbm.Start();
34+
});
35+
});
36+
});
37+
38+
var host = hostBuilder.Build();
39+
await host.RunAsync();
40+
}
41+
}
42+
}

src/Lighthouse/akka.hocon

+38
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,48 @@ petabridge.cmd{
1515
akka {
1616
actor {
1717
provider = cluster
18+
19+
default-dispatcher = {
20+
executor = channel-executor
21+
fork-join-executor { #channelexecutor will re-use these settings
22+
parallelism-min = 2
23+
parallelism-factor = 1
24+
parallelism-max = 64
25+
}
26+
}
27+
28+
internal-dispatcher = {
29+
executor = channel-executor
30+
throughput = 5
31+
fork-join-executor {
32+
parallelism-min = 4
33+
parallelism-factor = 1.0
34+
parallelism-max = 64
35+
}
36+
}
1837
}
1938

2039
remote {
2140
log-remote-lifecycle-events = DEBUG
41+
42+
default-remote-dispatcher {
43+
type = Dispatcher
44+
executor = channel-executor
45+
fork-join-executor {
46+
parallelism-min = 2
47+
parallelism-factor = 0.5
48+
parallelism-max = 16
49+
}
50+
}
51+
52+
backoff-remote-dispatcher {
53+
executor = channel-executor
54+
fork-join-executor {
55+
parallelism-min = 2
56+
parallelism-max = 2
57+
}
58+
}
59+
2260
dot-netty.tcp {
2361
transport-class = "Akka.Remote.Transport.DotNetty.TcpTransport, Akka.Remote"
2462
applied-adapters = []

src/common.props

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<Project>
22
<PropertyGroup>
3-
<Copyright>Copyright © 2015-2021 Petabridge, LLC</Copyright>
3+
<Copyright>Copyright © 2015-2022 Petabridge, LLC</Copyright>
44
<Authors>Petabridge</Authors>
5-
<VersionPrefix>1.5.3</VersionPrefix>
6-
<PackageReleaseNotes>Upgraded to [Akka.NET v1.4.19](https://github.com/akkadotnet/akka.net/releases/tag/1.4.19)
7-
Upgraded to [Petabridge.Cmd v0.8.5](https://cmd.petabridge.com/articles/RELEASE_NOTES.html#085-may-03-2021)</PackageReleaseNotes>
5+
<VersionPrefix>1.5.5</VersionPrefix>
6+
<PackageReleaseNotes>Upgrade [Akka.Bootstrap.Docker to 0.5.3](https://github.com/petabridge/akkadotnet-bootstrap/releases/tag/0.5.3)</PackageReleaseNotes>
87
<PackageIconUrl>https://petabridge.com/images/logo.png</PackageIconUrl>
98
<PackageProjectUrl>
109
https://github.com/petabridge/lighthouse
@@ -16,13 +15,13 @@ Upgraded to [Petabridge.Cmd v0.8.5](https://cmd.petabridge.com/articles/RELEASE_
1615
</PropertyGroup>
1716
<PropertyGroup>
1817
<XunitVersion>2.4.1</XunitVersion>
19-
<MicrosoftSdkVersion>16.10.0</MicrosoftSdkVersion>
20-
<FluentAssertionsVersion>5.10.3</FluentAssertionsVersion>
18+
<MicrosoftSdkVersion>17.1.0</MicrosoftSdkVersion>
19+
<FluentAssertionsVersion>6.6.0</FluentAssertionsVersion>
2120
<NetCoreVersion>netcoreapp3.1</NetCoreVersion>
2221
<NetStandardVersion>netstandard1.6</NetStandardVersion>
2322
<NetFrameworkLibVersion>net461</NetFrameworkLibVersion>
24-
<NetFrameworkTestVersion>net461</NetFrameworkTestVersion>
25-
<AkkaVersion>1.4.21</AkkaVersion>
23+
<NetFrameworkTestVersion>netcoreapp3.1</NetFrameworkTestVersion>
24+
<AkkaVersion>1.4.37</AkkaVersion>
2625
<PbmVersion>0.8.5</PbmVersion>
2726
</PropertyGroup>
28-
</Project>
27+
</Project>

0 commit comments

Comments
 (0)