Skip to content

Commit

Permalink
[#960][part-3] feat(dashboard): Provides a start-stop script for the …
Browse files Browse the repository at this point in the history
…dashboard.
  • Loading branch information
yl09099 committed Sep 4, 2023
1 parent 87ee4d4 commit 9f7a28c
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 0 deletions.
105 changes: 105 additions & 0 deletions bin/start-dashboard.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!/usr/bin/env bash

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

set -o pipefail
set -o nounset # exit the script if you try to use an uninitialised variable
set -o errexit # exit the script if any statement returns a non-true return value

source "$(dirname "$0")/utils.sh"
load_rss_env

originRequestAddress="http:\/\/localhost:8080\/api"
replaceRequestAddress=""
backendAddress=`sed -n '/^dashboard\.backend\.address*/p' $RSS_CONF_DIR/coordinator.conf | awk '{print $2}'`
if [ -z "$backendAddress" ]
then
echo "Configure the back-end request interface,dashboard.backend.address Parameters are required"
exit 1
else
echo "backendAddress:"$backendAddress
replaceRequestAddress="http:\/\/"$backendAddress"\/api"
fileNamewithPath=`ls $RSS_HOME/jars/dashboard/dashboard-*`
deployFileName=`basename $fileNamewithPath`
unzip -x $RSS_HOME/jars/dashboard/$deployFileName -d $RSS_HOME/jars/dashboard/replaceTemp
sed -i "s/${originRequestAddress}/${replaceRequestAddress}/g" $RSS_HOME/jars/dashboard/replaceTemp/static/js/*.js
cd "$RSS_HOME/jars/dashboard/replaceTemp"
zip -ru ../$deployFileName *
rm -rf $RSS_HOME/jars/dashboard/replaceTemp
fi

cd "$RSS_HOME"

COORDINATOR_CONF_FILE="${RSS_CONF_DIR}/coordinator.conf"
JAR_DIR="${RSS_HOME}/jars"
LOG_CONF_FILE="${RSS_CONF_DIR}/log4j.properties"
LOG_PATH="${RSS_LOG_DIR}/dashboard.log"
OUT_PATH="${RSS_LOG_DIR}/dashboard.out"

MAIN_CLASS="org.apache.uniffle.dashboard.web.JettyServerFront"

HADOOP_DEPENDENCY="$("$HADOOP_HOME/bin/hadoop" classpath --glob)"

echo "Check process existence"
is_jvm_process_running "$JPS" $MAIN_CLASS

CLASSPATH=""

for file in $(ls ${JAR_DIR}/dashboard/*.jar 2>/dev/null); do
CLASSPATH=$CLASSPATH:$file
done

mkdir -p "${RSS_LOG_DIR}"
mkdir -p "${RSS_PID_DIR}"

CLASSPATH=$CLASSPATH:$HADOOP_CONF_DIR:$HADOOP_DEPENDENCY
JAVA_LIB_PATH="-Djava.library.path=$HADOOP_HOME/lib/native"

echo "class path is $CLASSPATH"

JVM_ARGS=" -server \
-Xmx${XMX_SIZE:-8g} \
-Xms${XMX_SIZE:-8g} \
-XX:+UseG1GC \
-XX:MaxGCPauseMillis=200 \
-XX:ParallelGCThreads=20 \
-XX:ConcGCThreads=5 \
-XX:InitiatingHeapOccupancyPercent=45 \
-XX:+PrintGC \
-XX:+PrintAdaptiveSizePolicy \
-XX:+PrintGCDateStamps \
-XX:+PrintGCTimeStamps \
-XX:+PrintGCDetails \
-Xloggc:${RSS_LOG_DIR}/gc-%t.log"

JAVA11_EXTRA_ARGS=" -XX:+IgnoreUnrecognizedVMOptions \
-Xlog:gc:tags,time,uptime,level"

ARGS=""

if [ -f ${LOG_CONF_FILE} ]; then
ARGS="$ARGS -Dlog4j.configuration=file:${LOG_CONF_FILE} -Dlog.path=${LOG_PATH}"
else
echo "Exit with error: ${LOG_CONF_FILE} file doesn't exist."
exit 1
fi

$RUNNER $ARGS $JVM_ARGS $JAVA11_EXTRA_ARGS -cp $CLASSPATH $MAIN_CLASS --conf "$COORDINATOR_CONF_FILE" $@ &> $OUT_PATH &

get_pid_file_name uniffle-dashboard
echo $! >${RSS_PID_DIR}/${pid_file}
28 changes: 28 additions & 0 deletions bin/stop-dashboard.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#

set -o pipefail
set -o nounset # exit the script if you try to use an uninitialised variable
set -o errexit # exit the script if any statement returns a non-true return value

source "$(dirname "$0")/utils.sh"
load_rss_env

common_shutdown "uniffle-dashboard" "${RSS_PID_DIR}"
42 changes: 42 additions & 0 deletions docs/dashboard_guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
layout: page
displayTitle: Metrics Guide
title: Metrics Guide
description: Metrics Guide
license: |
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---
# Dashboard Guide

## Summary
This document explains how to install and start Uniffle's dashboard.

### Configure related parameters
In $RSS_HOME/conf directory, configure the dashboard data request port and front-end access port in the coordinator
``` shell
## Front-end access port
rss.dashboard.http.port 19997
## The dashboard request data port, which is the Coordinator's HTTP port
## coordinator.hostname is the hostname or IP address of a Coordinator
dashboard.backend.address coordinator.hostname:19998
```

### Start the dashboard process
In the $RSS_HOME/bin directory, start with a script.
``` shell
## Start dashboard
sh start-dashboard.sh

## Close dashboard
sh stop-dashboard.sh

0 comments on commit 9f7a28c

Please sign in to comment.