Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit 8d016d8

Browse files
ApplicationServer -> Server
1 parent 1950692 commit 8d016d8

12 files changed

Lines changed: 78 additions & 160 deletions

Dockerfile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,25 @@ RUN apk add --no-cache \
1212
dotnet tool install -g minver-cli --version 1.0.0-beta.2 && \
1313
/root/.dotnet/tools/minver > .version
1414

15+
WORKDIR /app
16+
17+
COPY ./*.sln ./
18+
1519
WORKDIR /app/src
1620

17-
COPY ./src/*.sln ./
1821
COPY ./src/*/*.csproj ./
22+
1923
RUN for file in $(ls *.csproj); do mkdir -p ./${file%.*}/ && mv $file ./${file%.*}/; done
2024

25+
WORKDIR /app
26+
2127
COPY ./NuGet.Config ./
2228

2329
RUN dotnet restore --runtime=alpine.3.7-x64
2430

25-
COPY ./src .
26-
27-
WORKDIR /app/docs
31+
WORKDIR /app/src
2832

29-
COPY ./docs/package.json ./docs/yarn.lock ./
33+
COPY ./src .
3034

3135
WORKDIR /app/build
3236

@@ -36,7 +40,7 @@ RUN dotnet restore
3640

3741
COPY ./build .
3842

39-
COPY --from=sqlstreamstore/browser:0.9 /var/www /app/src/SqlStreamStore.HAL.ApplicationServer/Browser/build
43+
COPY --from=sqlstreamstore/browser:0.9 /var/www /app/src/SqlStreamStore.Server/Browser/build
4044

4145
WORKDIR /app
4246

@@ -49,4 +53,4 @@ WORKDIR /app
4953
COPY --from=build /app/.version ./
5054
COPY --from=build /app/publish ./
5155

52-
ENTRYPOINT ["/app/SqlStreamStore.HAL.ApplicationServer"]
56+
ENTRYPOINT ["/app/SqlStreamStore.Server"]
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
44
VisualStudioVersion = 15.0.27130.2027
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqlStreamStore.HAL.ApplicationServer", "SqlStreamStore.HAL.ApplicationServer\SqlStreamStore.HAL.ApplicationServer.csproj", "{B4B24F09-CB96-4D2E-A1D2-C50C9557F144}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqlStreamStore.Server", "src\SqlStreamStore.Server\SqlStreamStore.Server.csproj", "{B4B24F09-CB96-4D2E-A1D2-C50C9557F144}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution

build/Program.cs

Lines changed: 5 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -11,67 +11,31 @@ static class Program
1111
private const string ArtifactsDir = "artifacts";
1212
private const string PublishDir = "publish";
1313

14-
private static readonly string MYGET_API_KEY = Environment.GetEnvironmentVariable(nameof(MYGET_API_KEY));
15-
1614
public static void Main(string[] args)
1715
{
1816
const string clean = nameof(Clean);
19-
const string init = nameof(Init);
20-
const string generateDocumentation = nameof(GenerateDocumentation);
2117
const string build = nameof(Build);
22-
const string runTests = nameof(RunTests);
23-
const string pack = nameof(Pack);
2418
const string publish = nameof(Publish);
25-
const string push = nameof(Push);
26-
27-
var srcDirectory = new DirectoryInfo("./src");
2819

2920
Target(
3021
clean,
3122
Clean);
3223

33-
Target(
34-
init,
35-
Init);
36-
37-
Target(
38-
generateDocumentation,
39-
DependsOn(init),
40-
ForEach(SchemaDirectories(srcDirectory)),
41-
GenerateDocumentation);
42-
4324
Target(
4425
build,
45-
DependsOn(generateDocumentation),
26+
DependsOn(clean),
4627
Build);
4728

48-
Target(
49-
runTests,
50-
DependsOn(build),
51-
RunTests);
52-
5329
Target(
5430
publish,
5531
DependsOn(build),
5632
Publish);
5733

58-
Target(
59-
pack,
60-
DependsOn(publish),
61-
Pack);
62-
63-
Target(
64-
push,
65-
DependsOn(pack),
66-
Push);
67-
68-
Target("default", DependsOn(clean, runTests, push));
34+
Target("default", DependsOn(publish));
6935

70-
RunTargetsAndExit(args.Concat(new[] {"--parallel"}));
36+
RunTargetsAndExit(args);
7137
}
7238

73-
private static readonly Action Init = () => Yarn("./docs");
74-
7539
private static readonly Action Clean = () =>
7640
{
7741
if (Directory.Exists(ArtifactsDir))
@@ -85,59 +49,11 @@ public static void Main(string[] args)
8549
}
8650
};
8751

