Skip to content

Commit

Permalink
Merge branch 'master' into indexsetScoping
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickmann committed Dec 13, 2024
2 parents 43c88e9 + feaaa76 commit 5541d48
Show file tree
Hide file tree
Showing 127 changed files with 3,916 additions and 3,055 deletions.
13 changes: 12 additions & 1 deletion data-node/src/main/java/org/graylog/datanode/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.net.InetAddresses;
import org.graylog.datanode.configuration.DatanodeDirectories;
import org.graylog2.CommonNodeConfiguration;
import org.graylog2.Configuration.SafeClassesValidator;
import org.graylog2.configuration.Documentation;
import org.graylog2.plugin.Tools;
Expand All @@ -57,7 +58,7 @@
* Helper class to hold configuration of DataNode
*/
@SuppressWarnings("FieldMayBeFinal")
public class Configuration {
public class Configuration implements CommonNodeConfiguration {
private static final Logger LOG = LoggerFactory.getLogger(Configuration.class);
public static final String TRANSPORT_CERTIFICATE_PASSWORD_PROPERTY = "transport_certificate_password";
public static final String HTTP_CERTIFICATE_PASSWORD_PROPERTY = "http_certificate_password";
Expand Down Expand Up @@ -659,4 +660,14 @@ public List<String> getNodeRoles() {
public String getOpensearchHeap() {
return opensearchHeap;
}

@Override
public String getEnvironmentVariablePrefix() {
return "GRAYLOG_DATANODE_";
}

@Override
public String getSystemPropertyPrefix() {
return "graylog.datanode.";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,61 +16,33 @@
*/
package org.graylog.datanode.bindings;

import com.google.common.eventbus.EventBus;
import com.google.inject.TypeLiteral;
import com.google.inject.multibindings.Multibinder;
import com.google.inject.multibindings.OptionalBinder;
import jakarta.ws.rs.container.DynamicFeature;
import jakarta.ws.rs.ext.ExceptionMapper;
import org.graylog.datanode.Configuration;
import org.graylog.datanode.shared.system.activities.DataNodeActivityWriter;
import org.graylog2.bindings.providers.ClusterEventBusProvider;
import org.graylog2.cluster.ClusterConfigServiceImpl;
import org.graylog2.cluster.nodes.DataNodeClusterService;
import org.graylog2.cluster.nodes.DataNodeDto;
import org.graylog2.cluster.nodes.NodeService;
import org.graylog2.events.ClusterEventBus;
import org.graylog2.jackson.InputConfigurationBeanDeserializerModifier;
import org.graylog2.plugin.cluster.ClusterConfigService;
import org.graylog2.plugin.cluster.ClusterIdFactory;
import org.graylog2.plugin.cluster.RandomUUIDClusterIdFactory;
import org.graylog2.plugin.inject.Graylog2Module;
import org.graylog2.shared.bindings.providers.EventBusProvider;
import org.graylog2.shared.system.activities.ActivityWriter;

public class ServerBindings extends Graylog2Module {
private final Configuration configuration;
private final boolean isMigrationCommand;
public class DatanodeServerBindings extends Graylog2Module {

public ServerBindings(Configuration configuration, boolean isMigrationCommand) {

this.configuration = configuration;
this.isMigrationCommand = isMigrationCommand;
public DatanodeServerBindings() {
}

@Override
protected void configure() {
bindInterfaces();
bindSingletons();

bindProviders();
bindFactoryModules();
bindDynamicFeatures();
bindExceptionMappers();
bindAdditionalJerseyComponents();
// install(new AuthenticatingRealmModule(configuration));
// install(new AuthorizationOnlyRealmModule());
}

private void bindProviders() {
bind(ClusterEventBus.class).toProvider(ClusterEventBusProvider.class).asEagerSingleton();
bind(EventBus.class).toProvider(EventBusProvider.class).asEagerSingleton();
bind(InputConfigurationBeanDeserializerModifier.class).toInstance(InputConfigurationBeanDeserializerModifier.withoutConfig());
}

private void bindFactoryModules() {
// System Jobs
}

private void bindSingletons() {
bind(ClusterConfigService.class).to(ClusterConfigServiceImpl.class).asEagerSingleton();
Expand All @@ -83,14 +55,11 @@ private void bindInterfaces() {
}

private void bindDynamicFeatures() {
final Multibinder<Class<? extends DynamicFeature>> dynamicFeatures = jerseyDynamicFeatureBinder();
jerseyDynamicFeatureBinder();
}

private void bindExceptionMappers() {
final Multibinder<Class<? extends ExceptionMapper>> exceptionMappers = jerseyExceptionMapperBinder();
jerseyExceptionMapperBinder();
}

private void bindAdditionalJerseyComponents() {
// jerseyAdditionalComponentsBinder().addBinding().toInstance(GenericErrorCsvWriter.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,33 @@

import com.google.common.util.concurrent.Service;
import com.google.inject.AbstractModule;
import com.google.inject.TypeLiteral;
import com.google.inject.multibindings.Multibinder;
import org.graylog.datanode.configuration.DatanodeTrustManagerProvider;
import org.graylog.datanode.configuration.OpensearchConfigurationService;
import org.graylog.datanode.configuration.variants.DatanodeKeystoreOpensearchCertificatesProvider;
import org.graylog.datanode.configuration.variants.LocalConfigurationCertificatesProvider;
import org.graylog.datanode.configuration.variants.NoOpensearchCertificatesProvider;
import org.graylog.datanode.configuration.variants.OpensearchCertificatesProvider;
import org.graylog.datanode.metrics.ConfigureMetricsIndexSettings;
import org.graylog.datanode.opensearch.OpensearchProcess;
import org.graylog.datanode.opensearch.OpensearchProcessImpl;
import org.graylog.datanode.opensearch.OpensearchProcessService;
import org.graylog.datanode.opensearch.configuration.OpensearchConfigurationParams;
import org.graylog.datanode.opensearch.configuration.OpensearchUsableSpace;
import org.graylog.datanode.opensearch.configuration.OpensearchUsableSpaceProvider;
import org.graylog.datanode.opensearch.configuration.beans.OpensearchConfigurationBean;
import org.graylog.datanode.opensearch.configuration.beans.impl.OpensearchClusterConfigurationBean;
import org.graylog.datanode.opensearch.configuration.beans.impl.OpensearchCommonConfigurationBean;
import org.graylog.datanode.opensearch.configuration.beans.impl.OpensearchDefaultConfigFilesBean;
import org.graylog.datanode.opensearch.configuration.beans.impl.OpensearchSecurityConfigurationBean;
import org.graylog.datanode.opensearch.configuration.beans.impl.SearchableSnapshotsConfigurationBean;
import org.graylog.datanode.opensearch.statemachine.OpensearchStateMachine;
import org.graylog.datanode.opensearch.statemachine.OpensearchStateMachineProvider;
import org.graylog.datanode.opensearch.statemachine.tracer.ClusterNodeStateTracer;
import org.graylog.datanode.opensearch.statemachine.tracer.OpensearchWatchdog;
import org.graylog.datanode.opensearch.statemachine.tracer.StateMachineTracer;
import org.graylog.datanode.opensearch.statemachine.tracer.StateMachineTransitionLogger;
import org.graylog.datanode.process.configuration.beans.DatanodeConfigurationBean;

public class OpensearchProcessBindings extends AbstractModule {

Expand All @@ -49,9 +59,21 @@ protected void configure() {

bind(OpensearchUsableSpace.class).toProvider(OpensearchUsableSpaceProvider.class).asEagerSingleton();

//opensearch configuration beans
Multibinder<OpensearchConfigurationBean> opensearchConfigurationBeanMultibinder = Multibinder.newSetBinder(binder(), OpensearchConfigurationBean.class);
//opensearch certificate providers
Multibinder<OpensearchCertificatesProvider> opensearchCertificatesProviders = Multibinder.newSetBinder(binder(), OpensearchCertificatesProvider.class);
opensearchCertificatesProviders.addBinding().to(LocalConfigurationCertificatesProvider.class).asEagerSingleton();
opensearchCertificatesProviders.addBinding().to(DatanodeKeystoreOpensearchCertificatesProvider.class).asEagerSingleton();
opensearchCertificatesProviders.addBinding().to(NoOpensearchCertificatesProvider.class).asEagerSingleton();


//opensearch configuration beans. The order of the beans is important here!

Multibinder<DatanodeConfigurationBean<OpensearchConfigurationParams>> opensearchConfigurationBeanMultibinder = Multibinder.newSetBinder(binder(), new TypeLiteral<DatanodeConfigurationBean<OpensearchConfigurationParams>>() {});
opensearchConfigurationBeanMultibinder.addBinding().to(OpensearchDefaultConfigFilesBean.class).asEagerSingleton();
opensearchConfigurationBeanMultibinder.addBinding().to(OpensearchCommonConfigurationBean.class).asEagerSingleton();
opensearchConfigurationBeanMultibinder.addBinding().to(OpensearchClusterConfigurationBean.class).asEagerSingleton();
opensearchConfigurationBeanMultibinder.addBinding().to(SearchableSnapshotsConfigurationBean.class).asEagerSingleton();
opensearchConfigurationBeanMultibinder.addBinding().to(OpensearchSecurityConfigurationBean.class).asEagerSingleton();

// this service both starts and provides the opensearch process
serviceBinder.addBinding().to(OpensearchConfigurationService.class).asEagerSingleton();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
import org.graylog.datanode.bootstrap.preflight.DatanodeKeystoreCheck;
import org.graylog.datanode.bootstrap.preflight.OpenSearchPreconditionsCheck;
import org.graylog.datanode.bootstrap.preflight.OpensearchBinPreflightCheck;
import org.graylog.datanode.bootstrap.preflight.OpensearchConfigSync;
import org.graylog.datanode.bootstrap.preflight.OpensearchDataDirCompatibilityCheck;
import org.graylog.datanode.opensearch.CsrRequester;
import org.graylog.datanode.opensearch.CsrRequesterImpl;
import org.graylog2.bindings.providers.MongoConnectionProvider;
import org.graylog2.bootstrap.preflight.MongoDBPreflightCheck;
import org.graylog2.bootstrap.preflight.PreflightCheck;
import org.graylog2.cluster.certificates.CertificateExchange;
import org.graylog2.cluster.certificates.CertificateExchangeImpl;
Expand All @@ -41,7 +41,7 @@ protected void configure() {
bind(CsrRequester.class).to(CsrRequesterImpl.class).asEagerSingleton();
bind(CertificateExchange.class).to(CertificateExchangeImpl.class);

addPreflightCheck(OpensearchConfigSync.class);
addPreflightCheck(MongoDBPreflightCheck.class);
addPreflightCheck(DatanodeDnsPreflightCheck.class);
addPreflightCheck(OpensearchBinPreflightCheck.class);
addPreflightCheck(DatanodeDirectoriesLockfileCheck.class);
Expand Down
Loading

0 comments on commit 5541d48

Please sign in to comment.