Skip to content

Commit

Permalink
Remove PA-RCA files from OS home dir
Browse files Browse the repository at this point in the history
Signed-off-by: Karishma Joseph <[email protected]>
  • Loading branch information
kjoseph07 committed Feb 25, 2022
1 parent b086d2f commit abc861d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,11 @@ bundlePlugin {
into "extensions"
include "performance-analyzer-agent"
}
from("$rcaArtifactsDir") {
into "performance-analyzer-rca"
from("$rcaArtifactsDir/bin") {
into "rca_bin"
}
from("$rcaArtifactsDir/lib") {
into "rca_lib"
}
from("packaging") {
include "performance-analyzer-agent-cli"
Expand Down
8 changes: 4 additions & 4 deletions pa_bin/performance-analyzer-agent
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ export JAVA_HOME=$JAVA_HOME
# We need to change this file: https://github.com/opensearch-project/opensearch-build/blob/main/release/docker/config/opensearch/opensearch-docker-entrypoint.sh

if ! echo $* | grep -E '(^-d |-d$| -d |--daemonize$|--daemonize )' >/dev/null; then
export JAVA_OPTS=-Dopensearch.path.home=$OPENSEARCH_HOME\ -Dlog4j.configurationFile=$OPENSEARCH_HOME/performance-analyzer-rca-1.3.0-SNAPSHOT/pa_config/log4j2.xml
exec $OPENSEARCH_HOME/performance-analyzer-rca-1.3.0-SNAPSHOT/bin/performance-analyzer-rca
export JAVA_OPTS=-Dopensearch.path.home=$OPENSEARCH_HOME\ -Dlog4j.configurationFile=$OPENSEARCH_HOME/plugins/opensearch-performance-analyzer-1.3.0-SNAPSHOT/pa_config/log4j2.xml
exec $OPENSEARCH_HOME/plugins/opensearch-performance-analyzer-1.3.0-SNAPSHOT/rca_bin/performance-analyzer-rca
else
echo 'Starting deamon'
export JAVA_OPTS=-Dopensearch.path.home=$OPENSEARCH_HOME\ -Dlog4j.configurationFile=$OPENSEARCH_HOME/performance-analyzer-rca-1.3.0-SNAPSHOT/pa_config/log4j2.xml
exec $OPENSEARCH_HOME/performance-analyzer-rca-1.3.0-SNAPSHOT/bin/performance-analyzer-rca &
export JAVA_OPTS=-Dopensearch.path.home=$OPENSEARCH_HOME\ -Dlog4j.configurationFile=$OPENSEARCH_HOME/plugins/opensearch-performance-analyzer-1.3.0-SNAPSHOT/pa_config/log4j2.xml
exec $OPENSEARCH_HOME/plugins/opensearch-performance-analyzer-1.3.0-SNAPSHOT/rca_bin/performance-analyzer-rca &

pid=$!
PID_LOC=/tmp/performance-analyzer-agent
Expand Down
11 changes: 9 additions & 2 deletions packaging/deb/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ if [ -z "$OPENSEARCH_HOME" ]; then
fi

# Prepare the RCA reader process for execution
mv "$OPENSEARCH_HOME"/plugins/opensearch-performance-analyzer/performance-analyzer-rca $OPENSEARCH_HOME
PA_PLUGIN_PATH=$OUTPUT/plugins/opensearch-performance-analyzer
RCA_LIB_PATH=$OUTPUT/plugins/opensearch-performance-analyzer/rca_lib
# Remove common lib files between PA plugin and RCA reader process
for f in `ls -1 $PA_PLUGIN_PATH`; do
if [[ $(diff $RCA_LIB_PATH/$f $PA_PLUGIN_PATH/$f | wc -c) -eq 0 ]]; then
rm -rf $RCA_LIB_PATH/$f;
fi
done;

if [ -f "$OPENSEARCH_HOME"/bin/opensearch-performance-analyzer/performance-analyzer-agent-cli ]; then
mv "$OPENSEARCH_HOME"/bin/opensearch-performance-analyzer/performance-analyzer-agent-cli "$OPENSEARCH_HOME"/bin
rm -rf "$OPENSEARCH_HOME"/bin/opensearch-performance-analyzer
Expand All @@ -20,7 +28,6 @@ echo 'true' > /var/lib/opensearch/performance_analyzer_enabled.conf
echo 'true' > /var/lib/opensearch/rca_enabled.conf
chown opensearch /var/lib/opensearch/performance_analyzer_enabled.conf
chown opensearch /var/lib/opensearch/rca_enabled.conf
chown -R opensearch "$OPENSEARCH_HOME/performance-analyzer-rca"
chmod a+rw /tmp

if ! grep -q '## OpenSearch Performance Analyzer' /etc/opensearch/jvm.options; then
Expand Down
2 changes: 1 addition & 1 deletion packaging/performance-analyzer-agent-cli
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PA_AGENT_JAVA_OPTS="-Dlog4j.configurationFile=$OPENSEARCH_HOME/plugins/opensearc
-XX:MaxRAM=400m"

OPENSEARCH_MAIN_CLASS="org.opensearch.performanceanalyzer.PerformanceAnalyzerApp" \
OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES=performance-analyzer-rca/lib \
OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES=plugins/opensearch-performance-analyzer/rca_lib:plugins/opensearch-performance-analyzer \
OPENSEARCH_JAVA_OPTS=$PA_AGENT_JAVA_OPTS \
exec $OPENSEARCH_HOME/bin/opensearch-cli \
"$@"
11 changes: 9 additions & 2 deletions packaging/rpm/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ if [ -z "$OPENSEARCH_HOME" ]; then
fi

# Prepare the RCA reader process for execution
mv "$OPENSEARCH_HOME"/plugins/opensearch-performance-analyzer/performance-analyzer-rca $OPENSEARCH_HOME
PA_PLUGIN_PATH=$OUTPUT/plugins/opensearch-performance-analyzer
RCA_LIB_PATH=$OUTPUT/plugins/opensearch-performance-analyzer/rca_lib
# Remove common lib files between PA plugin and RCA reader process
for f in `ls -1 $PA_PLUGIN_PATH`; do
if [[ $(diff $RCA_LIB_PATH/$f $PA_PLUGIN_PATH/$f | wc -c) -eq 0 ]]; then
rm -rf $RCA_LIB_PATH/$f;
fi
done;

if [ -f "$OPENSEARCH_HOME"/bin/opensearch-performance-analyzer/performance-analyzer-agent-cli ]; then
mv "$OPENSEARCH_HOME"/bin/opensearch-performance-analyzer/performance-analyzer-agent-cli "$OPENSEARCH_HOME"/bin
rm -rf "$OPENSEARCH_HOME"/bin/opensearch-performance-analyzer
Expand All @@ -26,7 +34,6 @@ echo 'true' > /var/lib/opensearch/performance_analyzer_enabled.conf
echo 'true' > /var/lib/opensearch/rca_enabled.conf
chown opensearch /var/lib/opensearch/performance_analyzer_enabled.conf
chown opensearch /var/lib/opensearch/rca_enabled.conf
chown -R opensearch "$OPENSEARCH_HOME/performance-analyzer-rca"
chmod a+rw /tmp

if ! grep -q '## OpenSearch Performance Analyzer' /etc/opensearch/jvm.options; then
Expand Down

0 comments on commit abc861d

Please sign in to comment.