You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by xi...@apache.org on 2020/08/25 01:18:52 UTC
[incubator-pinot] branch master updated: [TE] Updated ThirdEye
docker launch script to accept MODE as a second arg (#5914)
This is an automated email from the ASF dual-hosted git repository.
xiangfu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new a8974c7 [TE] Updated ThirdEye docker launch script to accept MODE as a second arg (#5914)
a8974c7 is described below
commit a8974c77bd2f3d3a064228889512fbe2e5014a65
Author: Suvodeep Pyne <su...@users.noreply.github.com>
AuthorDate: Mon Aug 24 18:18:42 2020 -0700
[TE] Updated ThirdEye docker launch script to accept MODE as a second arg (#5914)
* [TE] Added Docker Images for a distributed ThirdEye setup
Added separate docker images for a
* [TE] Added Docker Images for a distributed ThirdEye setup
Fixed Dockerfile base image tag
* [TE] Updated docker launch script to accept MODE as a second parameter
The MODE param decides on whether TE launches the frontend, backend or all services
```
./start-thirdeye.sh ${CONFIG_DIR} ${MODE}
- CONFIG_DIR: path to the thirdeye configuration director
- MODE: Choices: {frontend, backend, * }
frontend: Start the frontend server only
backend: Start the backend server only
For any other value, defaults to starting all services with an h2 db.
```
* [TE] Updated docker launch script to accept MODE as a second parameter
The MODE param decides on whether TE launches the frontend, backend or all services
```
./start-thirdeye.sh ${CONFIG_DIR} ${MODE}
- CONFIG_DIR: path to the thirdeye configuration director
- MODE: Choices: {frontend, backend, * }
frontend: Start the frontend server only
backend: Start the backend server only
For any other value, defaults to starting all services with an h2 db.
```
* [TE] Updated docker launch script to accept MODE as a second parameter
The MODE param decides on whether TE launches the frontend, backend, database or all services
```
./start-thirdeye.sh ${CONFIG_DIR} ${MODE}
- CONFIG_DIR: path to the thirdeye configuration director
- MODE: Choices: {frontend, backend, * }
frontend: Start the frontend server only
backend: Start the backend server only
database: Start the H@ db service. Also initializes the db with the required tables
For any other value, defaults to starting all services with an h2 db.
```
---
docker/images/pinot-thirdeye/README.md | 2 +-
docker/images/pinot-thirdeye/bin/start-thirdeye.sh | 73 +++++++++++++++++-----
2 files changed, 57 insertions(+), 18 deletions(-)
diff --git a/docker/images/pinot-thirdeye/README.md b/docker/images/pinot-thirdeye/README.md
index 5db444d..754805a 100644
--- a/docker/images/pinot-thirdeye/README.md
+++ b/docker/images/pinot-thirdeye/README.md
@@ -19,7 +19,7 @@
-->
-# docker-pinot
+# docker-pinot-thirdeye
This is a docker image of [Apache Thirdeye](https://github.com/apache/incubator-pinot/tree/master/thirdeye).
## How to build a docker image
diff --git a/docker/images/pinot-thirdeye/bin/start-thirdeye.sh b/docker/images/pinot-thirdeye/bin/start-thirdeye.sh
index 56498a8..2fbfc72 100755
--- a/docker/images/pinot-thirdeye/bin/start-thirdeye.sh
+++ b/docker/images/pinot-thirdeye/bin/start-thirdeye.sh
@@ -18,6 +18,18 @@
# under the License.
#
+# Script Usage
+# ---------------------------------------------
+# ./start-thirdeye.sh ${CONFIG_DIR} ${MODE}
+#
+# - CONFIG_DIR: path to the thirdeye configuration director
+# - MODE: Choices: {frontend, backend, * }
+# frontend: Start the frontend server only
+# backend: Start the backend server only
+# database: Start the H@ db service. Also initializes the db with the required tables
+# For any other value, defaults to starting all services with an h2 db.
+#
+
if [[ "$#" -gt 0 ]]
then
CONFIG_DIR="./config/$1"
@@ -25,25 +37,52 @@ else
CONFIG_DIR="./config/default"
fi
-echo "Starting H2 database server"
-java -cp "./bin/thirdeye-pinot.jar" org.h2.tools.Server -tcp -baseDir "${CONFIG_DIR}/.." &
-sleep 1
-echo "Creating ThirdEye database schema"
-java -cp "./bin/thirdeye-pinot.jar" org.h2.tools.RunScript -user "sa" -password "sa" -url "jdbc:h2:tcp:localhost/h2db" -script "zip:./bin/thirdeye-pinot.jar!/schema/create-schema.sql"
+function start_server {
+ class_ref=$1
+ config_dir=$2
+ java -Dlog4j.configurationFile=log4j2.xml -cp "./bin/thirdeye-pinot.jar" ${class_ref} "${config_dir}"
+}
-if [ -f "${CONFIG_DIR}/bootstrap.sql" ]; then
- echo "Running database bootstrap script ${CONFIG_DIR}/bootstrap.sql"
- java -cp "./bin/thirdeye-pinot.jar" org.h2.tools.RunScript -user "sa" -password "sa" -url "jdbc:h2:tcp:localhost/h2db" -script "${CONFIG_DIR}/bootstrap.sql"
-fi
+function start_frontend {
+ echo "Running Thirdeye frontend config: ${CONFIG_DIR}"
+ start_server org.apache.pinot.thirdeye.dashboard.ThirdEyeDashboardApplication "${CONFIG_DIR}"
+}
+
+function start_backend {
+ echo "Running Thirdeye backend config: ${CONFIG_DIR}"
+ start_server org.apache.pinot.thirdeye.anomaly.ThirdEyeAnomalyApplication "${CONFIG_DIR}"
+}
+
+
+function start_db {
+ echo "Starting H2 database server"
+ java -cp "./bin/thirdeye-pinot.jar" org.h2.tools.Server -tcp -baseDir "${CONFIG_DIR}/.." &
+ sleep 1
+
+ echo "Creating ThirdEye database schema"
+ java -cp "./bin/thirdeye-pinot.jar" org.h2.tools.RunScript -user "sa" -password "sa" -url "jdbc:h2:tcp:localhost/h2db" -script "zip:./bin/thirdeye-pinot.jar!/schema/create-schema.sql"
+
+ if [ -f "${CONFIG_DIR}/bootstrap.sql" ]; then
+ echo "Running database bootstrap script ${CONFIG_DIR}/bootstrap.sql"
+ java -cp "./bin/thirdeye-pinot.jar" org.h2.tools.RunScript -user "sa" -password "sa" -url "jdbc:h2:tcp:localhost/h2db" -script "${CONFIG_DIR}/bootstrap.sql"
+ fi
+}
+
+function start_all {
+ start_db
-echo "Running thirdeye backend config: ${CONFIG_DIR}"
-[ -f "${CONFIG_DIR}/data-sources/data-sources-config-backend.yml" ] && cp "${CONFIG_DIR}/data-sources/data-sources-config-backend.yml" "${CONFIG_DIR}/data-sources/data-sources-config.yml"
-java -Dlog4j.configurationFile=log4j2.xml -cp "./bin/thirdeye-pinot.jar" org.apache.pinot.thirdeye.anomaly.ThirdEyeAnomalyApplication "${CONFIG_DIR}" &
-sleep 10
+ start_backend &
+ sleep 10
-echo "Running thirdeye frontend config: ${CONFIG_DIR}"
-[ -f "${CONFIG_DIR}/data-sources/data-sources-config-frontend.yml" ] && cp "${CONFIG_DIR}/data-sources/data-sources-config-frontend.yml" "${CONFIG_DIR}/data-sources/data-sources-config.yml"
-java -Dlog4j.configurationFile=log4j2.xml -cp "./bin/thirdeye-pinot.jar" org.apache.pinot.thirdeye.dashboard.ThirdEyeDashboardApplication "${CONFIG_DIR}" &
+ start_frontend &
+ wait
+}
-wait
+MODE=$2
+case ${MODE} in
+ "frontend" ) start_frontend ;;
+ "backend" ) start_backend ;;
+ "database" ) start_db;;
+ * ) start_all ;;
+esac
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org