Skip to content

Commit

Permalink
Merge pull request #255 from petabridge/dev
Browse files Browse the repository at this point in the history
v1.6.0 Release
  • Loading branch information
Aaronontheweb authored Apr 18, 2022
2 parents 4f75b2a + b5cc87a commit 81cb031
Show file tree
Hide file tree
Showing 11 changed files with 113 additions and 168 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ services:
AKKA__CLUSTER__SPLIT_BRAIN_RESOLVER__ACTIVE_STRATEGY: "keep-majority"
```

### Running in .NET Framework
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.

### Examples of Lighthouse in the Wild
Looking for some complete examples of how to use Lighthouse? Here's some:

Expand Down
12 changes: 4 additions & 8 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#### 1.5.5 June 16 2021 ####
* Upgrade [Akka.Bootstrap.Docker to 0.5.3](https://github.com/petabridge/akkadotnet-bootstrap/releases/tag/0.5.3)
#### 1.6.0 April 18 2022 ####

#### 1.5.4 June 16 2021 ####
* Upgraded to [Akka.NET v1.4.21](https://github.com/akkadotnet/akka.net/releases/tag/1.4.21)

#### 1.5.3 May 10 2021 ####
* Upgraded to [Akka.NET v1.4.19](https://github.com/akkadotnet/akka.net/releases/tag/1.4.19)
* Upgraded to [Petabridge.Cmd v0.8.5](https://cmd.petabridge.com/articles/RELEASE_NOTES.html#085-may-03-2021)
* Dropped Topshelf support
* Migrated to [Akka.Hosting](https://github.com/akkadotnet/Akka.Hosting) and `IHostedService`
* Significantly reduced idle CPU consumption by migrating to [`channel-executor` for dispatching](https://getakka.net/articles/actors/dispatchers.html#channelexecutor).
4 changes: 2 additions & 2 deletions build-system/linux-pr-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:
- template: azure-pipeline.template.yaml
parameters:
name: Ubuntu
vmImage: 'ubuntu-16.04'
vmImage: 'ubuntu-20.04'
scriptFileName: ./build.sh
scriptArgs: all
scriptArgs: all
16 changes: 4 additions & 12 deletions src/Lighthouse/Lighthouse.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,21 @@
<Import Project="..\common.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>$(NetCoreVersion);$(NetFrameworkLibVersion)</TargetFrameworks>
<TargetFrameworks>$(NetCoreVersion)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Akka.Cluster" Version="$(AkkaVersion)" />
<PackageReference Include="Microsoft.Extensions.Configuration.Xml" Version="5.0.0" />
<PackageReference Include="Akka.Cluster.Hosting" Version="0.2.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Xml" Version="6.0.0" />
<PackageReference Include="Petabridge.Cmd.Cluster" Version="$(PbmVersion)" />
<PackageReference Include="Petabridge.Cmd.Remote" Version="$(PbmVersion)" />
<PackageReference Include="Akka.Bootstrap.Docker">
<Version>0.5.3</Version>
</PackageReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
<PackageReference Include="Topshelf" Version="4.2.1" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetCoreVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>

<ItemGroup>
<None Update="akka.hocon">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
</Project>
27 changes: 15 additions & 12 deletions src/Lighthouse/LighthouseHostFactory.cs → src/Lighthouse/LighthouseConfigurator.cs
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="LighthouseHostFactory.cs" company="Petabridge, LLC">
// <copyright file="LighthouseConfigurator.cs" company="Petabridge, LLC">
// Copyright (C) 2015 - 2019 Petabridge, LLC <https://petabridge.com>
// </copyright>
// -----------------------------------------------------------------------
Expand All @@ -15,22 +15,20 @@
namespace Lighthouse
{
/// <summary>
/// Launcher for the Lighthouse <see cref="ActorSystem" />
/// Configurator for Lighthouse
/// </summary>
public static class LighthouseHostFactory
public static class LighthouseConfigurator
{
public static ActorSystem LaunchLighthouse(string ipAddress = null, int? specifiedPort = null,
public static (Config config, string actorSystemName) LaunchLighthouse(string ipAddress = null, int? specifiedPort = null,
string systemName = null)
{
systemName = systemName ?? Environment.GetEnvironmentVariable("ACTORSYSTEM")?.Trim();


// Set environment variables for use inside Akka.Bootstrap.Docker
// If overrides were provided to this method.
//if (!string.IsNullOrEmpty(ipAddress)) Environment.SetEnvironmentVariable("CLUSTER_IP", ipAddress);

//if (specifiedPort != null)
// Environment.SetEnvironmentVariable("CLUSTER_PORT", specifiedPort.Value.ToString());
var argConfig = "";
if (ipAddress != null)
argConfig += $"akka.remote.dot-netty.tcp.public-hostname = {ipAddress}\n";
if (specifiedPort != null)
argConfig += $"akka.remote.dot-netty.tcp.port = {specifiedPort}";

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

// Values from method arguments should always win
if (!IsNullOrEmpty(argConfig))
clusterConfig = ConfigurationFactory.ParseString(argConfig)
.WithFallback(clusterConfig);

var lighthouseConfig = clusterConfig.GetConfig("lighthouse");
if (lighthouseConfig != null && IsNullOrEmpty(systemName))
systemName = lighthouseConfig.GetString("actorsystem", systemName);
Expand Down Expand Up @@ -88,7 +91,7 @@ public static ActorSystem LaunchLighthouse(string ipAddress = null, int? specifi
.WithFallback(clusterConfig)
: clusterConfig;

return ActorSystem.Create(systemName, finalConfig);
return (finalConfig, systemName);
}
}
}
56 changes: 0 additions & 56 deletions src/Lighthouse/LighthouseService.cs

This file was deleted.

24 changes: 0 additions & 24 deletions src/Lighthouse/Program.NetCore.cs

This file was deleted.

42 changes: 0 additions & 42 deletions src/Lighthouse/Program.NetFramework.cs

This file was deleted.

42 changes: 42 additions & 0 deletions src/Lighthouse/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// -----------------------------------------------------------------------
// <copyright file="Program.NetCore.cs" company="Petabridge, LLC">
// Copyright (C) 2015 - 2019 Petabridge, LLC <https://petabridge.com>
// </copyright>
// -----------------------------------------------------------------------

using System;
using System.Threading.Tasks;
using Akka.Hosting;
using Microsoft.Extensions.Hosting;
using Petabridge.Cmd.Cluster;
using Petabridge.Cmd.Host;
using Petabridge.Cmd.Remote;

namespace Lighthouse
{
public class Program
{
public static async Task Main(string[] args)
{
var (config, actorSystemName) = LighthouseConfigurator.LaunchLighthouse();
var hostBuilder = new HostBuilder();
hostBuilder.ConfigureServices(services =>
{
services.AddAkka(actorSystemName, builder =>
{
builder.AddHocon(config) // clustering / remoting automatically configured here
.StartActors((system, registry) =>
{
var pbm = PetabridgeCmd.Get(system);
pbm.RegisterCommandPalette(ClusterCommands.Instance); // enable Akka.Cluster management commands
pbm.RegisterCommandPalette(RemoteCommands.Instance); // enable Akka.Remote management commands
pbm.Start();
});
});
});

var host = hostBuilder.Build();
await host.RunAsync();
}
}
}
38 changes: 38 additions & 0 deletions src/Lighthouse/akka.hocon
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,48 @@ petabridge.cmd{
akka {
actor {
provider = cluster

default-dispatcher = {
executor = channel-executor
fork-join-executor { #channelexecutor will re-use these settings
parallelism-min = 2
parallelism-factor = 1
parallelism-max = 64
}
}

internal-dispatcher = {
executor = channel-executor
throughput = 5
fork-join-executor {
parallelism-min = 4
parallelism-factor = 1.0
parallelism-max = 64
}
}
}

remote {
log-remote-lifecycle-events = DEBUG

default-remote-dispatcher {
type = Dispatcher
executor = channel-executor
fork-join-executor {
parallelism-min = 2
parallelism-factor = 0.5
parallelism-max = 16
}
}

backoff-remote-dispatcher {
executor = channel-executor
fork-join-executor {
parallelism-min = 2
parallelism-max = 2
}
}

dot-netty.tcp {
transport-class = "Akka.Remote.Transport.DotNetty.TcpTransport, Akka.Remote"
applied-adapters = []
Expand Down
17 changes: 8 additions & 9 deletions src/common.props
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project>
<PropertyGroup>
<Copyright>Copyright © 2015-2021 Petabridge, LLC</Copyright>
<Copyright>Copyright © 2015-2022 Petabridge, LLC</Copyright>
<Authors>Petabridge</Authors>
<VersionPrefix>1.5.3</VersionPrefix>
<PackageReleaseNotes>Upgraded to [Akka.NET v1.4.19](https://github.com/akkadotnet/akka.net/releases/tag/1.4.19)
Upgraded to [Petabridge.Cmd v0.8.5](https://cmd.petabridge.com/articles/RELEASE_NOTES.html#085-may-03-2021)</PackageReleaseNotes>
<VersionPrefix>1.5.5</VersionPrefix>
<PackageReleaseNotes>Upgrade [Akka.Bootstrap.Docker to 0.5.3](https://github.com/petabridge/akkadotnet-bootstrap/releases/tag/0.5.3)</PackageReleaseNotes>
<PackageIconUrl>https://petabridge.com/images/logo.png</PackageIconUrl>
<PackageProjectUrl>
https://github.com/petabridge/lighthouse
Expand All @@ -16,13 +15,13 @@ Upgraded to [Petabridge.Cmd v0.8.5](https://cmd.petabridge.com/articles/RELEASE_
</PropertyGroup>
<PropertyGroup>
<XunitVersion>2.4.1</XunitVersion>
<MicrosoftSdkVersion>16.10.0</MicrosoftSdkVersion>
<FluentAssertionsVersion>5.10.3</FluentAssertionsVersion>
<MicrosoftSdkVersion>17.1.0</MicrosoftSdkVersion>
<FluentAssertionsVersion>6.6.0</FluentAssertionsVersion>
<NetCoreVersion>netcoreapp3.1</NetCoreVersion>
<NetStandardVersion>netstandard1.6</NetStandardVersion>
<NetFrameworkLibVersion>net461</NetFrameworkLibVersion>
<NetFrameworkTestVersion>net461</NetFrameworkTestVersion>
<AkkaVersion>1.4.21</AkkaVersion>
<NetFrameworkTestVersion>netcoreapp3.1</NetFrameworkTestVersion>
<AkkaVersion>1.4.37</AkkaVersion>
<PbmVersion>0.8.5</PbmVersion>
</PropertyGroup>
</Project>
</Project>

0 comments on commit 81cb031

Please sign in to comment.