-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#960][part-3] feat(dashboard): Provides a start-stop script for the …
…dashboard.
- Loading branch information
Showing
13 changed files
with
286 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/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 | ||
|
||
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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
dashboard/src/main/java/org/apache/uniffle/dashboard/web/proxy/WebProxyServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.apache.uniffle.dashboard.web.proxy; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
import org.eclipse.jetty.client.api.Request; | ||
import org.eclipse.jetty.client.api.Response; | ||
import org.eclipse.jetty.proxy.ProxyServlet; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class WebProxyServlet extends ProxyServlet { | ||
|
||
private String targetAddress; | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(WebProxyServlet.class); | ||
|
||
public WebProxyServlet(String targetAddress) { | ||
this.targetAddress = targetAddress; | ||
} | ||
|
||
@Override | ||
protected String rewriteTarget(HttpServletRequest clientRequest) { | ||
if (!validateDestination(clientRequest.getServerName(), clientRequest.getServerPort())) { | ||
return null; | ||
} | ||
StringBuilder target = new StringBuilder(); | ||
|
||
if (targetAddress.endsWith("/")) { | ||
targetAddress = targetAddress.substring(0, targetAddress.length() - 1); | ||
} | ||
target.append(targetAddress).append("/api").append(clientRequest.getPathInfo()); | ||
String query = clientRequest.getQueryString(); | ||
if (query != null) { | ||
target.append("?").append(query); | ||
} | ||
return target.toString(); | ||
} | ||
|
||
@Override | ||
protected void onProxyRewriteFailed( | ||
HttpServletRequest clientRequest, HttpServletResponse clientResponse) {} | ||
|
||
@Override | ||
protected void onProxyResponseFailure( | ||
HttpServletRequest clientRequest, | ||
HttpServletResponse proxyResponse, | ||
Response serverResponse, | ||
Throwable failure) {} | ||
|
||
@Override | ||
protected String filterServerResponseHeader( | ||
HttpServletRequest clientRequest, | ||
Response serverResponse, | ||
String headerName, | ||
String headerValue) { | ||
return null; | ||
} | ||
|
||
@Override | ||
protected void addXForwardedHeaders(HttpServletRequest clientRequest, Request proxyRequest) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,12 +16,4 @@ | |
*/ | ||
|
||
module.exports ={ | ||
devServer:{ | ||
proxy:{ | ||
'/api':{ | ||
target:'http://localhost:9528', | ||
changeOrigin:true | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
layout: page | ||
displayTitle: Dashboard Guide | ||
title: Dashboard Guide | ||
description: Dashboard 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 | ||
coordinator.web.address http://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 |
Oops, something went wrong.