ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oleew...@apache.org
Subject ambari git commit: AMBARI-20844. Remove docker java client from Log Search it framework (oleewere)
Date Wed, 26 Apr 2017 10:47:43 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 2ff8c0116 -> 4d8c8e375


AMBARI-20844. Remove docker java client from Log Search it framework (oleewere)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4d8c8e37
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4d8c8e37
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4d8c8e37

Branch: refs/heads/trunk
Commit: 4d8c8e3757e774cf7b6ad544ebbd93c744632ea9
Parents: 2ff8c01
Author: oleewere <oleewere@gmail.com>
Authored: Tue Apr 25 14:14:58 2017 +0200
Committer: oleewere <oleewere@gmail.com>
Committed: Wed Apr 26 12:44:11 2017 +0200

----------------------------------------------------------------------
 ambari-logsearch/ambari-logsearch-it/pom.xml    |  21 +-
 .../logsearch/domain/StoryDataRegistry.java     |  33 +--
 .../logsearch/steps/LogSearchDockerSteps.java   | 201 ++++++-------------
 .../ambari/logsearch/steps/SolrSteps.java       |   4 +-
 .../story/log_search_api_query_story.story      |   2 +-
 ambari-logsearch/docker/logsearch-docker.sh     |  10 +-
 6 files changed, 103 insertions(+), 168 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4d8c8e37/ambari-logsearch/ambari-logsearch-it/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/pom.xml b/ambari-logsearch/ambari-logsearch-it/pom.xml
index be7ab57..ee97e99 100644
--- a/ambari-logsearch/ambari-logsearch-it/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-it/pom.xml
@@ -35,6 +35,7 @@
     <jbehave.version>4.0.5</jbehave.version>
     <jersey.version>2.23.1</jersey.version>
     <jackson-jaxrs.version>2.6.4</jackson-jaxrs.version>
+    <forkCount>1</forkCount>
   </properties>
 
   <dependencies>
@@ -58,11 +59,6 @@
       <version>2.5</version>
     </dependency>
     <dependency>
-      <groupId>com.github.docker-java</groupId>
-      <artifactId>docker-java</artifactId>
-      <version>3.0.0</version>
-    </dependency>
-    <dependency>
       <groupId>com.fasterxml.jackson.jaxrs</groupId>
       <artifactId>jackson-jaxrs-json-provider</artifactId>
       <version>${jackson-jaxrs.version}</version>
@@ -87,6 +83,21 @@
       <artifactId>zjsonpatch</artifactId>
       <version>0.2.4</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.ambari</groupId>
+      <artifactId>ambari-logsearch-server</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ambari</groupId>
+      <artifactId>ambari-logsearch-web</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ambari</groupId>
+      <artifactId>ambari-logsearch-logfeeder</artifactId>
+      <version>${project.version}</version>
+    </dependency>
   </dependencies>
 
   <build>

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d8c8e37/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/domain/StoryDataRegistry.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/domain/StoryDataRegistry.java
b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/domain/StoryDataRegistry.java
index 564972a..cb72376 100644
--- a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/domain/StoryDataRegistry.java
+++ b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/domain/StoryDataRegistry.java
@@ -18,19 +18,16 @@
  */
 package org.apache.ambari.logsearch.domain;
 
