Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .github/workflows/build-container-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ jobs:
build-args: |
CONTAINER_RUNTIME=${{ inputs.container-runtime }}
RUNTIME=${{ steps.variables.outputs.runtime }}
- name: Verify Build
run: |
docker run --rm eventstore --insecure --what-if
# - name: Verify Build
# run: |
# docker run --rm eventstore --insecure --what-if
- name: Build Test Container
uses: docker/build-push-action@v4
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ dependencies
*.ncrunchsolution
*.ncrunchproject
**/.vs/
**/.idea/
**/.vscode/


.idea

Expand Down
66 changes: 33 additions & 33 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,32 @@ COPY ./.git/ .

WORKDIR /build/src
RUN find /build/src -maxdepth 1 -type d -name "*.Tests" -print0 | xargs -I{} -0 -n1 sh -c \
'dotnet publish --runtime=${RUNTIME} --no-self-contained --configuration Release --output /build/published-tests/`basename $1` $1' - '{}'
'dotnet publish --runtime=${RUNTIME} --no-self-contained --configuration Release --output /build/published-tests/`basename $1` $1' - '{}'

# "test" image
FROM mcr.microsoft.com/dotnet/sdk:8.0-${CONTAINER_RUNTIME} as test
FROM mcr.microsoft.com/dotnet/sdk:8.0-${CONTAINER_RUNTIME} AS test
WORKDIR /build
COPY --from=build ./build/published-tests ./published-tests
COPY --from=build ./build/ci ./ci
COPY --from=build ./build/src/EventStore.Core.Tests/Services/Transport/Tcp/test_certificates/ca/ca.crt /usr/local/share/ca-certificates/ca_eventstore_test.crt
RUN mkdir ./test-results
RUN printf '#!/usr/bin/env sh\n\
update-ca-certificates\n\
find /build/published-tests -maxdepth 1 -type d -name "*.Tests" -print0 | xargs -I{} -0 -n1 sh -c '"'"'proj=`basename $1` && dotnet test --blame --blame-hang-timeout 5min --settings /build/ci/ci.runsettings --logger:"GitHubActions;report-warnings=false" --logger:html --logger:trx --logger:"console;verbosity=normal" --results-directory /build/test-results/$proj $1/$proj.dll'"'"' - '"'"'{}'"'"'\n\
exit_code=$?\n\
echo $(find /build/test-results -name "*.html" | xargs cat) > /build/test-results/test-results.html\n\
exit $exit_code' \
>> /build/test.sh && \
chmod +x /build/test.sh
update-ca-certificates\n\
find /build/published-tests -maxdepth 1 -type d -name "*.Tests" -print0 | xargs -I{} -0 -n1 sh -c '"'"'proj=`basename $1` && dotnet test --blame --blame-hang-timeout 5min --settings /build/ci/ci.runsettings --logger:"GitHubActions;report-warnings=false" --logger:html --logger:trx --logger:"console;verbosity=normal" --results-directory /build/test-results/$proj $1/$proj.dll'"'"' - '"'"'{}'"'"'\n\
exit_code=$?\n\
echo $(find /build/test-results -name "*.html" | xargs cat) > /build/test-results/test-results.html\n\
exit $exit_code' \
>> /build/test.sh && \
chmod +x /build/test.sh

CMD ["/build/test.sh"]

# "publish" image
FROM build as publish
FROM build AS publish
ARG RUNTIME=linux-x64

RUN dotnet publish --configuration=Release --runtime=${RUNTIME} --self-contained \
--framework=net8.0 --output /publish EventStore.ClusterNode
--framework=net8.0 --output /publish EventStore.ClusterNode

# "runtime" image
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-${CONTAINER_RUNTIME} AS runtime
Expand All @@ -55,45 +55,45 @@ ARG UID=1000
ARG GID=1000

