Skip to content

Commit 62c2781

Browse files
Merge pull request #112 from petabridge/dev
v1.3.0 Release
2 parents f7a3a44 + 7532263 commit 62c2781

8 files changed

+158
-50
lines changed

.kodiak.toml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# .kodiak.toml
2+
version = 1
3+
4+
[merge]
5+
require_automerge_label = false # merge everything
6+
method = "squash"
7+
delete_branch_on_merge = true
8+
block_on_reviews_requested = true

CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @Aaronontheweb

RELEASE_NOTES.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
#### 1.2.0 July 29 2019 ####
2-
* Fixed problem with v1.1.0 image of Lighthouse, which prevented `pbm` from being executed internally via `docker exec`. `pbm` can now be called normally again from within the container.
1+
#### 1.3.0 November 22 2019 ####
2+
* [Enable SSL needs management](https://github.com/petabridge/lighthouse/issues/102)
3+
* Updated all underlying dependencies.
4+
* Updated Windows Server base Docker image.

build-system/windows-pr-validation.yaml

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,10 @@ jobs:
1919
name: Windows
2020
vmImage: 'windows-2019'
2121
scriptFileName: build.cmd
22-
scriptArgs: all
22+
scriptArgs: all
23+
- template: azure-pipeline.template.yaml
24+
parameters:
25+
name: WindowsRuntimesTests
26+
vmImage: 'win1803'
27+
scriptFileName: build.cmd
28+
scriptArgs: RunTestsOnRuntimes

build.fsx

+82-3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ let outputTests = __SOURCE_DIRECTORY__ @@ "TestResults"
3939
let outputPerfTests = __SOURCE_DIRECTORY__ @@ "PerfResults"
4040
let outputNuGet = output @@ "nuget"
4141

42+
exception ConnectionFailure of string
43+
4244
Target "Clean" (fun _ ->
4345
ActivateFinalTarget "KillCreatedProcesses"
4446

@@ -128,6 +130,76 @@ Target "NBench" <| fun _ ->
128130
ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result
129131

130132
projects |> Seq.iter runSingleProject
133+
134+
Target "RunTestsOnRuntimes" (fun _ ->
135+
136+
let LighthouseConnectTimeout = 20.0 // in seconds
137+
138+
let dockerFileForTest =
139+
match (isWindows) with
140+
| true -> "src/Lighthouse/Dockerfile-windows"
141+
| _ -> "src/Lighthouse/Dockerfile-linux"
142+
143+
let installPbm () =
144+
// Install pbm client to test connections
145+
ExecProcess(fun info ->
146+
info.FileName <- "dotnet"
147+
info.Arguments <- "tool install --global pbm") (TimeSpan.FromMinutes 5.0) |> ignore // this is fine if tool is already installed
148+
149+
let startLighthouseDocker dockerFile =
150+
printfn "Starting Lighthouse..."
151+
let runArgs = "run -d --name lighthouse --hostname lighthouse1 -p 4053:4053 -p 9110:9110 --env CLUSTER_IP=127.0.0.1 --env CLUSTER_SEEDS=akka.tcp://some@lighthouse1:4053 --env CLUSTER_PORT=4053 lighthouse:latest"
152+
let runResult = ExecProcess(fun info ->
153+
info.FileName <- "docker"
154+
info.WorkingDirectory <- (Directory.GetParent dockerFile).FullName
155+
info.Arguments <- runArgs) (System.TimeSpan.FromMinutes 5.0)
156+
if runResult <> 0 then failwith "Unable to start Lighthouse in Docker"
157+
158+
let stopLighthouseDocker dockerFile =
159+
printfn "Stopping Lighthouse..."
160+
ExecProcess(fun info ->
161+
info.FileName <- "docker"
162+
info.WorkingDirectory <- (Directory.GetParent dockerFile).FullName
163+
info.Arguments <- "rm -f lighthouse") (System.TimeSpan.FromMinutes 5.0) |> ignore // cleanup failure should not fail the test
164+
165+
let startLighhouseLocally exePath =
166+
printfn "Starting Lighthouse locally..."
167+
try
168+
let runResult = ExecProcess(fun info ->
169+
info.FileName <- exePath) (System.TimeSpan.FromSeconds LighthouseConnectTimeout)
170+
if runResult <> 0 then failwithf "Unable to start Lighthouse from %s" exePath
171+
with
172+
| _ -> () // Local instance process should just timeout, this is fine
173+
174+
let connectLighthouse () =
175+
printfn "Connecting Lighthouse..."
176+
try
177+
ExecProcess(fun info ->
178+
info.FileName <- "pbm") (System.TimeSpan.FromSeconds LighthouseConnectTimeout) |> ignore
179+
// If process returned, this means that pbm failed to connect
180+
raise (ConnectionFailure "Failed to connect Lighthouse from pbm")
181+
with
182+
| ConnectionFailure(str) -> reraise()
183+
// If timed out, Lighthouse was connected successfully
184+
| _ -> printfn "Lighthouse was connected successfully"
185+
186+
installPbm()
187+
startLighthouseDocker dockerFileForTest
188+
try
189+
connectLighthouse()
190+
finally
191+
stopLighthouseDocker dockerFileForTest
192+
193+
// Test Full .NET Framework version under windows only
194+
// TODO: To make this work, need to start lighthouse and pbm as two parallel processes
195+
(*
196+
match (isWindows) with
197+
| true ->
198+
startLighhouseLocally "src/Lighthouse/bin/Release/net461/Lighthouse.exe"
199+
connectLighthouse()
200+
| _ -> ()
201+
*)
202+
)
131203

132204

133205
//--------------------------------------------------------------------------------
@@ -254,6 +326,12 @@ let mapDockerImageName (projectName:string) =
254326
| "Lighthouse" -> Some("lighthouse")
255327
| _ -> None
256328

329+
let composedGetDirName (p:string) =
330+
System.IO.Path.GetDirectoryName p
331+
332+
let composedGetFileNameWithoutExtension (p:string) =
333+
System.IO.Path.GetFileNameWithoutExtension p
334+
257335
Target "BuildDockerImages" (fun _ ->
258336
let projects = !! "src/**/*.csproj"
259337
-- "src/**/*Tests.csproj" // Don't publish unit tests
@@ -304,11 +382,11 @@ Target "BuildDockerImages" (fun _ ->
304382

305383
ExecProcess(fun info ->
306384
info.FileName <- "docker"
307-
info.WorkingDirectory <- Path.GetDirectoryName projectPath
385+
info.WorkingDirectory <- composedGetDirName projectPath
308386
info.Arguments <- args) (System.TimeSpan.FromMinutes 5.0) (* Reasonably long-running task. *)
309387

310388
let runSingleProject project =
311-
let projectName = Path.GetFileNameWithoutExtension project
389+
let projectName = composedGetFileNameWithoutExtension project
312390
let imageName = mapDockerImageName projectName
313391
let result = match imageName with
314392
| None -> 0
@@ -382,6 +460,7 @@ Target "Nuget" DoNothing
382460

383461
// tests dependencies
384462
"Build" ==> "RunTests"
463+
"PublishCode" ==> "BuildDockerImages" ==> "RunTestsOnRuntimes"
385464

386465
// nuget dependencies
387466
"Clean" ==> "Build" ==> "CreateNuget"
@@ -391,7 +470,7 @@ Target "Nuget" DoNothing
391470
"Clean" ==> "BuildRelease" ==> "Docfx"
392471

393472
// Docker
394-
"BuildRelease" ==> "PublishCode" ==> "BuildDockerImages" ==> "Docker"
473+
"PublishCode" ==> "BuildDockerImages" ==> "Docker"
395474

396475
// all
397476
"BuildRelease" ==> "All"

src/Lighthouse/Lighthouse.csproj

+30-30
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
2-
<Import Project="..\common.props" />
3-
<PropertyGroup>
4-
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>$(NetCoreVersion);$(NetFrameworkLibVersion)</TargetFrameworks>
6-
</PropertyGroup>
7-
<ItemGroup>
8-
<PackageReference Include="Akka.Cluster" Version="$(AkkaVersion)" />
9-
<PackageReference Include="Microsoft.Extensions.Configuration" Version="1.1.2" />
10-
<PackageReference Include="Microsoft.Extensions.Configuration.Xml" Version="1.1.2" />
11-
<PackageReference Include="Petabridge.Cmd.Cluster" Version="$(PbmVersion)" />
12-
<PackageReference Include="Petabridge.Cmd.Remote" Version="$(PbmVersion)" />
13-
<PackageReference Include="Akka.Bootstrap.Docker">
14-
<Version>0.2.1</Version>
15-
</PackageReference>
16-
</ItemGroup>
17-
18-
<ItemGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
19-
<PackageReference Include="Topshelf" Version="4.0.3" />
20-
</ItemGroup>
21-
22-
<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetCoreVersion)' ">
23-
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
24-
</PropertyGroup>
25-
26-
<ItemGroup>
27-
<None Update="akka.hocon">
28-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
29-
</None>
30-
</ItemGroup>
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<Import Project="..\common.props" />
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFrameworks>$(NetCoreVersion);$(NetFrameworkLibVersion)</TargetFrameworks>
6+
</PropertyGroup>
7+
<ItemGroup>
8+
<PackageReference Include="Akka.Cluster" Version="$(AkkaVersion)" />
9+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.0.1" />
10+
<PackageReference Include="Microsoft.Extensions.Configuration.Xml" Version="3.0.1" />
11+
<PackageReference Include="Petabridge.Cmd.Cluster" Version="$(PbmVersion)" />
12+
<PackageReference Include="Petabridge.Cmd.Remote" Version="$(PbmVersion)" />
13+
<PackageReference Include="Akka.Bootstrap.Docker">
14+
<Version>0.2.2</Version>
15+
</PackageReference>
16+
</ItemGroup>
17+
18+
<ItemGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
19+
<PackageReference Include="Topshelf" Version="4.2.1" />
20+
</ItemGroup>
21+
22+
<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetCoreVersion)' ">
23+
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
24+
</PropertyGroup>
25+
26+
<ItemGroup>
27+
<None Update="akka.hocon">
28+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
29+
</None>
30+
</ItemGroup>
3131
</Project>

src/Lighthouse/LighthouseHostFactory.cs

+18-8
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 static System.String;
1314

1415
namespace Lighthouse
1516
{
@@ -23,31 +24,40 @@ public static ActorSystem LaunchLighthouse(string ipAddress = null, int? specifi
2324
{
2425
systemName = systemName ?? Environment.GetEnvironmentVariable("ACTORSYSTEM")?.Trim();
2526

27+
2628
// Set environment variables for use inside Akka.Bootstrap.Docker
2729
// If overrides were provided to this method.
28-
if (!string.IsNullOrEmpty(ipAddress)) Environment.SetEnvironmentVariable("CLUSTER_IP", ipAddress);
30+
//if (!string.IsNullOrEmpty(ipAddress)) Environment.SetEnvironmentVariable("CLUSTER_IP", ipAddress);
31+
32+
//if (specifiedPort != null)
33+
// Environment.SetEnvironmentVariable("CLUSTER_PORT", specifiedPort.Value.ToString());
34+
35+
var useDocker = !(IsNullOrEmpty(Environment.GetEnvironmentVariable("CLUSTER_IP")?.Trim()) ||
36+
IsNullOrEmpty(Environment.GetEnvironmentVariable("CLUSTER_SEEDS")?.Trim()));
2937

30-
if (specifiedPort != null)
31-
Environment.SetEnvironmentVariable("CLUSTER_PORT", specifiedPort.Value.ToString());
38+
var clusterConfig = ConfigurationFactory.ParseString(File.ReadAllText("akka.hocon"));
3239

33-
var clusterConfig = ConfigurationFactory.ParseString(File.ReadAllText("akka.hocon")).BootstrapFromDocker();
40+
// If none of the environment variables expected by Akka.Bootstrap.Docker are set, use only what's in HOCON
41+
if (useDocker)
42+
clusterConfig = clusterConfig.BootstrapFromDocker();
3443

3544
var lighthouseConfig = clusterConfig.GetConfig("lighthouse");
36-
if (lighthouseConfig != null && string.IsNullOrEmpty(systemName))
45+
if (lighthouseConfig != null && IsNullOrEmpty(systemName))
3746
systemName = lighthouseConfig.GetString("actorsystem", systemName);
3847

39-
ipAddress = clusterConfig.GetString("akka.remote.dot-netty.tcp.public-hostname");
48+
ipAddress = clusterConfig.GetString("akka.remote.dot-netty.tcp.public-hostname", "127.0.0.1");
4049
var port = clusterConfig.GetInt("akka.remote.dot-netty.tcp.port");
4150

42-
var selfAddress = $"akka.tcp://{systemName}@{ipAddress}:{port}";
51+
var sslEnabled = clusterConfig.GetBoolean("akka.remote.dot-netty.tcp.enable-ssl");
52+
var selfAddress = sslEnabled ? new Address("akka.ssl.tcp", systemName, ipAddress.Trim(), port).ToString()
53+
: new Address("akka.tcp", systemName, ipAddress.Trim(), port).ToString();
4354

4455
/*
4556
* Sanity check
4657
*/
4758
Console.WriteLine($"[Lighthouse] ActorSystem: {systemName}; IP: {ipAddress}; PORT: {port}");
4859
Console.WriteLine("[Lighthouse] Performing pre-boot sanity check. Should be able to parse address [{0}]",
4960
selfAddress);
50-
selfAddress = new Address("akka.tcp", systemName, ipAddress.Trim(), port).ToString();
5161
Console.WriteLine("[Lighthouse] Parse successful.");
5262

5363

src/common.props

+8-6
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
<PropertyGroup>
33
<Copyright>Copyright © 2015-2019 Petabridge, LLC</Copyright>
44
<Authors>Petabridge</Authors>
5-
<VersionPrefix>1.2.0</VersionPrefix>
6-
<PackageReleaseNotes>Fixed problem with v1.1.0 image of Lighthouse, which prevented `pbm` from being executed internally via `docker exec`. `pbm` can now be called normally again from within the container.</PackageReleaseNotes>
5+
<VersionPrefix>1.3.0</VersionPrefix>
6+
<PackageReleaseNotes>[Enable SSL needs management](https://github.com/petabridge/lighthouse/issues/102)
7+
Updated all underlying dependencies.
8+
Updated Windows Server base Docker image.</PackageReleaseNotes>
79
<PackageIconUrl>https://petabridge.com/images/logo.png</PackageIconUrl>
810
<PackageProjectUrl>
911
https://github.com/petabridge/lighthouse
@@ -15,13 +17,13 @@
1517
</PropertyGroup>
1618
<PropertyGroup>
1719
<XunitVersion>2.4.1</XunitVersion>
18-
<MicrosoftSdkVersion>15.9.0</MicrosoftSdkVersion>
19-
<FluentAssertionsVersion>5.6.0</FluentAssertionsVersion>
20+
<MicrosoftSdkVersion>16.4.0</MicrosoftSdkVersion>
21+
<FluentAssertionsVersion>5.9.0</FluentAssertionsVersion>
2022
<NetCoreVersion>netcoreapp2.1</NetCoreVersion>
2123
<NetStandardVersion>netstandard1.6</NetStandardVersion>
2224
<NetFrameworkLibVersion>net461</NetFrameworkLibVersion>
2325
<NetFrameworkTestVersion>net461</NetFrameworkTestVersion>
24-
<AkkaVersion>1.3.13</AkkaVersion>
25-
<PbmVersion>0.6.2</PbmVersion>
26+
<AkkaVersion>1.3.16</AkkaVersion>
27+
<PbmVersion>0.7.0</PbmVersion>
2628
</PropertyGroup>
2729
</Project>

0 commit comments

Comments
 (0)