Skip to content

Commit

Permalink
Merge pull request #495 from mesos/bug/elasticsearch-config-location
Browse files Browse the repository at this point in the history
Elasticsearch settings location can now be any location
  • Loading branch information
frankscholten committed Feb 16, 2016
2 parents bce3ed4 + beb7fff commit a1e697b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ public String getElasticsearchClusterName() {

public static final String ELASTICSEARCH_SETTINGS_LOCATION = "--elasticsearchSettingsLocation";
@Parameter(names = {ELASTICSEARCH_SETTINGS_LOCATION},
description = "Path or URL to ES yml settings file. [In docker mode file must be in /tmp/config] E.g. '/tmp/config/elasticsearch.yml' or 'https://gist.githubusercontent.com/mmaloney/5e1da5daa58b70a3a671/raw/elasticsearch.yml'",
description = "Path or URL to ES yml settings file. Path example: '/var/lib/mesos/config/elasticsearch.yml'." +
" URL example: 'https://gist.githubusercontent.com/mmaloney/5e1da5daa58b70a3a671/raw/elasticsearch.yml'." +
" In Docker mode a volume will be created from /tmp/config in the container to the directory that contains elasticsearch.yml.",
validateWith = CLIValidators.NotEmptyString.class)
private String elasticsearchSettingsLocation = "";
public String getElasticsearchSettingsLocation() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,12 @@ private Protos.ExecutorInfo.Builder newExecutorInfo(Configuration configuration)
.setForcePullImage(configuration.getExecutorForcePullImage())
.setNetwork(Protos.ContainerInfo.DockerInfo.Network.HOST);

String elasticsearchConfigPath = configuration.getElasticsearchSettingsLocation().replace("/elasticsearch.yml", "");

executorInfoBuilder.setContainer(Protos.ContainerInfo.newBuilder()
.setType(Protos.ContainerInfo.Type.DOCKER)
.setDocker(containerBuilder)
.addVolumes(Protos.Volume.newBuilder().setHostPath(CONTAINER_PATH_SETTINGS).setContainerPath(CONTAINER_PATH_SETTINGS).setMode(Protos.Volume.Mode.RO)) // Temporary fix until we get a data container.
.addVolumes(Protos.Volume.newBuilder().setHostPath(elasticsearchConfigPath).setContainerPath(CONTAINER_PATH_SETTINGS).setMode(Protos.Volume.Mode.RO)) // Temporary fix until we get a data container.
.addVolumes(Protos.Volume.newBuilder().setContainerPath(CONTAINER_DATA_VOLUME).setHostPath(configuration.getDataDir()).setMode(Protos.Volume.Mode.RW).build())
.build())
.addResources(Resources.cpus(configuration.getExecutorCpus(), configuration.getFrameworkRole()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void before() {
when(configuration.getTaskName()).thenReturn("esdemo");
when(configuration.getMesosZKURL()).thenReturn("zk://zookeeper:2181/mesos");
when(configuration.getExecutorImage()).thenReturn(Configuration.DEFAULT_EXECUTOR_IMAGE);
when(configuration.getElasticsearchSettingsLocation()).thenReturn("/var");
when(configuration.getElasticsearchSettingsLocation()).thenReturn("/var/elasticsearch.yml");
when(configuration.getElasticsearchNodes()).thenReturn(3);
when(configuration.getElasticsearchClusterName()).thenReturn("cluster-name");
when(configuration.getDataDir()).thenReturn("/var/lib/mesos/slave/elasticsearch");
Expand Down Expand Up @@ -105,7 +105,7 @@ public void testCreateTaskInfo() {

assertEquals(2, taskInfo.getExecutor().getContainer().getVolumesCount());
assertEquals(CONTAINER_PATH_SETTINGS, taskInfo.getExecutor().getContainer().getVolumes(0).getContainerPath());
assertEquals(CONTAINER_PATH_SETTINGS, taskInfo.getExecutor().getContainer().getVolumes(0).getHostPath());
assertEquals("/var", taskInfo.getExecutor().getContainer().getVolumes(0).getHostPath());
assertEquals(Protos.Volume.Mode.RO, taskInfo.getExecutor().getContainer().getVolumes(0).getMode());
assertEquals(CONTAINER_DATA_VOLUME, taskInfo.getExecutor().getContainer().getVolumes(1).getContainerPath());
assertEquals(Configuration.DEFAULT_HOST_DATA_DIR, taskInfo.getExecutor().getContainer().getVolumes(1).getHostPath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public Integer getDocumentCount(String httpAddress) throws UnirestException {

public void waitForCorrectDocumentCount(Integer docCount) throws UnirestException {
List<String> esAddresses = getEsHttpAddressList();
Awaitility.await().atMost(1, TimeUnit.MINUTES).pollDelay(2, TimeUnit.SECONDS).until(() -> {
Awaitility.await().atMost(2, TimeUnit.MINUTES).pollDelay(2, TimeUnit.SECONDS).until(() -> {
for (String httpAddress : esAddresses) {
try {
Integer count = getDocumentCount(httpAddress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
@SuppressWarnings({"PMD.TooManyMethods"})
public class ReconciliationSystemTest extends TestBase {
private static final int TIMEOUT = 60;
private static final int TIMEOUT = 120;
private static final ContainerLifecycleManagement CONTAINER_MANAGER = new ContainerLifecycleManagement();
private DockerUtil dockerUtil = new DockerUtil(CLUSTER_ARCHITECTURE.dockerClient);

Expand Down

0 comments on commit a1e697b

Please sign in to comment.