-import com.github.dockerjava.api.DockerClient;
-import com.github.dockerjava.core.DockerClientConfig;
-import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.SolrClient;
 
 public class StoryDataRegistry {
   public static final StoryDataRegistry INSTANCE = new StoryDataRegistry();
 
-  private DockerClient dockerClient;
-  private DockerClientConfig dockerClientConfig;
-  private CloudSolrClient cloudSolrClient;
+  private SolrClient solrClient;
   private boolean logsearchContainerStarted = false;
   private String dockerHost;
   private String ambariFolder;
+  private String shellScriptLocation;
   private final int solrPort = 8886;
   private final int logsearchPort = 61888;
   private final int zookeeperPort = 9983;
@@ -60,14 +57,6 @@ public class StoryDataRegistry {
     return zookeeperPort;
   }
 
-  public DockerClient getDockerClient() {
-    return dockerClient;
-  }
-
-  public void setDockerClient(DockerClient dockerClient) {
-    this.dockerClient = dockerClient;
-  }
-
   public String getServiceLogsCollection() {
     return serviceLogsCollection;
   }
@@ -76,12 +65,12 @@ public class StoryDataRegistry {
     return auditLogsCollection;
   }
 
-  public CloudSolrClient getCloudSolrClient() {
-    return cloudSolrClient;
+  public SolrClient getSolrClient() {
+    return solrClient;
   }
 
-  public void setCloudSolrClient(CloudSolrClient cloudSolrClient) {
-    this.cloudSolrClient = cloudSolrClient;
+  public void setSolrClient(SolrClient solrClient) {
+    this.solrClient = solrClient;
   }
 
   public String getAmbariFolder() {
@@ -92,12 +81,12 @@ public class StoryDataRegistry {
     this.ambariFolder = ambariFolder;
   }
 
-  public DockerClientConfig getDockerClientConfig() {
-    return dockerClientConfig;
+  public String getShellScriptLocation() {
+    return shellScriptLocation;
   }
 
-  public void setDockerClientConfig(DockerClientConfig dockerClientConfig) {
-    this.dockerClientConfig = dockerClientConfig;
+  public void setShellScriptLocation(String shellScriptLocation) {
+    this.shellScriptLocation = shellScriptLocation;
   }
 
   public boolean isLogsearchContainerStarted() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d8c8e37/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchDockerSteps.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchDockerSteps.java
b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchDockerSteps.java
index 91e0b10..32e8cba 100644
--- a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchDockerSteps.java
+++ b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchDockerSteps.java
@@ -18,23 +18,13 @@
  */
 package org.apache.ambari.logsearch.steps;
 
-import com.github.dockerjava.api.DockerClient;
-import com.github.dockerjava.api.command.CreateContainerResponse;
-import com.github.dockerjava.api.model.Bind;
-import com.github.dockerjava.api.model.Container;
-import com.github.dockerjava.api.model.ExposedPort;
-import com.github.dockerjava.api.model.Ports;
-import com.github.dockerjava.api.model.Volume;
-import com.github.dockerjava.core.DockerClientBuilder;
-import com.github.dockerjava.core.DockerClientConfig;
-import com.github.dockerjava.core.command.BuildImageResultCallback;
-import com.google.common.base.Preconditions;
 import org.apache.ambari.logsearch.domain.StoryDataRegistry;
-import org.apache.commons.lang.ArrayUtils;
+import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.impl.LBHttpSolrClient;
 import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.client.solrj.response.SolrPingResponse;
 import org.apache.solr.common.SolrDocumentList;
 import org.jbehave.core.annotations.AfterStories;
 import org.jbehave.core.annotations.BeforeStories;
@@ -43,12 +33,13 @@ import org.jbehave.core.annotations.When;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.net.InetSocketAddress;
 import java.net.Socket;
 import java.net.URL;
-import java.util.List;
 
 public class LogSearchDockerSteps {
 
@@ -58,69 +49,22 @@ public class LogSearchDockerSteps {
   public void setupLogSearchContainer() throws Exception {
     boolean logsearchStarted = StoryDataRegistry.INSTANCE.isLogsearchContainerStarted();
     if (!logsearchStarted) {
-      DockerClient dockerClient = StoryDataRegistry.INSTANCE.getDockerClient();
       LOG.info("Create new docker container for Log Search ..");
       URL location = LogSearchDockerSteps.class.getProtectionDomain().getCodeSource().getLocation();
       String ambariFolder = new File(location.toURI()).getParentFile().getParentFile().getParentFile().getParent();
       StoryDataRegistry.INSTANCE.setAmbariFolder(ambariFolder);
-      String dockerBaseDirectory = ambariFolder + "/ambari-logsearch/docker";
-      String dockerFileLocation = dockerBaseDirectory + "/Dockerfile";
-
-      String imageId = dockerClient.buildImageCmd()
-        .withTag("ambari-logsearch:v1.0")
-        .withBaseDirectory(new File(dockerBaseDirectory))
-        .withDockerfile(new File(dockerFileLocation))
-        .exec(new BuildImageResultCallback())
-        .awaitImageId();
-      LOG.info("Docker image id: {}", imageId);
-
-      removeLogSearchContainerIfExists();
-
-      // volume bindings
-      Volume testLogsVolume = new Volume("/root/test-logs");
-      Volume testConfigVolume = new Volume("/root/test-config");
-      Volume ambariVolume = new Volume("/root/ambari");
-      Volume logfeederClassesVolume = new Volume("/root/ambari/ambari-logsearch/ambari-logsearch-logfeeder/target/package/classes");
-      Volume logsearchClassesVolume = new Volume("/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes");
-      Volume logsearchWebappVolume = new Volume("/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes/webapps/app");
-      Volume logsearchWebappLibsVolume = new Volume("/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes/webapps/app/libs/bower");
-      Bind testLogsBind = new Bind(ambariFolder +"/ambari-logsearch/docker/test-logs", testLogsVolume);
-      Bind testConfigBind = new Bind(ambariFolder +"/ambari-logsearch/docker/test-config",
testConfigVolume);
-      Bind ambariRootBind = new Bind(ambariFolder, ambariVolume);
-      Bind logfeederClassesBind = new Bind(ambariFolder + "/ambari-logsearch/ambari-logsearch-logfeeder/target/classes",
logfeederClassesVolume);
-      Bind logsearchClassesBind = new Bind(ambariFolder + "/ambari-logsearch/ambari-logsearch-server/target/classes",
logsearchClassesVolume);
-      Bind logsearchWebappBind = new Bind(ambariFolder + "/ambari-logsearch/ambari-logsearch-web/src/main/webapp",
logsearchWebappVolume);
-      Bind logsearchWebappLibsBind = new Bind(ambariFolder + "/ambari-logsearch/ambari-logsearch-web/target/libs",
logsearchWebappLibsVolume);
-
-      // port bindings
-      Ports ports = new Ports();
-      ports.bind(new ExposedPort(5005), new Ports.Binding("0.0.0.0", "5005"));
-      ports.bind(new ExposedPort(5006), new Ports.Binding("0.0.0.0", "5006"));
-      ports.bind(new ExposedPort(StoryDataRegistry.INSTANCE.getSolrPort()), new Ports.Binding("0.0.0.0",
"8886"));
-      ports.bind(new ExposedPort(StoryDataRegistry.INSTANCE.getLogsearchPort()), new Ports.Binding("0.0.0.0",
"61888"));
-      ports.bind(new ExposedPort(StoryDataRegistry.INSTANCE.getZookeeperPort()), new Ports.Binding("0.0.0.0",
"9983"));
-
-      LOG.info("Creating docker cointainer...");
-      CreateContainerResponse createResponse = dockerClient.createContainerCmd("ambari-logsearch:v1.0")
-        .withHostName("logsearch.apache.org")
-        .withName("logsearch")
-        .withVolumes(testLogsVolume, testConfigVolume, ambariVolume, logfeederClassesVolume,
logsearchClassesVolume, logsearchWebappVolume, logsearchWebappLibsVolume)
-        .withBinds(testLogsBind, testConfigBind, ambariRootBind, logfeederClassesBind, logsearchClassesBind,
logsearchWebappBind, logsearchWebappLibsBind)
-        .withExposedPorts(
-          new ExposedPort(StoryDataRegistry.INSTANCE.getLogsearchPort()),
-          new ExposedPort(5005),
-          new ExposedPort(5006),
-          new ExposedPort(StoryDataRegistry.INSTANCE.getSolrPort()),
-          new ExposedPort(StoryDataRegistry.INSTANCE.getZookeeperPort()))
-        .withPortBindings(ports)
-        .exec();
-      LOG.info("Created docker container id: {}", createResponse.getId());
-
-      dockerClient.startContainerCmd(createResponse.getId()).exec();
+      String shellScriptLocation = ambariFolder + "/ambari-logsearch/docker/logsearch-docker.sh";
+      StoryDataRegistry.INSTANCE.setShellScriptLocation(shellScriptLocation);
+      String output = runCommand(new String[]{StoryDataRegistry.INSTANCE.getShellScriptLocation(),
"start"});
+      LOG.info("Command output: {}", output);
       StoryDataRegistry.INSTANCE.setLogsearchContainerStarted(true);
-      String dockerHostFromUri = StoryDataRegistry.INSTANCE.getDockerClientConfig().getDockerHost().getHost();
+
+      // TODO: create a script which returns the proper host for docker, use: runCommand
or an env variable
+      String dockerHostFromUri = "localhost";
+
       StoryDataRegistry.INSTANCE.setDockerHost(dockerHostFromUri);
       checkHostAndPortReachable(dockerHostFromUri, StoryDataRegistry.INSTANCE.getLogsearchPort(),
"LogSearch");
+      waitUntilSolrIsUp();
       waitUntilSolrHasAnyData();
 
       LOG.info("Waiting for logfeeder to finish the test log parsings... (10 sec)");
@@ -131,93 +75,69 @@ public class LogSearchDockerSteps {
   @When("logfeeder started (parse logs & send data to solr)")
   public void logfeederStarted() throws Exception {
     // TODO: run ps aux to check LogFeeder process with docker exec
-    /**
-    DockerClient dockerClient = StoryDataRegistry.INSTANCE.getDockerClient();
-    ExecCreateCmdResponse execResp = dockerClient
-      .execCreateCmd(containerId)
-      .withAttachStdout(true)
-      .withCmd("ps", "aux").exec();
-    execResp.getId();
-    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-    ExecStartResultCallback res = dockerClient
-      .execStartCmd(execResp.getId())
-      .withDetach(true)
-      .withTty(true)
-      .exec(new ExecStartResultCallback(outputStream,  outputStream)).awaitCompletion();
-     **/
   }
 
   @BeforeStories
   public void checkDockerApi() {
-    LOG.info("Tries to setup docker client configuration");
-    final String dockerHost = System.getenv("DOCKER_HOST");
-    final String dockerCertPath = System.getenv("DOCKER_CERT_PATH");
-    final String dockerApiVersion = System.getenv("DOCKER_API_VERSION") == null ? "1.20"
: System.getenv("DOCKER_API_VERSION");
-
-    Preconditions.checkArgument(dockerHost != null, "Set 'DOCKER_HOST' env variable");
-    Preconditions.checkArgument(dockerCertPath != null, "Set 'DOCKER_CERT_PATH' env variable");
-    LOG.info("DOCKER_HOST: {}", dockerHost);
-    LOG.info("DOCKER_CERT_PATH: {}", dockerCertPath);
-    LOG.info("DOCKER_API_VERSION: {}", dockerApiVersion);
-    DockerClientConfig dockerClientConfig = DockerClientConfig.createDefaultConfigBuilder()
-      .withDockerHost(dockerHost)
-      .withDockerCertPath(dockerCertPath)
-      .withApiVersion(dockerApiVersion)
-      .withDockerTlsVerify(true)
-      .build();
-    StoryDataRegistry.INSTANCE.setDockerClientConfig(dockerClientConfig);
-    DockerClient dockerClient = DockerClientBuilder.getInstance(dockerClientConfig).build();
-    StoryDataRegistry.INSTANCE.setDockerClient(dockerClient);
-    LOG.info("Docker client setup successfully.");
+    // TODO: check docker is up
   }
 
   @AfterStories
   public void removeLogSearchContainer() {
-    removeLogSearchContainerIfExists();
+    runCommand(new String[]{StoryDataRegistry.INSTANCE.getShellScriptLocation(), "stop"});
   }
 
-  private void removeLogSearchContainerIfExists() {
-    DockerClient dockerClient = StoryDataRegistry.INSTANCE.getDockerClient();
-    List<Container> containerList = dockerClient
-      .listContainersCmd()
-      .withShowAll(true)
-      .exec();
-
-    boolean isLogSearchContainerExists = false;
-    String containerId = null;
-    for (Container container : containerList) {
-      isLogSearchContainerExists = ArrayUtils.contains(container.getNames(), "/logsearch");
-      if (isLogSearchContainerExists) {
-        containerId = container.getId();
-        break;
+  private void waitUntilSolrIsUp() throws Exception {
+    int maxTries = 30;
+    boolean solrIsUp = false;
+    for (int tries = 1; tries < maxTries; tries++) {
+      try {
+        SolrClient solrClient = new LBHttpSolrClient(String.format("http://%s:%d/solr/%s_shard0_replica1",
+          StoryDataRegistry.INSTANCE.getDockerHost(),
+          StoryDataRegistry.INSTANCE.getSolrPort(),
+          StoryDataRegistry.INSTANCE.getServiceLogsCollection()));
+        StoryDataRegistry.INSTANCE.setSolrClient(solrClient);
+        SolrPingResponse pingResponse = solrClient.ping();
+        if (pingResponse.getStatus() != 0) {
+          LOG.info("Solr is not up yet, retrying... ({})", tries);
+          Thread.sleep(2000);
+        } else {
+          solrIsUp = true;
+          LOG.info("Solr is up and running");
+          break;
+        }
+      } catch (Exception e) {
+        LOG.error("Error occurred during pinging solr ({}). retrying {} times", e.getMessage(),
tries);
+        Thread.sleep(2000);
       }
     }
 
-    if (isLogSearchContainerExists) {
-      LOG.info("Remove logsearch container: {}", containerId);
-      dockerClient.removeContainerCmd(containerId).withForce(true).exec();
+    if (!solrIsUp) {
+      throw new IllegalStateException(String.format("Solr is not up after %d tries", maxTries));
     }
   }
 
   private void waitUntilSolrHasAnyData() throws IOException, SolrServerException, InterruptedException
{
     boolean solrHasData = false;
-    CloudSolrClient solrClient = new CloudSolrClient(String.format("%s:%d",
-      StoryDataRegistry.INSTANCE.getDockerHost(),
-      StoryDataRegistry.INSTANCE.getZookeeperPort()));
-    StoryDataRegistry.INSTANCE.setCloudSolrClient(solrClient);
-    SolrQuery solrQuery = new SolrQuery();
-    solrQuery.setQuery("*:*");
 
     int maxTries = 60;
     for (int tries = 1; tries < maxTries; tries++) {
-      QueryResponse queryResponse = solrClient.query(StoryDataRegistry.INSTANCE.getServiceLogsCollection(),
solrQuery);
-      SolrDocumentList list = queryResponse.getResults();
-      if (list.size() > 0) {
-        solrHasData = true;
-        break;
-      } else {
+      try {
+        SolrClient solrClient = StoryDataRegistry.INSTANCE.getSolrClient();
+        SolrQuery solrQuery = new SolrQuery();
+        solrQuery.setQuery("*:*");
+        QueryResponse queryResponse = solrClient.query(solrQuery);
+        SolrDocumentList list = queryResponse.getResults();
+        if (list.size() > 0) {
+          solrHasData = true;
+          break;
+        } else {
+          Thread.sleep(2000);
+          LOG.info("Solr has no data yet, retrying... ({} tries)", tries);
+        }
+      } catch (Exception e) {
+        LOG.error("Error occurred during checking solr ({}). retrying {} times", e.getMessage(),
tries);
         Thread.sleep(2000);
-        LOG.info("Solr has no data yet, retrying...");
       }
     }
     if (!solrHasData) {
@@ -243,4 +163,15 @@ public class LogSearchDockerSteps {
       throw new IllegalStateException(String.format("%s is not reachable after %s tries",
serviceName, maxTries));
     }
   }
+
+
+  private String runCommand(String[] command) {
+    try {
+      Process process = Runtime.getRuntime().exec(command);
+      BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+      return reader.readLine();
+    } catch (Exception e) {
+      throw new RuntimeException("Error during execute shell command: ", e);
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d8c8e37/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/SolrSteps.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/SolrSteps.java
b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/SolrSteps.java
index 7c72ca7..4420540 100644
--- a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/SolrSteps.java
+++ b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/SolrSteps.java
@@ -35,12 +35,12 @@ public class SolrSteps {
   @Then("the number of <component> docs is: <docSize>")
   public void numberOfDocsForComponent(@Named("component") String component, @Named("docSize")
int docSize)
     throws IOException, SolrServerException, InterruptedException {
-    SolrClient solrClient = StoryDataRegistry.INSTANCE.getCloudSolrClient();
+    SolrClient solrClient = StoryDataRegistry.INSTANCE.getSolrClient();
     SolrQuery solrQuery = new SolrQuery();
     solrQuery.setQuery(String.format("type:%s", component));
     solrQuery.setStart(0);
     solrQuery.setRows(20);
-    QueryResponse queryResponse = solrClient.query(StoryDataRegistry.INSTANCE.getServiceLogsCollection(),
solrQuery);
+    QueryResponse queryResponse = solrClient.query(solrQuery);
     SolrDocumentList list = queryResponse.getResults();
     Assert.assertEquals(docSize, list.size());
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d8c8e37/ambari-logsearch/ambari-logsearch-it/src/test/resources/org/apache/ambari/logsearch/story/log_search_api_query_story.story
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/src/test/resources/org/apache/ambari/logsearch/story/log_search_api_query_story.story
b/ambari-logsearch/ambari-logsearch-it/src/test/resources/org/apache/ambari/logsearch/story/log_search_api_query_story.story
index 5abe8b4..cfaa359 100644
--- a/ambari-logsearch/ambari-logsearch-it/src/test/resources/org/apache/ambari/logsearch/story/log_search_api_query_story.story
+++ b/ambari-logsearch/ambari-logsearch-it/src/test/resources/org/apache/ambari/logsearch/story/log_search_api_query_story.story
@@ -14,4 +14,4 @@ Then The api query result is <jsonResult>
 Examples:
 |apiQuery|jsonResult|
 |/api/v1/service/logs/schema/fields|service-log-schema.json|
-|/api/v1/service/logs/levels/counts/namevalues?page=0&pageSize=25&startIndex=0&q=*%3A*|service-log-level-counts-values.json|
\ No newline at end of file
+|/api/v1/service/logs/levels/counts?page=0&pageSize=25&startIndex=0&q=*%3A*|service-log-level-counts-values.json|
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d8c8e37/ambari-logsearch/docker/logsearch-docker.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/logsearch-docker.sh b/ambari-logsearch/docker/logsearch-docker.sh
index 1fdcd8c..eab850e 100755
--- a/ambari-logsearch/docker/logsearch-docker.sh
+++ b/ambari-logsearch/docker/logsearch-docker.sh
@@ -33,12 +33,14 @@ function build_logsearch_container() {
 function start_logsearch_container() {
   setup_profile
   source $sdir/Profile
-  : ${AMBARI_LOCATION:?"Please set the AMBARI_LOCATION in Profile"}
+  pushd $sdir/../../
+  local AMBARI_LOCATION=$(pwd)
+  popd
   : ${MAVEN_REPOSITORY_LOCATION:?"Please set the MAVEN_REPOSITORY_LOCATION in Profile"}
   kill_logsearch_container
   echo "Run Log Search container"
   docker run -d --name logsearch --hostname logsearch.apache.org \
-    -v $AMBARI_LOCATION:/root/ambari -v $MAVEN_REPOSITORY_LOCATION:/root/.m2 $LOGSEARCH_EXPOSED_PORTS
$LOGSEARCH_ENV_OPTS $LOGSEARCH_EXTRA_OPTS $LOGSEARCH_VOLUME_OPTS \
+    -v $AMBARI_LOCATION:/root/ambari -v $MAVEN_REPOSITORY_LOCATION:/root/.m2 $LOGSEARCH_EXPOSED_PORTS
$LOGSEARCH_ENV_OPTS $LOGSEARCH_EXTRA_OPTS $LOGSEARCH_VOLUME_OPTS -p 9983:9983 \
     -v $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-logfeeder/target/classes:/root/ambari/ambari-logsearch/ambari-logsearch-logfeeder/target/package/classes
\
     -v $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-server/target/classes:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes
\
     -v $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-web/src/main/webapp:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes/webapps/app
\
@@ -55,8 +57,10 @@ function setup_profile() {
     echo "Profile file exists"
   else
     echo "Profile does not exist, Creating a new one..."
+    pushd $sdir/../../
+    local AMBARI_LOCATION=$(pwd)
+    popd
     cat << EOF > $sdir/Profile
-AMBARI_LOCATION=$HOME/prj/ambari
 MAVEN_REPOSITORY_LOCATION=$HOME/.m2
 LOGSEARCH_EXPOSED_PORTS="-p 8886:8886 -p 61888:61888 -p 5005:5005 -p 5006:5006"
 LOGSEARCH_ENV_OPTS="-e LOGFEEDER_DEBUG_SUSPEND=n -e LOGSEARCH_DEBUG_SUSPEND=n -e COMPONENT_LOG=logsearch
-e LOGSEARCH_HTTPS_ENABLED=false -e LOGSEARCH_SOLR_SSL_ENABLED=false -e GENERATE_KEYSTORE_AT_START=false"


Mime
View raw message