88-
private static readonly Func<string, Task> GenerateDocumentation = schemaDirectory =>
89-
RunAsync(
90-
"node",
91-
$"node_modules/@adobe/jsonschema2md/cli.js -n --input {schemaDirectory} --out {schemaDirectory} --schema-out=-",
92-
"docs");
93-
9452
private static readonly Action Build = () => Run(
9553
"dotnet",
96-
"build src/SqlStreamStore.HAL.sln --configuration Release");
97-
98-
private static readonly Action RunTests = () => Run(
99-
"dotnet",
100-
$"test src/SqlStreamStore.HAL.Tests --configuration Release --results-directory ../../{ArtifactsDir} --verbosity normal --no-build -l trx;LogFileName=SqlStreamStore.HAL.Tests.xml");
54+
"build SqlStreamStore.Server.sln --configuration Release");
10155

10256
private static readonly Action Publish = () => Run(
10357
"dotnet",
104-
$"publish --configuration=Release --output=../../{PublishDir} --runtime=alpine.3.7-x64 /p:ShowLinkerSizeComparison=true src/SqlStreamStore.HAL.ApplicationServer");
105-
106-
private static readonly Action Pack = () => Run(
107-
"dotnet",
108-
$"pack src/SqlStreamStore.HAL --configuration Release --output ../../{ArtifactsDir} --no-build");
109-
110-
private static readonly Action Push = () =>
111-
{
112-
var packagesToPush = Directory.GetFiles(ArtifactsDir, "*.nupkg", SearchOption.TopDirectoryOnly);
113-
Console.WriteLine($"Found packages to publish: {string.Join("; ", packagesToPush)}");
114-
115-
if (string.IsNullOrWhiteSpace(MYGET_API_KEY))
116-
{
117-
Console.WriteLine("MyGet API key not available. Packages will not be pushed.");
118-
return;
119-
}
120-
121-
foreach (var packageToPush in packagesToPush)
122-
{
123-
Run(
124-
"dotnet",
125-
$"nuget push {packageToPush} -s https://www.myget.org/F/sqlstreamstore/api/v3/index.json -k {MYGET_API_KEY}");
126-
}
127-
};
128-
129-
private static void Yarn(string workingDirectory, string args = default)
130-
{
131-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
132-
Run("cmd", "/c yarn", workingDirectory);
133-
else
134-
Run("yarn", args, workingDirectory);
135-
}
136-
137-
private static string[] SchemaDirectories(DirectoryInfo srcDirectory)
138-
=> srcDirectory.GetFiles("*.schema.json", SearchOption.AllDirectories)
139-
.Select(schemaFile => schemaFile.DirectoryName)
140-
.Distinct()
141-
.Select(schemaDirectory => schemaDirectory.Replace(Path.DirectorySeparatorChar, '/'))
142-
.ToArray();
58+
$"publish --configuration=Release --output=../../{PublishDir} --runtime=alpine.3.7-x64 /p:ShowLinkerSizeComparison=true src/SqlStreamStore.Server");
14359
}

src/Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<Project>
33
<PropertyGroup>
44
<Authors>João P. Bragança</Authors>
5-
<PackageProjectUrl>https://github.com/SqlStreamStore/SqlStreamStore.HAL</PackageProjectUrl>
6-
<PackageLicenseUrl>https://github.com/SqlStreamStore/SqlStreamStore.HAL/blob/master/LICENSE</PackageLicenseUrl>
5+
<PackageProjectUrl>https://github.com/SqlStreamStore/SqlStreamStore.Server</PackageProjectUrl>
6+
<PackageLicenseUrl>https://github.com/SqlStreamStore/SqlStreamStore.Server/blob/master/LICENSE</PackageLicenseUrl>
77
<GenerateDocumentationFile>true</GenerateDocumentationFile>
88
<PackageTags>cqrs;event-sourcing;event-store;stream-store</PackageTags>
99
</PropertyGroup>

