From 7edf5ef340e2407ea494465edc75bd603b547fbc Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Wed, 23 Oct 2024 14:24:48 -0400 Subject: [PATCH 01/14] Upgrade actions/upload-artifact from v2 to v3 Signed-off-by: Craig Perkins --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 6d6e30435..711555bab 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -33,7 +33,7 @@ jobs: working-directory: ./tmp/performance-analyzer-rca run: ./gradlew build --stacktrace - name: Upload reports - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: gradle-reports path: ./tmp/performance-analyzer-rca/build/reports From d61124bc5896d119dd66996f11400c09eb3c5027 Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Wed, 23 Oct 2024 17:05:54 -0400 Subject: [PATCH 02/14] Try changing base of container Signed-off-by: Craig Perkins --- docker/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index a3b882594..b65926e49 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -9,7 +9,7 @@ # Set gid=0 and make group perms==owner perms ################################################################################ -FROM centos:7 AS prep_open_search_files +FROM public.ecr.aws/amazonlinux/amazonlinux:2 AS prep_open_search_files ARG JDK_VER=11 ENV PATH /usr/share/opensearch/bin:$PATH @@ -79,6 +79,8 @@ FROM centos:7 ENV OPENSEARCH_CONTAINER true +RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf + RUN \ rpm --rebuilddb && yum clean all && \ yum install -y epel-release && \ From bde8ef6ec39e2f5888c63605ba80b2ac7d08c6ce Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Wed, 23 Oct 2024 17:08:26 -0400 Subject: [PATCH 03/14] Update all bases Signed-off-by: Craig Perkins --- docker/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index b65926e49..83d801962 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -75,12 +75,10 @@ fi # Add entrypoint ################################################################################ -FROM centos:7 +FROM public.ecr.aws/amazonlinux/amazonlinux:2 ENV OPENSEARCH_CONTAINER true -RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf - RUN \ rpm --rebuilddb && yum clean all && \ yum install -y epel-release && \ From 1a26b07169998ba3242a8709991108edaf4c74e5 Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Wed, 23 Oct 2024 17:19:21 -0400 Subject: [PATCH 04/14] Install tar Signed-off-by: Craig Perkins --- docker/Dockerfile | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 83d801962..1273a64b7 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,6 +14,8 @@ ARG JDK_VER=11 ENV PATH /usr/share/opensearch/bin:$PATH +RUN yum install -y tar + RUN if [[ "${JDK_VER}" = "17" ]] ; then \ curl -s https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz | tar -C /opt -zxf -; \ mkdir /opt/jdk ; \ @@ -79,23 +81,18 @@ FROM public.ecr.aws/amazonlinux/amazonlinux:2 ENV OPENSEARCH_CONTAINER true -RUN \ - rpm --rebuilddb && yum clean all && \ - yum install -y epel-release && \ - yum update -y && \ - yum install -y \ - iproute \ - python-setuptools \ - hostname \ - inotify-tools \ - yum-utils \ - which \ - jq \ - lsof \ - python-pip \ - rsync && \ - yum clean all && \ - pip install supervisor +RUN yum install -y iproute \ + python3-setuptools \ + hostname \ + inotify-tools \ + yum-utils \ + which \ + jq \ + lsof \ + python3-pip \ + rsync && \ + yum clean all && \ + pip3 install supervisor RUN yum update -y && \ yum install -y nc unzip wget which && \ From ef1d8feb8d4130a42b9968b4a40ea2d49ea9317b Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Wed, 23 Oct 2024 18:35:11 -0400 Subject: [PATCH 05/14] add gzip Signed-off-by: Craig Perkins --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 1273a64b7..882e01d9a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,7 +14,7 @@ ARG JDK_VER=11 ENV PATH /usr/share/opensearch/bin:$PATH -RUN yum install -y tar +RUN yum install -y tar gzip RUN if [[ "${JDK_VER}" = "17" ]] ; then \ curl -s https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz | tar -C /opt -zxf -; \ From 5babb83ea91d06a106ff27d2682c785591caba6d Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Wed, 23 Oct 2024 19:03:36 -0400 Subject: [PATCH 06/14] Add shadow-utils Signed-off-by: Craig Perkins --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 882e01d9a..1c7ea89cb 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,7 +14,7 @@ ARG JDK_VER=11 ENV PATH /usr/share/opensearch/bin:$PATH -RUN yum install -y tar gzip +RUN yum install -y tar gzip shadow-utils RUN if [[ "${JDK_VER}" = "17" ]] ; then \ curl -s https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz | tar -C /opt -zxf -; \ From 76b5e5b08bdc5bd3bf30d12a3106b5020f866db8 Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Wed, 23 Oct 2024 19:28:37 -0400 Subject: [PATCH 07/14] Create all dirs Signed-off-by: Craig Perkins --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index eee6761d6..387a56316 100644 --- a/build.gradle +++ b/build.gradle @@ -466,7 +466,7 @@ task copyAllArtifacts(type: Copy) { def paArtifacts = Paths.get(dockerBuildDir, 'pa', "opensearch-performance-analyzer-${version}.${file_ext}") dockerArtifactsDir = Paths.get(dockerBuildDir, 'rca-docker') - mkdir dockerArtifactsDir + mkdir -p dockerArtifactsDir from(dockerArtifacts) from(rcaArtifacts) From e8056df9437582e9a424060ac7c6fb61b13ac3ae Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Wed, 23 Oct 2024 19:42:34 -0400 Subject: [PATCH 08/14] remove -p Signed-off-by: Craig Perkins --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 387a56316..eee6761d6 100644 --- a/build.gradle +++ b/build.gradle @@ -466,7 +466,7 @@ task copyAllArtifacts(type: Copy) { def paArtifacts = Paths.get(dockerBuildDir, 'pa', "opensearch-performance-analyzer-${version}.${file_ext}") dockerArtifactsDir = Paths.get(dockerBuildDir, 'rca-docker') - mkdir -p dockerArtifactsDir + mkdir dockerArtifactsDir from(dockerArtifacts) from(rcaArtifacts) From daaad12b27d29e3b6f7554edee28cfe2ca929e2c Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Wed, 23 Oct 2024 19:55:11 -0400 Subject: [PATCH 09/14] docker compose Signed-off-by: Craig Perkins --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index eee6761d6..7c39b41c0 100644 --- a/build.gradle +++ b/build.gradle @@ -498,7 +498,7 @@ task runDocker(type: Exec) { // It sets the path to the docker-compose program from an environment variable // The DOCKER_COMPOSE_LOCATION environment variable is set in the gradle.yml file inside the // performance-analyzer repository. - def docker_compose_location = "docker-compose" + def docker_compose_location = "docker compose" if (System.getenv("DOCKER_COMPOSE_LOCATION") != null) { docker_compose_location = System.getenv("DOCKER_COMPOSE_LOCATION") } From be53f126413c9e22012ef4a5bca69b75483aa205 Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Wed, 23 Oct 2024 20:01:28 -0400 Subject: [PATCH 10/14] Find docker location Signed-off-by: Craig Perkins --- .github/workflows/gradle.yml | 2 +- build.gradle | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 711555bab..209f55024 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -63,7 +63,7 @@ jobs: working-directory: ./tmp/performance-analyzer run: ./gradlew updateShas - name: Set docker-compose path - run: echo "DOCKER_COMPOSE_LOCATION=$(which docker-compose)" >> $GITHUB_ENV + run: echo "DOCKER_COMPOSE_LOCATION=$(which docker)" >> $GITHUB_ENV # Set the vm.max_map_count system property to the minimum required to run OpenSearch - name: Set vm.max_map_count run: sudo sysctl -w vm.max_map_count=262144 diff --git a/build.gradle b/build.gradle index 7c39b41c0..775a9c2f1 100644 --- a/build.gradle +++ b/build.gradle @@ -498,7 +498,7 @@ task runDocker(type: Exec) { // It sets the path to the docker-compose program from an environment variable // The DOCKER_COMPOSE_LOCATION environment variable is set in the gradle.yml file inside the // performance-analyzer repository. - def docker_compose_location = "docker compose" + def docker_compose_location = "docker" if (System.getenv("DOCKER_COMPOSE_LOCATION") != null) { docker_compose_location = System.getenv("DOCKER_COMPOSE_LOCATION") } @@ -506,7 +506,7 @@ task runDocker(type: Exec) { environment 'DATA_VOLUME1', 'opensearchdata1' environment 'DATA_VOLUME2', 'opensearchdata2' - commandLine(docker_compose_location, + commandLine(docker_compose_location, 'compose', '-f', 'docker-compose.yml', '-f', 'docker-compose.hostports.yml', '-f', 'docker-compose.cluster.yml', From 6016bbb93cc04d1ec2ddd6eb958105667e22012c Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Wed, 23 Oct 2024 20:04:43 -0400 Subject: [PATCH 11/14] Switch docker everywhere Signed-off-by: Craig Perkins --- .github/workflows/gradle.yml | 2 +- build.gradle | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 209f55024..8af584980 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -63,7 +63,7 @@ jobs: working-directory: ./tmp/performance-analyzer run: ./gradlew updateShas - name: Set docker-compose path - run: echo "DOCKER_COMPOSE_LOCATION=$(which docker)" >> $GITHUB_ENV + run: echo "DOCKER_LOCATION=$(which docker)" >> $GITHUB_ENV # Set the vm.max_map_count system property to the minimum required to run OpenSearch - name: Set vm.max_map_count run: sudo sysctl -w vm.max_map_count=262144 diff --git a/build.gradle b/build.gradle index 775a9c2f1..78771bf16 100644 --- a/build.gradle +++ b/build.gradle @@ -495,18 +495,18 @@ task runDocker(type: Exec) { workingDir(dockerArtifactsDir) // This block is included to make the runDocker task work with Github Actions - // It sets the path to the docker-compose program from an environment variable - // The DOCKER_COMPOSE_LOCATION environment variable is set in the gradle.yml file inside the + // It sets the path to the docker compose program from an environment variable + // The DOCKER_LOCATION environment variable is set in the gradle.yml file inside the // performance-analyzer repository. - def docker_compose_location = "docker" - if (System.getenv("DOCKER_COMPOSE_LOCATION") != null) { - docker_compose_location = System.getenv("DOCKER_COMPOSE_LOCATION") + def docker_location = "docker" + if (System.getenv("DOCKER_LOCATION") != null) { + docker_location = System.getenv("DOCKER_LOCATION") } environment 'DATA_VOLUME1', 'opensearchdata1' environment 'DATA_VOLUME2', 'opensearchdata2' - commandLine(docker_compose_location, 'compose', + commandLine(docker_location, 'compose', '-f', 'docker-compose.yml', '-f', 'docker-compose.hostports.yml', '-f', 'docker-compose.cluster.yml', @@ -556,11 +556,11 @@ def runInProcess(commandArr) { def runDockerCompose = { executionPath -> // This block is included to make the runDocker task work with Github Actions // It sets the path to the docker-compose program from an environment variable - // The DOCKER_COMPOSE_LOCATION environment variable is set in the gradle.yml file inside the + // The DOCKER_LOCATION environment variable is set in the gradle.yml file inside the // performance-analyzer repository. - String dockerCompose = System.getenv("DOCKER_COMPOSE_LOCATION") == null ? - "docker-compose" : System.getenv("DOCKER_COMPOSE_LOCATION") - String[] commandArray = [dockerCompose, + String dockerCompose = System.getenv("DOCKER_LOCATION") == null ? + "docker" : System.getenv("DOCKER_LOCATION") + String[] commandArray = [dockerCompose, 'compose', '-f', 'docker-compose.yml', '-f', 'docker-compose.hostports.yml', '-f', 'docker-compose.cluster.yml', From bcad1be468f4aa4d62b03e5e85dafe7c6c349a6b Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Wed, 23 Oct 2024 20:30:34 -0400 Subject: [PATCH 12/14] supervisor Signed-off-by: Craig Perkins --- docker/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 1c7ea89cb..6cde0610b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -81,6 +81,7 @@ FROM public.ecr.aws/amazonlinux/amazonlinux:2 ENV OPENSEARCH_CONTAINER true +RUN amazon-linux-extras install epel RUN yum install -y iproute \ python3-setuptools \ hostname \ @@ -91,6 +92,7 @@ RUN yum install -y iproute \ lsof \ python3-pip \ rsync && \ + supervisor && \ yum clean all && \ pip3 install supervisor From 9ecdb9bca1718041e51e379d507aa7509fc7fa49 Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Wed, 23 Oct 2024 20:43:04 -0400 Subject: [PATCH 13/14] yum install supervisor Signed-off-by: Craig Perkins --- docker/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 6cde0610b..452f79be4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -82,6 +82,7 @@ FROM public.ecr.aws/amazonlinux/amazonlinux:2 ENV OPENSEARCH_CONTAINER true RUN amazon-linux-extras install epel +RUN yum install -y supervisor RUN yum install -y iproute \ python3-setuptools \ hostname \ @@ -92,9 +93,7 @@ RUN yum install -y iproute \ lsof \ python3-pip \ rsync && \ - supervisor && \ - yum clean all && \ - pip3 install supervisor + yum clean all RUN yum update -y && \ yum install -y nc unzip wget which && \ From 176bd4112a7511dcf560ba1b8d052242d636bc45 Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Thu, 24 Oct 2024 10:37:31 -0400 Subject: [PATCH 14/14] Include createContext fix Signed-off-by: Craig Perkins --- .../performanceanalyzer/core/Util.java | 2 +- .../rca/RcaController.java | 32 ++++++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/opensearch/performanceanalyzer/core/Util.java b/src/main/java/org/opensearch/performanceanalyzer/core/Util.java index 1f9a6641d..bebc19233 100644 --- a/src/main/java/org/opensearch/performanceanalyzer/core/Util.java +++ b/src/main/java/org/opensearch/performanceanalyzer/core/Util.java @@ -17,7 +17,7 @@ public class Util { private static final Logger LOG = LogManager.getLogger(Util.class); public static final String PA_BASE_URL = "/_plugins/_performanceanalyzer"; - public static final String LEGACY_OPENDISTRO_PA_BASE_URL = PA_BASE_URL; + public static final String LEGACY_OPENDISTRO_PA_BASE_URL = "/_opendistro/_performanceanalyzer"; public static final String METRICS_QUERY_URL = PA_BASE_URL + "/metrics"; public static final String LEGACY_OPENDISTRO_METRICS_QUERY_URL = diff --git a/src/main/java/org/opensearch/performanceanalyzer/rca/RcaController.java b/src/main/java/org/opensearch/performanceanalyzer/rca/RcaController.java index 144fc37cc..0a79a2203 100644 --- a/src/main/java/org/opensearch/performanceanalyzer/rca/RcaController.java +++ b/src/main/java/org/opensearch/performanceanalyzer/rca/RcaController.java @@ -527,14 +527,36 @@ public RCAScheduler getRcaScheduler() { } private void addRcaRequestHandler() { - httpServer.createContext(Util.RCA_QUERY_URL, queryRcaRequestHandler); - httpServer.createContext(Util.LEGACY_OPENDISTRO_RCA_QUERY_URL, queryRcaRequestHandler); + try { + httpServer.createContext(Util.RCA_QUERY_URL, queryRcaRequestHandler); + } catch (IllegalArgumentException e) { + LOG.error("unable to create context in http server for URL: " + Util.RCA_QUERY_URL); + } + + try { + httpServer.createContext(Util.LEGACY_OPENDISTRO_RCA_QUERY_URL, queryRcaRequestHandler); + } catch (IllegalArgumentException e) { + LOG.error( + "unable to create context in http server for URL: " + + Util.LEGACY_OPENDISTRO_RCA_QUERY_URL); + } } private void addActionsRequestHandler() { - httpServer.createContext(Util.ACTIONS_QUERY_URL, queryActionRequestHandler); - httpServer.createContext( - Util.LEGACY_OPENDISTRO_ACTIONS_QUERY_URL, queryActionRequestHandler); + try { + httpServer.createContext(Util.ACTIONS_QUERY_URL, queryActionRequestHandler); + } catch (IllegalArgumentException e) { + LOG.error("unable to create context in http server for URL: " + Util.ACTIONS_QUERY_URL); + } + + try { + httpServer.createContext( + Util.LEGACY_OPENDISTRO_ACTIONS_QUERY_URL, queryActionRequestHandler); + } catch (IllegalArgumentException e) { + LOG.error( + "unable to create context in http server for URL: " + + Util.LEGACY_OPENDISTRO_ACTIONS_QUERY_URL); + } } public void setDeliberateInterrupt() {