RUN if [[ "${RUNTIME}" = "linux-musl-x64" ]];\
then \
apk update && \
apk add --no-cache \
curl; \
else \
apt update && \
apt install -y \
curl && \
rm -rf /var/lib/apt/lists/*; \
fi
then \
apk update && \
apk add --no-cache \
curl; \
else \
apt update && \
apt install -y \
curl && \
rm -rf /var/lib/apt/lists/*; \
fi

WORKDIR /opt/eventstore

RUN addgroup --gid ${GID} "eventstore" && \
adduser \
--disabled-password \
--gecos "" \
--ingroup "eventstore" \
--no-create-home \
--uid ${UID} \
"eventstore"
adduser \
--disabled-password \
--gecos "" \
--ingroup "eventstore" \
--no-create-home \
--uid ${UID} \
"eventstore"

COPY --chown=eventstore:eventstore --from=publish /publish ./

RUN mkdir -p /var/lib/eventstore && \
mkdir -p /var/log/eventstore && \
mkdir -p /etc/eventstore && \
chown -R eventstore:eventstore /var/lib/eventstore /var/log/eventstore /etc/eventstore
mkdir -p /var/log/eventstore && \
mkdir -p /etc/eventstore && \
chown -R eventstore:eventstore /var/lib/eventstore /var/log/eventstore /etc/eventstore

USER eventstore

RUN printf "NodeIp: 0.0.0.0\n\
ReplicationIp: 0.0.0.0" >> /etc/eventstore/eventstore.conf
ReplicationIp: 0.0.0.0" >> /etc/eventstore/eventstore.conf

VOLUME /var/lib/eventstore /var/log/eventstore

EXPOSE 1112/tcp 1113/tcp 2113/tcp

HEALTHCHECK --interval=5s --timeout=5s --retries=24 \
CMD curl --fail --insecure https://localhost:2113/health/live || curl --fail http://localhost:2113/health/live || exit 1
CMD curl --fail --insecure https://localhost:2113/health/live || curl --fail http://localhost:2113/health/live || exit 1

ENTRYPOINT ["/opt/eventstore/EventStore.ClusterNode"]
11 changes: 9 additions & 2 deletions src/EventStore.ClusterNode/ClusterVNodeHostedService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
using EventStore.Plugins.Authorization;
using EventStore.Plugins.MD5;
using EventStore.Plugins.Subsystems;
using EventStore.Projections.Core;
// using EventStore.Projections.Core;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Configuration;
using Serilog;
Expand Down Expand Up @@ -64,6 +64,7 @@ public ClusterVNodeHostedService(
"Failed to configure MD5. If FIPS mode is enabled, please use the FIPS commercial plugin or disable FIPS mode.");
}

/*
var projectionMode = options.DevMode.Dev && options.Projection.RunProjections == ProjectionType.None
? ProjectionType.System
: options.Projection.RunProjections;
Expand All @@ -79,6 +80,7 @@ public ClusterVNodeHostedService(
options.Projection.ProjectionCompilationTimeout,
options.Projection.ProjectionExecutionTimeout)))
: options;
*/