src/SqlStreamStore.HAL.ApplicationServer/Browser/SqlStreamStoreBrowserMiddleware.cs renamed to src/SqlStreamStore.Server/Browser/SqlStreamStoreBrowserMiddleware.cs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
namespace SqlStreamStore.HAL.ApplicationServer.Browser
2-
{
3-
using System;
4-
using System.Linq;
5-
using System.Net.Http.Headers;
6-
using System.Threading.Tasks;
7-
using Microsoft.AspNetCore.Builder;
8-
using Microsoft.AspNetCore.Http;
9-
using Microsoft.Extensions.FileProviders;
10-
using Serilog;
11-
using MidFunc = System.Func<
12-
Microsoft.AspNetCore.Http.HttpContext,
13-
System.Func<System.Threading.Tasks.Task>,
14-
System.Threading.Tasks.Task
15-
>;
1+
using System;
2+
using System.Linq;
3+
using System.Net.Http.Headers;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Builder;
6+
using Microsoft.AspNetCore.Http;
7+
using Microsoft.Extensions.FileProviders;
8+
using Serilog;
169

10+
namespace SqlStreamStore.Server.Browser
11+
{
1712
internal static class SqlStreamStoreBrowserMiddleware
1813
{
1914
public static IApplicationBuilder UseSqlStreamStoreBrowser(

src/SqlStreamStore.HAL.ApplicationServer/Program.cs renamed to src/SqlStreamStore.Server/Program.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
namespace SqlStreamStore.HAL.ApplicationServer
2-
{
3-
using System;
4-
using System.Threading;
5-
using System.Threading.Tasks;
6-
using Microsoft.AspNetCore.Hosting;
7-
using Serilog;
1+
using System;
2+
using System.Threading;
3+
using System.Threading.Tasks;
4+
using Microsoft.AspNetCore.Hosting;
5+
using Serilog;
6+
using SqlStreamStore.HAL;
87

8+
namespace SqlStreamStore.Server
9+
{
910
internal class Program : IDisposable
1011
{
1112
private readonly CancellationTokenSource _cts;
12-
private readonly SqlStreamStoreHalConfiguration _configuration;
13+
private readonly SqlStreamStoreServerConfiguration _configuration;
1314
private readonly SqlStreamStoreFactory _factory;
1415

1516
public static async Task<int> Main(string[] args)
@@ -22,7 +23,7 @@ public static async Task<int> Main(string[] args)
2223

2324
private Program(string[] args)
2425
{
25-
_configuration = new SqlStreamStoreHalConfiguration(Environment.GetEnvironmentVariables(), args);
26+
_configuration = new SqlStreamStoreServerConfiguration(Environment.GetEnvironmentVariables(), args);
2627

2728
Log.Logger = new LoggerConfiguration()
2829
.MinimumLevel.Is(_configuration.LogLevel)
@@ -41,7 +42,7 @@ private async Task<int> Run()
4142
using(var streamStore = await _factory.Create(_cts.Token))
4243
using(var host = new WebHostBuilder()
4344
.UseKestrel()
44-
.UseStartup(new ApplicationServerStartup(streamStore,
45+
.UseStartup(new SqlStreamStoreServerStartup(streamStore,
4546
new SqlStreamStoreMiddlewareOptions
4647
{
4748
UseCanonicalUrls = _configuration.UseCanonicalUris

src/SqlStreamStore.HAL.ApplicationServer/SqlStreamStore.HAL.ApplicationServer.csproj renamed to src/SqlStreamStore.Server/SqlStreamStore.Server.csproj

File renamed without changes.

src/SqlStreamStore.HAL.ApplicationServer/SqlStreamStoreFactory.cs renamed to src/SqlStreamStore.Server/SqlStreamStoreFactory.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
namespace SqlStreamStore.HAL.ApplicationServer
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Data.SqlClient;
4+
using System.Threading;
5+
using System.Threading.Tasks;
6+
using Npgsql;
7+
using Serilog;
8+
using SqlStreamStore.Infrastructure;
9+
10+
namespace SqlStreamStore.Server
211
{
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Data.SqlClient;
6-
using System.Threading;
7-
using System.Threading.Tasks;
8-
using Npgsql;
9-
using Serilog;
10-
using SqlStreamStore.Infrastructure;
11-
1212
internal class SqlStreamStoreFactory
1313
{
14-
private readonly SqlStreamStoreHalConfiguration _configuration;
14+
private readonly SqlStreamStoreServerConfiguration _configuration;
1515

1616
private delegate Task<IStreamStore> CreateStreamStore(
1717
string connectionString,
@@ -30,7 +30,7 @@ private static readonly IDictionary<string, CreateStreamStore> s_factories
3030
[mssql] = CreateMssqlStreamStore
3131
};
3232

33-
public SqlStreamStoreFactory(SqlStreamStoreHalConfiguration configuration)
33+
public SqlStreamStoreFactory(SqlStreamStoreServerConfiguration configuration)
3434
{
3535
if(configuration == null)
3636
{

src/SqlStreamStore.HAL.ApplicationServer/SqlStreamStoreHalConfiguration.cs renamed to src/SqlStreamStore.Server/SqlStreamStoreServerConfiguration.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
namespace SqlStreamStore.HAL.ApplicationServer
2-
{
3-
using System;
4-
using System.Collections;
5-
using System.Linq;
6-
using Microsoft.Extensions.Configuration;
7-
using Serilog.Events;
1+
using System;
2+
using System.Collections;
3+
using System.Linq;
4+
using Microsoft.Extensions.Configuration;
5+
using Serilog.Events;
86

9-
internal class SqlStreamStoreHalConfiguration
7+
namespace SqlStreamStore.Server
8+
{
9+
internal class SqlStreamStoreServerConfiguration
1010
{
1111
private readonly IConfigurationRoot _configuration;
1212

@@ -16,7 +16,7 @@ internal class SqlStreamStoreHalConfiguration
1616
public string Schema => _configuration.GetValue<string>("schema");
1717
public string Provider => _configuration.GetValue<string>("provider");
1818

19-
public SqlStreamStoreHalConfiguration(IDictionary environment, string[] args)
19+
public SqlStreamStoreServerConfiguration(IDictionary environment, string[] args)
2020
{
2121
if(environment == null)
2222
throw new ArgumentNullException(nameof(environment));

0 commit comments

Comments
 (0)