xunliu commented on code in PR #87:
URL:
https://github.com/apache/gravitino-playground/pull/87#discussion_r1812500449
##########
README.md:
##########
@@ -25,7 +25,11 @@ Depending on your network and computer, startup time may
take 3-5 minutes. Once
## Prerequisites
-Install Git and Docker Compose.
+Install Git, Docker, Docker Compose.
+
+## System Resource Requirements
+
+2 CPU cores, 8 GB RAM, 25 GB disk storage, MacOS or Linux OS (Verified Ubuntu
22.04,Ubuntu 24.04).
Review Comment:
Please add a space in the `Ubuntu 22.04,Ubuntu 24.04`
##########
docker-compose.yaml:
##########
@@ -106,37 +98,27 @@ services:
- "15432:5432"
volumes:
- ./init/postgres:/docker-entrypoint-initdb.d/
- deploy:
- resources:
- limits:
- cpus: "1"
- memory: 500M
mysql:
image: mysql:8.0
container_name: playground-mysql
+ environment:
+ - MYSQL_ROOT_PASSWORD=mysql
+ - MYSQL_USER=mysql
+ - MYSQL_PASSWORD=mysql
+ - MYSQL_DATABASE=db
ports:
- "13306:3306"
volumes:
- ./init/mysql:/docker-entrypoint-initdb.d/
- environment:
- MYSQL_ROOT_PASSWORD: mysql
- MYSQL_USER: mysql
- MYSQL_PASSWORD: mysql
- MYSQL_DATABASE: db
command:
--default-authentication-plugin=mysql_native_password
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--explicit_defaults_for_timestamp=true
--lower_case_table_names=1
- deploy:
- resources:
- limits:
- cpus: "1"
- memory: 500M
healthcheck:
- test: ["CMD-SHELL", "mysqladmin ping -h localhost -p
${MYSQL_ROOT_PASSWORD}"]
+ test: ["CMD-SHELL", "mysqladmin ping -h localhost -pmysql"]
interval: 5s
timeout: 60s
retries: 5
Review Comment:
Maybe needs to add `start_period: 20s` in there?
##########
init/gravitino/init.sh:
##########
@@ -17,12 +17,14 @@
# under the License.
#
echo "Start to download the jar package of JDBC"
-wget
https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.27/mysql-connector-java-8.0.27.jar
-O /root/gravitino/catalogs/jdbc-mysql/libs/mysql-connector-java-8.0.27.jar
-wget https://jdbc.postgresql.org/download/postgresql-42.7.0.jar -O
/root/gravitino/catalogs/jdbc-postgresql/libs/postgresql-42.7.0.jar
-cp /root/gravitino/catalogs/jdbc-postgresql/libs/postgresql-42.7.0.jar
/root/gravitino/catalogs/lakehouse-iceberg/libs
+cp /tmp/gravitino/packages/mysql-connector-java-8.0.27.jar
/root/gravitino/catalogs/jdbc-mysql/libs/mysql-connector-java-8.0.27.jar
+cp /tmp/gravitino/packages/postgresql-42.2.7.jar
/root/gravitino/catalogs/jdbc-postgresql/libs/postgresql-42.2.7.jar
+# wget
https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.27/mysql-connector-java-8.0.27.jar
-O /root/gravitino/catalogs/jdbc-mysql/libs/mysql-connector-java-8.0.27.jar
+# wget https://jdbc.postgresql.org/download/postgresql-42.7.0.jar -O
/root/gravitino/catalogs/jdbc-postgresql/libs/postgresql-42.7.0.jar
Review Comment:
Please delete these codes.
##########
playground.sh:
##########
@@ -0,0 +1,121 @@
+#!/bin/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.
+#
+playground_dir="$(dirname "${BASH_SOURCE-$0}")"
+playground_dir="$(
+ cd "${playground_dir}" >/dev/null
+ pwd
+)"
+
+testDocker() {
+ echo "Testing Docker environment by running hello-world..."
+ docker run hello-world >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ echo "Docker is working correctly!"
+ else
+ echo "There was an issue running the hello-world container. Please check
your Docker installation."
+ exit 1
+ fi
+}
+
+checkCompose() {
+ isExist=$(which docker-compose)
+ if [ $isExist ]; then
+ true # Placeholder, do nothing
+ else
+ echo "ERROR: No docker service environment found. Please install
docker-compose."
+ exit
+ fi
+}
+
+checkPortInUse() {
+ local port=$1
+ lsof -i :$port >/dev/null 2>&1
+ if [ $? -eq 1 ]; then
+ echo "Port $port is ok."
+ else
+ echo "Port $port is in use. Please check it."
+ exit 1
+ fi
+}
+
+start() {
+ echo "Starting the playground..."
+ testDocker
+ checkCompose
+
+ ports=(8090 9001 3307 19000 19083 60070 13306 15342 18080 18888)
+ for port in "${ports[@]}"; do
+ checkPortInUse ${port}
+ done
+
+ cd ${playground_dir}
+ echo "Preparing packages..."
+ ./init/spark/spark-dependency.sh
+ ./init/gravitino/gravitino-dependency.sh
+
+ logSuffix=$(date +%Y%m%d%H%m%s)
+ docker-compose up --detach
+ docker compose logs -f >${playground_dir}/playground-${logSuffix}.log 2>&1 &
+ echo "Check log details: ${playground_dir}/playground-${logSuffix}.log"
+}
+
+status() {
+ docker-compose ps
+}
+
+stop() {
+ echo "Stopping the playground..."
+ docker-compose down
+ if [ $? -eq 0 ]; then
+ echo "Playground stopped!"
+ fi
+}
+
+case "$1" in
+start)
+ if [[ "$2" == "-y" ]]; then
+ input="y"
+ else
+ echo "The playground requires 2 CPU cores, 8 GB of RAM, and 25 GB of disk
storage to operate efficiently."
+ read -r -p "Please confirm the requirement is available in your OS [Y/n]:"
input
+ fi
+ case $input in
+ [yY][eE][sS] | [yY]) ;;
+ [nN][oO] | [nN])
+ exit 0
+ ;;
+ *)
+ echo "Invalid input!"
+ exit 1
+ ;;
+ esac
+ start
+ ;;
+status)
+ status
+ ;;
+stop)
+ stop
+ ;;
+*)
+ echo "Usage: $0 [start | status | stop] [-y]"
Review Comment:
Maybe needs to change `[start|status|stop]` ?
##########
init/gravitino/gravitino-dependency.sh:
##########
@@ -17,26 +17,22 @@
# specific language governing permissions and limitations
# under the License.
#
-# set -ex
-playground_dir="$(dirname "${BASH_SOURCE-$0}")"
-playground_dir="$(cd "${playground_dir}">/dev/null; pwd)"
-isExist=`which docker-compose`
-if [ $isExist ]
-then
- true # Placeholder, do nothing
-else
- echo "ERROR: No docker service environment found, please install
docker-compose first."
- exit
-fi
+gravitino_dir="$(dirname "${BASH_SOURCE-$0}")"
+gravitino_dir="$(
+ cd "${gravitino_dir}" >/dev/null
+ pwd
+)"
+. "${gravitino_dir}/../common/common.sh"
-components=""
-case "${1}" in
- *)
- components=$@
-esac
+# Prepare download packages
+if [[ ! -d "${gravitino_dir}/packages" ]]; then
+ mkdir -p "${gravitino_dir}/packages"
+fi
Review Comment:
I didn't find any package that needs to be downloaded in here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]