if (!_options.Database.MemDb) {
var absolutePath = Path.GetFullPath(_options.Database.Db);
Expand Down Expand Up @@ -119,9 +121,14 @@ public ClusterVNodeHostedService(
throw new ArgumentOutOfRangeException(nameof(_options.Database.DbLogFormat), "Unexpected log format specified.");
}

var enabledNodeSubsystems = projectionMode >= ProjectionType.System
/*
var enabledNodeSubsystems =
projectionMode >= ProjectionType.System
? new[] {NodeSubsystems.Projections}
: Array.Empty<NodeSubsystems>();
*/

var enabledNodeSubsystems = Array.Empty<NodeSubsystems>();

RegisterWebControllers(enabledNodeSubsystems);
return;
Expand Down
5 changes: 4 additions & 1 deletion src/EventStore.ClusterNode/EventStore.ClusterNode.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<ProjectReference Include="..\EventStore.Common\EventStore.Common.csproj" />
<ProjectReference Include="..\EventStore.Core\EventStore.Core.csproj" />
<ProjectReference Include="..\EventStore.PluginHosting\EventStore.PluginHosting.csproj" />
<ProjectReference Include="..\EventStore.Projections.Core\EventStore.Projections.Core.csproj" />
<!-- <ProjectReference Include="..\EventStore.Projections.Core\EventStore.Projections.Core.csproj" /> -->
</ItemGroup>
<ItemGroup>
<None Include="..\EventStore.Common\Utils\version.properties">
Expand All @@ -36,6 +36,9 @@
<None Update="logconfig.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="metricsconfig.json.bak">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="app2.ico" />
Expand Down
13 changes: 2 additions & 11 deletions src/EventStore.ClusterNode/metricsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"ExpectedScrapeIntervalSeconds": 15,

"Meters": [
"EventStore.Core",
"EventStore.Projections.Core"
"EventStore.Core"
],

"Statuses": {
Expand All @@ -15,7 +14,7 @@

"ElectionsCount": true,

"ProjectionStats": true,
"ProjectionStats": false,

"PersistentSubscriptionStats": true,

Expand Down Expand Up @@ -150,14 +149,6 @@
"Regex": "PersistentSubscriptions",
"Label": "Persistent Subscriptions"
},
{
"Regex": "Projections Leader",
"Label": "Projections Leader"
},
{
"Regex": "Projection Core #.*",
"Label": "Projections Core"
},
{
"Regex": "Worker #.*",
"Label": "Workers"
Expand Down
32 changes: 16 additions & 16 deletions src/EventStore.Common/Utils/Locations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace EventStore.Common.Utils {
public class Locations {
public static readonly string ApplicationDirectory;
public static readonly string WebContentDirectory;
public static readonly string ProjectionsDirectory;
// public static readonly string ProjectionsDirectory;
public static readonly string PreludeDirectory;
public static readonly string PreludeResourcesPath;
public static readonly string PluginsDirectory;
Expand All @@ -19,6 +19,19 @@ public class Locations {
public static readonly string FallbackDefaultDataDirectory;
public static readonly string DefaultTrustedRootCertificateDirectory;

/// <summary>
/// Returns the preceded location by checking the existence of the directory.
/// The local directory should be the first priority as the first element followed by
/// the global default location as last element.
/// </summary>
/// <param name="locations">the locations ordered by prioity starting with the preceded location</param>
/// <returns>the preceded location</returns>
public static string GetPrecededLocation(params string[] locations) {
var precedenceList = locations.Distinct().ToList();
return precedenceList.FirstOrDefault(Directory.Exists) ??
precedenceList.Last();
}

static Locations() {
ApplicationDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ??
Path.GetFullPath(".");
Expand Down Expand Up @@ -59,30 +72,17 @@ static Locations() {
Path.Combine(ApplicationDirectory, "clusternode-web"),
Path.Combine(DefaultContentDirectory, "clusternode-web")
);
ProjectionsDirectory = GetPrecededLocation(
/*ProjectionsDirectory = GetPrecededLocation(
Path.Combine(ApplicationDirectory, "projections"),
Path.Combine(DefaultContentDirectory, "projections")
);
);*/
PreludeDirectory = GetPrecededLocation(
Path.Combine(ApplicationDirectory, "Prelude"),
Path.Combine(DefaultContentDirectory, "Prelude")
);
PreludeResourcesPath = "EventStore.Projections.Core.Prelude";
}

/// <summary>
/// Returns the preceded location by checking the existence of the directory.
/// The local directory should be the first priority as the first element followed by
/// the global default location as last element.
/// </summary>
/// <param name="locations">the locations ordered by prioity starting with the preceded location</param>
/// <returns>the preceded location</returns>
public static string GetPrecededLocation(params string[] locations) {
var precedenceList = locations.Distinct().ToList();
return precedenceList.FirstOrDefault(Directory.Exists) ??
precedenceList.Last();
}

/// <summary>
/// Returns the directories that potentially contain any configuration files.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/EventStore.Core.Tests/Helpers/MiniClusterNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ public MiniClusterNode(string pathname, int debugIndex, IPEndPoint internalTcp,
ChunksCacheSize = MiniNode.CachedChunkSize,
StreamExistenceFilterSize = 10_000
},
Projection = new() {
/*Projection = new() {
RunProjections = ProjectionType.None
},
},*/
PlugableComponents = subsystems
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public void should_set_command_line_args_to_default_values() {
Assert.AreEqual(false, _options.Interface.DisableStatsOnHttp, "StatsOnPublic");
Assert.AreEqual(false, _options.Interface.DisableGossipOnHttp, "GossipOnPublic");
Assert.AreEqual(1_000_000, _options.Database.MaxMemTableSize, "MaxMemtableEntryCount");
Assert.AreEqual(false, _options.Projection.RunProjections > ProjectionType.System,
"StartStandardProjections");
/*Assert.AreEqual(false, _options.Projection.RunProjections > ProjectionType.System,
"StartStandardProjections");*/
Assert.AreEqual(false, _options.Database.UnsafeIgnoreHardDelete,
"UnsafeIgnoreHardDeletes");
Assert.That(string.IsNullOrEmpty(_options.Database.Index), "IndexPath");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace EventStore.Core.XUnit.Tests.Configuration {
public class ClusterVNodeOptionsPrinterTests {
[Fact]
/*[Fact]
public void prints_options() {
var config = new ConfigurationBuilder()
.AddEventStoreDefaultValues(new Dictionary<string, string?> {
Expand Down Expand Up @@ -60,7 +60,7 @@ public void prints_options() {
CHUNK SIZE: 10000 (<DEFAULT>)
CHUNKS CACHE SIZE: 20000 (<DEFAULT>)
");
}
}*/

[Fact]
public void loaded_options_do_not_contain_sensitive_values() {
Expand Down
15 changes: 12 additions & 3 deletions src/EventStore.Core/ClusterVNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ GossipAdvertiseInfo GetGossipAdvertiseInfo() {
var infoController = new InfoController(
options,
new Dictionary<string, bool> {
["projections"] = options.Projection.RunProjections != ProjectionType.None || options.DevMode.Dev,
// ["projections"] = options.Projection.RunProjections != ProjectionType.None || options.DevMode.Dev,
["userManagement"] = options.Auth.AuthenticationType == Opts.AuthenticationTypeDefault && !options.Application.Insecure,
["atomPub"] = options.Interface.EnableAtomPubOverHttp || options.DevMode.Dev
},
Expand Down Expand Up @@ -1529,8 +1529,17 @@ GossipAdvertiseInfo GetGossipAdvertiseInfo() {
// subsystems
_subsystems = options.Subsystems;

var standardComponents = new StandardComponents(Db.Config, _mainQueue, _mainBus, _timerService, _timeProvider,
httpSendService, new IHttpService[] { _httpService }, _workersHandler, _queueStatsManager, trackers.QueueTrackers, metricsConfiguration.ProjectionStats);
var standardComponents = new StandardComponents(Db.Config,
_mainQueue,
_mainBus,
_timerService,
_timeProvider,
httpSendService,
new IHttpService[] { _httpService },
_workersHandler,
_queueStatsManager,
trackers.QueueTrackers,
metricsConfiguration.ProjectionStats);

IServiceCollection ConfigureNodeServices(IServiceCollection services) {
services
Expand Down
7 changes: 5 additions & 2 deletions src/EventStore.Core/Configuration/ClusterVNodeOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public partial record ClusterVNodeOptions {
[OptionGroup] public DatabaseOptions Database { get; init; } = new();
[OptionGroup] public GrpcOptions Grpc { get; init; } = new();
[OptionGroup] public InterfaceOptions Interface { get; init; } = new();
[OptionGroup] public ProjectionOptions Projection { get; init; } = new();
/*[Obsolete("TrogonEventstore won't do projections")]
[OptionGroup] public ProjectionOptions Projection { get; init; } = new();*/
public UnknownOptions Unknown { get; init; } = new([]);

public byte IndexBitnessVersion { get; init; } = Index.PTableVersions.IndexV4;
Expand Down Expand Up @@ -79,7 +80,8 @@ public static ClusterVNodeOptions FromConfiguration(IConfigurationRoot configura
Database = configuration.BindOptions<DatabaseOptions>(),
Grpc = configuration.BindOptions<GrpcOptions>(),
Interface = configuration.BindOptions<InterfaceOptions>(),
Projection = configuration.BindOptions<ProjectionOptions>(),

// Projection = configuration.BindOptions<ProjectionOptions>(),

Unknown = UnknownOptions.FromConfiguration(configuration),
ConfigurationRoot = configurationRoot,
Expand Down Expand Up @@ -718,6 +720,7 @@ public int ReplicationHeartbeatInterval {
#pragma warning restore 0618
}

[Obsolete("TrogonEventstore won't do projections")]
[Description("Projection Options")]
public record ProjectionOptions {
public const int DefaultProjectionExecutionTimeout = 250;
Expand Down
2 changes: 1 addition & 1 deletion src/EventStore.Core/Telemetry/TelemetryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private void Handle(TelemetryMessage.Request message) {
["clusterSize"] = _nodeOptions.Cluster.ClusterSize,
["enableAtomPubOverHttp"] = _nodeOptions.Interface.EnableAtomPubOverHttp,
["insecure"] = _nodeOptions.Application.Insecure,
["runProjections"] = _nodeOptions.Projection.RunProjections.ToString(),
// ["runProjections"] = _nodeOptions.Projection.RunProjections.ToString(),
["authorizationType"] = _nodeOptions.Auth.AuthorizationType,
["authenticationType"] = _nodeOptions.Auth.AuthenticationType
}));
Expand Down
Loading
Loading