From 103b8cfc23de373bfb94cb0622b3f88d097c1724 Mon Sep 17 00:00:00 2001 From: timyuer <524860213@qq.com> Date: Fri, 20 Sep 2024 09:56:29 +0800 Subject: [PATCH] BIGTOP-4145: Improve docker development support scripts (#73) --- .../bigtop/manager/dao/sql/SQLBuilder.java | 42 ++-- dev-support/README.md | 23 +- dev-support/docker/centos7/Dockerfile | 32 --- .../docker/centos7/build-containers.sh | 111 --------- dev-support/docker/centos7/build-image.sh | 30 --- .../docker/centos7/clear-containers.sh | 38 --- .../docker/centos7/distribute-scripts.sh | 35 --- dev-support/docker/containers/build.sh | 226 ++++++++++++++++++ .../Dockerfile => image/Dockerfile.template} | 6 +- dev-support/docker/image/build.sh | 78 ++++++ dev-support/docker/openeuler22/Dockerfile | 33 --- .../docker/openeuler22/build-containers.sh | 133 ----------- dev-support/docker/openeuler22/build-image.sh | 30 --- .../docker/openeuler22/clear-containers.sh | 40 ---- .../docker/openeuler22/distribute-scripts.sh | 35 --- .../docker/openeuler22/restart-containers.sh | 43 ---- dev-support/docker/rocky8/build-containers.sh | 132 ---------- dev-support/docker/rocky8/build-image.sh | 30 --- dev-support/docker/rocky8/clear-containers.sh | 40 ---- .../docker/rocky8/distribute-scripts.sh | 35 --- .../docker/rocky8/restart-containers.sh | 43 ---- dev-support/example/bigtop_manager/user.sql | 20 -- 22 files changed, 341 insertions(+), 894 deletions(-) delete mode 100644 dev-support/docker/centos7/Dockerfile delete mode 100755 dev-support/docker/centos7/build-containers.sh delete mode 100755 dev-support/docker/centos7/build-image.sh delete mode 100755 dev-support/docker/centos7/clear-containers.sh delete mode 100755 dev-support/docker/centos7/distribute-scripts.sh create mode 100644 dev-support/docker/containers/build.sh rename dev-support/docker/{rocky8/Dockerfile => image/Dockerfile.template} (97%) create mode 100644 dev-support/docker/image/build.sh delete mode 100644 dev-support/docker/openeuler22/Dockerfile delete mode 100755 dev-support/docker/openeuler22/build-containers.sh delete mode 100755 dev-support/docker/openeuler22/build-image.sh delete mode 100755 dev-support/docker/openeuler22/clear-containers.sh delete mode 100755 dev-support/docker/openeuler22/distribute-scripts.sh delete mode 100755 dev-support/docker/openeuler22/restart-containers.sh delete mode 100755 dev-support/docker/rocky8/build-containers.sh delete mode 100755 dev-support/docker/rocky8/build-image.sh delete mode 100755 dev-support/docker/rocky8/clear-containers.sh delete mode 100755 dev-support/docker/rocky8/distribute-scripts.sh delete mode 100755 dev-support/docker/rocky8/restart-containers.sh delete mode 100644 dev-support/example/bigtop_manager/user.sql diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/sql/SQLBuilder.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/sql/SQLBuilder.java index 08cfdcd72..bf220d5ec 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/sql/SQLBuilder.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/sql/SQLBuilder.java @@ -53,7 +53,7 @@ public static String insert(TableMetaData tableMetaData, Entity entity, SQL sql = new SQL(); switch (DBType.toType(databaseId)) { case MYSQL: { - sql.INSERT_INTO(tableMetaData.getTableName()); + sql.INSERT_INTO(keywordsFormat(tableMetaData.getTableName(), DBType.MYSQL)); for (Map.Entry entry : fieldColumnMap.entrySet()) { // Ignore primary key if (Objects.equals(entry.getKey(), tableMetaData.getPkProperty())) { @@ -65,13 +65,13 @@ public static String insert(TableMetaData tableMetaData, Entity entity, } Object value = ReflectionUtils.invokeMethod(ps.getReadMethod(), entity); if (!ObjectUtils.isEmpty(value)) { - sql.VALUES("`" + entry.getValue() + "`", getTokenParam(entry.getKey())); + sql.VALUES(keywordsFormat(entry.getValue(), DBType.MYSQL), getTokenParam(entry.getKey())); } } break; } case POSTGRESQL: { - sql.INSERT_INTO("\"" + tableMetaData.getTableName() + "\""); + sql.INSERT_INTO(keywordsFormat(tableMetaData.getTableName(), DBType.POSTGRESQL)); for (Map.Entry entry : fieldColumnMap.entrySet()) { // Ignore primary key if (Objects.equals(entry.getKey(), tableMetaData.getPkProperty())) { @@ -83,7 +83,7 @@ public static String insert(TableMetaData tableMetaData, Entity entity, } Object value = ReflectionUtils.invokeMethod(ps.getReadMethod(), entity); if (!ObjectUtils.isEmpty(value)) { - sql.VALUES("\"" + entry.getValue() + "\"", getTokenParam(entry.getKey())); + sql.VALUES(keywordsFormat(entry.getValue(), DBType.POSTGRESQL), getTokenParam(entry.getKey())); } } break; @@ -104,7 +104,7 @@ public static String update(TableMetaData tableMetaData, Entity entity, SQL sql = new SQL(); switch (DBType.toType(databaseId)) { case MYSQL: { - sql.UPDATE(tableMetaData.getTableName()); + sql.UPDATE(keywordsFormat(tableMetaData.getTableName(), DBType.MYSQL)); for (Map.Entry entry : fieldColumnMap.entrySet()) { // Ignore primary key if (Objects.equals(entry.getKey(), tableMetaData.getPkProperty())) { @@ -116,15 +116,16 @@ public static String update(TableMetaData tableMetaData, Entity entity, } Object value = ReflectionUtils.invokeMethod(ps.getReadMethod(), entity); if (!ObjectUtils.isEmpty(value)) { - sql.SET(getEquals(entry.getValue(), entry.getKey())); + sql.SET(getEquals(keywordsFormat(entry.getValue(), DBType.MYSQL), entry.getKey())); } } - sql.WHERE(getEquals(tableMetaData.getPkColumn(), tableMetaData.getPkProperty())); + sql.WHERE(getEquals( + keywordsFormat(tableMetaData.getPkColumn(), DBType.MYSQL), tableMetaData.getPkProperty())); break; } case POSTGRESQL: { - sql.UPDATE("\"" + tableMetaData.getTableName() + "\""); + sql.UPDATE(keywordsFormat(tableMetaData.getTableName(), DBType.POSTGRESQL)); for (Map.Entry entry : fieldColumnMap.entrySet()) { // Ignore primary key if (Objects.equals(entry.getKey(), tableMetaData.getPkProperty())) { @@ -136,10 +137,11 @@ public static String update(TableMetaData tableMetaData, Entity entity, } Object value = ReflectionUtils.invokeMethod(ps.getReadMethod(), entity); if (!ObjectUtils.isEmpty(value)) { - sql.SET("\"" + getEquals(entry.getValue() + "\"", entry.getKey())); + sql.SET(getEquals(keywordsFormat(entry.getValue(), DBType.POSTGRESQL), entry.getKey())); } } - sql.WHERE(getEquals(tableMetaData.getPkColumn(), tableMetaData.getPkProperty())); + sql.WHERE(getEquals( + keywordsFormat(tableMetaData.getPkColumn(), DBType.POSTGRESQL), tableMetaData.getPkProperty())); break; } default: { @@ -166,7 +168,7 @@ public static String selectById(TableMetaData tableMetaData, String databaseId, baseColumns = baseColumns.replace("user.", "\"user\"."); } sql.SELECT(baseColumns); - sql.FROM("\"" + tableMetaData.getTableName() + "\""); + sql.FROM(keywordsFormat(tableMetaData.getTableName(), DBType.POSTGRESQL)); sql.WHERE(tableMetaData.getPkColumn() + " = " + id); break; } @@ -207,7 +209,7 @@ public static String selectByIds( baseColumns = baseColumns.replace("user.", "\"user\"."); } sql.SELECT(baseColumns); - sql.FROM("\"" + tableMetaData.getTableName() + "\""); + sql.FROM(keywordsFormat(tableMetaData.getTableName(), DBType.POSTGRESQL)); sql.WHERE(tableMetaData.getPkColumn() + " in (" + idsStr + ")"); break; } @@ -229,7 +231,7 @@ public static String selectAll(TableMetaData tableMetaData, String databaseId) { baseColumns = baseColumns.replace("user.", "\"user\"."); } sql.SELECT(baseColumns); - sql.FROM("\"" + tableMetaData.getTableName() + "\""); + sql.FROM(keywordsFormat(tableMetaData.getTableName(), DBType.POSTGRESQL)); break; case MYSQL: { sql.SELECT(tableMetaData.getBaseColumns()); @@ -253,7 +255,7 @@ public static String deleteById(TableMetaData tableMetaData, String databaseId, break; } case POSTGRESQL: { - sql.FROM("\"" + tableMetaData.getTableName() + "\""); + sql.FROM(keywordsFormat(tableMetaData.getTableName(), DBType.POSTGRESQL)); sql.WHERE(tableMetaData.getPkColumn() + " = " + id); break; } @@ -286,7 +288,7 @@ public static String deleteByIds( } case POSTGRESQL: { String idsStr = ids.stream().map(String::valueOf).collect(Collectors.joining(", ")); - sql.DELETE_FROM("\"" + tableMetaData.getTableName() + "\""); + sql.DELETE_FROM(keywordsFormat(tableMetaData.getTableName(), DBType.POSTGRESQL)); sql.WHERE(tableMetaData.getPkColumn() + " in (" + idsStr + ")"); break; } @@ -318,8 +320,16 @@ public static String findByCondition( return sql.toString(); } + private static String keywordsFormat(String keyword, DBType dbType) { + return switch (dbType) { + case MYSQL -> "`" + keyword + "`"; + case POSTGRESQL -> "\"" + keyword + "\""; + default -> keyword; + }; + } + private static String getEquals(String column, String property) { - return "`" + column + "` = " + getTokenParam(property); + return column + " = " + getTokenParam(property); } private static String getTokenParam(String property) { diff --git a/dev-support/README.md b/dev-support/README.md index 4f9f3d4a7..5a7d7356e 100644 --- a/dev-support/README.md +++ b/dev-support/README.md @@ -30,38 +30,31 @@ yum install -y git docker ``` ### **Step 2**: Download Bigtop Manager source ```shell -git clone https://github.com/kevinw66/bigtop-manager.git +git clone https://github.com/apache/bigtop-manager.git ``` > You need to change the `node.version` in the `pom.xml` file under the `bigtop-manager-ui` module to `16.x` if you are using CentOS-7. -### **Step 3**: Enter workspace -**RHEL (Rocky 8) :** -```shell -cd bigtop-manager/dev-support/docker/rocky8/ -``` -### **Step 4**: Build develop basic image +### **Step 3**: Build develop basic image Run the setup command, you will get `bigtop-manager/develop:trunk-rocky-8` image. It has the enviroment needed to compile Bigtop-Manager and run servers such as Bigtop-Manager Server, Bigtop-Manager Agent, Mysql, etc. **RHEL (Rocky 8) :** ```shell -./build-image.sh +/bin/bash dev-support/docker/image/build.sh trunk-rocky-8 ``` -### **Step 5**: Build source & create cluster +### **Step 4**: Build source & create cluster * Bigtop Manager UI、Bigtop Manager Server Debug Port、MariaDB Server are also exposed to local ports: 8080、5005、3306. * Docker hostnames are: bigtop-manager-server、bigtop-manager-agent-01、bigtop-manager-agent-02. **RHEL (Rocky 8) :** ```shell -./build-containers.sh +/bin/bash dev-support/docker/containers/build.sh -e postgres -c 3 -o trunk-rocky-8 [--skip-compile] ``` -### **Step 6**: Insert data to Database -Copy SQL on `dev-support/example/bigtop_manager/user.sql` and run on mysql database `bigtop_manager` which is installed in container bigtop-manager-server. -### **Step 7**: Access Web UI +### **Step 5**: Access Web UI Now you can access Web UI which exposes on `http://localhost:8080`. Log in with username `admin` and password `admin`. -### **Step 8**: Clear cluster +### **Step 6**: Clear cluster Clean up the containers when you are done developing or testing. **RHEL (Rocky 8) :** ```shell -./clear-containers.sh +/bin/bash dev-support/docker/containers/build.sh -d ``` diff --git a/dev-support/docker/centos7/Dockerfile b/dev-support/docker/centos7/Dockerfile deleted file mode 100644 index cc061043d..000000000 --- a/dev-support/docker/centos7/Dockerfile +++ /dev/null @@ -1,32 +0,0 @@ -# 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. - -FROM centos:7 - -RUN yum -y install sudo wget openssh-clients openssh-server vim mariadb mariadb-server net-tools chrony krb5-server krb5-libs krb5-workstation git rpm-build -RUN wget https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz -O /tmp/jdk.tar.gz --no-check-certificate \ - && mkdir -p /usr/local/java && tar -xzf /tmp/jdk.tar.gz -C /usr/local/java --strip-components=1 \ - && rm -f /tmp/jdk.tar.gz \ - && ln -s /usr/local/java/bin/java /usr/bin/java -RUN wget https://archive.apache.org/dist/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz -O /tmp/apache-maven.tar.gz --no-check-certificate \ - && mkdir -p /usr/share/maven && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \ - && rm -f /tmp/apache-maven.tar.gz \ - && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn - -RUN /bin/sed -i 's,# StrictHostKeyChecking ask,StrictHostKeyChecking no,g' /etc/ssh/ssh_config - -RUN ssh-keygen -f "/root/.ssh/id_rsa" -N "" - -EXPOSE 1-65535 diff --git a/dev-support/docker/centos7/build-containers.sh b/dev-support/docker/centos7/build-containers.sh deleted file mode 100755 index cd700a09a..000000000 --- a/dev-support/docker/centos7/build-containers.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/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 -# -# https://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. -# - -BIN_DIR=$(dirname $0) -cd $BIN_DIR -echo $PWD - -echo -e "\033[32mStarting container bigtop-manager-build\033[0m" -if [[ -z $(docker ps -a --format "table {{.Names}}" | grep "bigtop-manager-build") ]];then - docker run -it -d --name bigtop-manager-build --privileged=true -e "container=docker" \ - -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v $PWD/../../../:/opt/bigtop-manager/ \ - -w /opt/bigtop-manager \ - bigtop-manager/develop:trunk-centos-7 -else - docker start bigtop-manager-build -fi - -echo -e "\033[32mCompiling bigtop-manager\033[0m" -docker exec bigtop-manager-build bash -c "mvn clean package -DskipTests" -docker stop bigtop-manager-build - -echo -e "\033[32mCreating network bigtop-manager\033[0m" -docker network create --driver bridge bigtop-manager - -echo -e "\033[32mCreating container bigtop-manager-server\033[0m" -docker run -d -p 3306:3306 -p 5005:5005 -p 8080:8080 --name bigtop-manager-server --hostname bigtop-manager-server --network bigtop-manager --privileged -e "container=docker" -v /sys/fs/cgroup:/sys/fs/cgroup:ro bigtop-manager/develop:trunk-centos-7 /usr/sbin/init -docker cp ../../../bigtop-manager-server/target/bigtop-manager-server bigtop-manager-server:/opt/ -docker cp ../../../bigtop-manager-agent/target/bigtop-manager-agent bigtop-manager-server:/opt/ -SERVER_PUB_KEY=`docker exec bigtop-manager-server /bin/cat /root/.ssh/id_rsa.pub` -docker exec bigtop-manager-server bash -c "echo '$SERVER_PUB_KEY' > /root/.ssh/authorized_keys" -docker exec bigtop-manager-server /bin/systemctl enable sshd -docker exec bigtop-manager-server /bin/systemctl start sshd - -echo -e "\033[32mSetting up mariadb-server\033[0m" -docker exec bigtop-manager-server /bin/systemctl enable mariadb -docker exec bigtop-manager-server /bin/systemctl start mariadb -docker exec bigtop-manager-server bash -c "mysql -e \"UPDATE mysql.user SET Password = PASSWORD('root') WHERE User = 'root'\"" -docker exec bigtop-manager-server bash -c "mysql -e \"GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION\"" -docker exec bigtop-manager-server bash -c "mysql -e \"DROP USER ''@'localhost'\"" -docker exec bigtop-manager-server bash -c "mysql -e \"DROP DATABASE test\"" -docker exec bigtop-manager-server bash -c "mysql -e \"CREATE DATABASE bigtop_manager\"" - -docker exec bigtop-manager-server bash -c "mysql -e \"FLUSH PRIVILEGES\"" - -echo -e "\033[32mCreating container bigtop-manager-agent-01\033[0m" -docker run -d --name bigtop-manager-agent-01 --hostname bigtop-manager-agent-01 --network bigtop-manager --privileged -e "container=docker" -v /sys/fs/cgroup:/sys/fs/cgroup:ro bigtop-manager/develop:trunk-centos-7 /usr/sbin/init -docker cp ../../../bigtop-manager-agent/target/bigtop-manager-agent bigtop-manager-agent-01:/opt/ -docker exec bigtop-manager-agent-01 bash -c "echo '$SERVER_PUB_KEY' > /root/.ssh/authorized_keys" -docker exec bigtop-manager-agent-01 /bin/systemctl enable sshd -docker exec bigtop-manager-agent-01 /bin/systemctl start sshd - -echo -e "\033[32mCreating container bigtop-manager-agent-02\033[0m" -docker run -d --name bigtop-manager-agent-02 --hostname bigtop-manager-agent-02 --network bigtop-manager --privileged -e "container=docker" -v /sys/fs/cgroup:/sys/fs/cgroup:ro bigtop-manager/develop:trunk-centos-7 /usr/sbin/init -docker cp ../../../bigtop-manager-agent/target/bigtop-manager-agent bigtop-manager-agent-02:/opt/ -docker exec bigtop-manager-agent-02 bash -c "echo '$SERVER_PUB_KEY' > /root/.ssh/authorized_keys" -docker exec bigtop-manager-agent-02 /bin/systemctl enable sshd -docker exec bigtop-manager-agent-02 /bin/systemctl start sshd - -echo -e "\033[32mConfiguring hosts file\033[0m" -BIGTOP_MANAGER_SERVER_IP=`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' bigtop-manager-server` -BIGTOP_MANAGER_AGENT_01_IP=`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' bigtop-manager-agent-01` -BIGTOP_MANAGER_AGENT_02_IP=`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' bigtop-manager-agent-02` -docker exec bigtop-manager-server bash -c "echo '$BIGTOP_MANAGER_AGENT_01_IP bigtop-manager-agent-01' >> /etc/hosts" -docker exec bigtop-manager-server bash -c "echo '$BIGTOP_MANAGER_AGENT_02_IP bigtop-manager-agent-02' >> /etc/hosts" -docker exec bigtop-manager-agent-01 bash -c "echo '$BIGTOP_MANAGER_SERVER_IP bigtop-manager-server' >> /etc/hosts" -docker exec bigtop-manager-agent-01 bash -c "echo '$BIGTOP_MANAGER_AGENT_02_IP bigtop-manager-agent-02' >> /etc/hosts" -docker exec bigtop-manager-agent-02 bash -c "echo '$BIGTOP_MANAGER_SERVER_IP bigtop-manager-server' >> /etc/hosts" -docker exec bigtop-manager-agent-02 bash -c "echo '$BIGTOP_MANAGER_AGENT_01_IP bigtop-manager-agent-01' >> /etc/hosts" - -echo -e "\033[32mSynchronize Chrony\033[0m" -docker exec bigtop-manager-server bash -c "systemctl enable chronyd; systemctl start chronyd; chronyc tracking" -docker exec bigtop-manager-agent-01 bash -c "systemctl enable chronyd; systemctl start chronyd; chronyc tracking" -docker exec bigtop-manager-agent-02 bash -c "systemctl enable chronyd; systemctl start chronyd; chronyc tracking" - -echo -e "\033[32mServer Ip Setting\033[0m" -docker exec bigtop-manager-server bash -c "sed -i 's/bigtop.manager.server.host=localhost/bigtop.manager.server.host=$BIGTOP_MANAGER_SERVER_IP/' /opt/bigtop-manager-agent/conf/application.yml" -docker exec bigtop-manager-agent-01 bash -c "sed -i 's/bigtop.manager.server.host=localhost/bigtop.manager.server.host=$BIGTOP_MANAGER_SERVER_IP/' /opt/bigtop-manager-agent/conf/application.yml" -docker exec bigtop-manager-agent-02 bash -c "sed -i 's/bigtop.manager.server.host=localhost/bigtop.manager.server.host=$BIGTOP_MANAGER_SERVER_IP/' /opt/bigtop-manager-agent/conf/application.yml" - -docker exec bigtop-manager-server bash -c "nohup /bin/bash /opt/bigtop-manager-server/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-server bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-agent-01 bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-agent-02 bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" - -echo -e "\033[32mPrint Bigtop-Manager Server RSA Private Key\033[0m" -docker exec bigtop-manager-server bash -c "cat ~/.ssh/id_rsa" - -# MySQL HOST: bigtop-manager-server -# MySQL PORT: 3306 -# DATABASE NAME: bigtop_manager -# DATABASE USER NAME: root -# DATABASE PASSWORD: root - diff --git a/dev-support/docker/centos7/build-image.sh b/dev-support/docker/centos7/build-image.sh deleted file mode 100755 index 0871b46d3..000000000 --- a/dev-support/docker/centos7/build-image.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/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 -# -# https://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. -# - -BIN_DIR=$(dirname $0) -cd $BIN_DIR -echo $PWD - -echo -e "\033[32mRemoving image bigtop-manager:trunk-centos-7\033[0m" -docker rmi bigtop-manager/develop:trunk-centos-7 - -echo -e "\033[32mBuilding image bigtop-manager:trunk-centos-7\033[0m" -docker build -t bigtop-manager/develop:trunk-centos-7 . diff --git a/dev-support/docker/centos7/clear-containers.sh b/dev-support/docker/centos7/clear-containers.sh deleted file mode 100755 index 65f3d7f94..000000000 --- a/dev-support/docker/centos7/clear-containers.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/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 -# -# https://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. -# - -echo -e "\033[32mStopping container bigtop-manager-build and maven process\033[0m" -if [ `docker inspect --format '{{.State.Running}}' bigtop-manager-build` == true ];then - docker exec bigtop-manager-build bash -c "pkill -KILL -f maven" - docker stop bigtop-manager-build -fi - -echo -e "\033[32mRemoving container bigtop-manager-server\033[0m" -docker rm -f bigtop-manager-server - -echo -e "\033[32mRemoving container bigtop-manager-agent-01\033[0m" -docker rm -f bigtop-manager-agent-01 - -echo -e "\033[32mRemoving container bigtop-manager-agent-02\033[0m" -docker rm -f bigtop-manager-agent-02 - -echo -e "\033[32mRemoving network bigtop-manager\033[0m" -docker network rm bigtop-manager \ No newline at end of file diff --git a/dev-support/docker/centos7/distribute-scripts.sh b/dev-support/docker/centos7/distribute-scripts.sh deleted file mode 100755 index e35c10534..000000000 --- a/dev-support/docker/centos7/distribute-scripts.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/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 -# -# https://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. -# - -echo -e "\033[32mSynchronizing script to bigtop-manager-server\033[0m" -docker cp ../../../bigtop-manager-server/src/main/resources/stacks/ bigtop-manager-server:/opt/bigtop-manager-server/ - -docker exec bigtop-manager-server bash -c "ps -ef | grep 'org.apache.bigtop.manager.server.ServerApplication' | grep -v 'grep' | awk '{print $2}' | xargs kill" -docker exec bigtop-manager-server bash -c "ps -ef | grep 'org.apache.bigtop.manager.agent.AgentApplication' | grep -v 'grep' | awk '{print $2}' | xargs kill" -docker exec bigtop-manager-agent-01 bash -c "ps -ef | grep 'org.apache.bigtop.manager.agent.AgentApplication' | grep -v 'grep' | awk '{print $2}' | xargs kill" -docker exec bigtop-manager-agent-02 bash -c "ps -ef | grep 'org.apache.bigtop.manager.agent.AgentApplication' | grep -v 'grep' | awk '{print $2}' | xargs kill" - -docker exec bigtop-manager-server bash -c "nohup /bin/bash /opt/bigtop-manager-server/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-server bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-agent-01 bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-agent-02 bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" - -echo -e "\033[32mDone!\033[0m" \ No newline at end of file diff --git a/dev-support/docker/containers/build.sh b/dev-support/docker/containers/build.sh new file mode 100644 index 000000000..afe8090d4 --- /dev/null +++ b/dev-support/docker/containers/build.sh @@ -0,0 +1,226 @@ +# 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 -e + +usage() { + echo "usage: $PROG args" + echo " commands:" + echo " -c NUM_INSTANCES, --create NUM_INSTANCES - Create Docker containers based bigtop-manager cluster, defaults to 3" + echo " -e, --database - The specified database, defaults to postgres" + echo " -o, --os - Specify the operating system, default is trunk-rocky-8" + echo " --skip-compile - Skip Compile" + echo " -d, --destroy - Destroy all containers" + echo " -h, --help" + exit 1 +} + +log() { + echo -e "\033[32m[LOG] $1\033[0m" +} + +build() { + log "Build on docker $SKIP_BUILD" + if ! $SKIP_BUILD; then + log "Compiling bigtop-manager" + docker run -it --rm -u $(id -u):$(id -g) \ + -v $PWD/../../../:/opt/develop/bigtop-manager/ \ + -v /$USER/.m2:/$USER/.m2 \ + -w /opt/develop/bigtop-manager \ + bigtop-manager/develop:${OS} bash -c "mvn clean package -DskipTests" + else + log "Skip Compile!!!" + fi + log "Build Success!!!" +} + +destroy() { + log "Destroy Containers!!!" + docker rm -f $(docker network inspect bigtop-manager -f '{{range .Containers}}{{.Name}}{{" "}}{{end}}') + docker network rm bigtop-manager + exit 0 +} + +create() { + log "Create Containers!!!" + docker network create --driver bridge bigtop-manager + create_db + create_container +} + +create_container() { + for ((i=1;i<=$NUM_INSTANCES;i+=1)) + do + container_name="bm-$i" + log "Create ${container_name}" + if [ $i -eq 1 ]; then + docker run -itd -p 15005:5005 -p 15006:5006 -p 18080:8080 --name ${container_name} --hostname ${container_name} --network bigtop-manager --cap-add=SYS_TIME bigtop-manager/develop:${OS} + docker cp ../../../bigtop-manager-server/target/bigtop-manager-server ${container_name}:/opt/ + SERVER_PUB_KEY=`docker exec ${container_name} /bin/cat /root/.ssh/id_rsa.pub` + else + docker run -itd --name ${container_name} --hostname ${container_name} --network bigtop-manager --cap-add=SYS_TIME bigtop-manager/develop:${OS} + fi + docker cp ../../../bigtop-manager-agent/target/bigtop-manager-agent ${container_name}:/opt/ + docker exec ${container_name} bash -c "echo '$SERVER_PUB_KEY' > /root/.ssh/authorized_keys" + docker exec ${container_name} ssh-keygen -N '' -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key + docker exec ${container_name} ssh-keygen -N '' -t ecdsa -b 256 -f /etc/ssh/ssh_host_ecdsa_key + docker exec ${container_name} ssh-keygen -N '' -t ed25519 -b 256 -f /etc/ssh/ssh_host_ed25519_key + docker exec ${container_name} /bin/systemctl start sshd + + docker exec ${container_name} bash -c "systemctl start chronyd && chronyc tracking" + done + + containers=($(docker network inspect bigtop-manager -f '{{range .Containers}}{{.Name}}{{" "}}{{end}}')) + for container in ${containers[@]}; do + container_ip=$(docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $container) + log "container: ${container}; container_ip: ${container_ip}" + for container2 in ${containers[@]}; do + if [ ${container2} != $container ]; then + docker exec ${container2} bash -c "echo '${container_ip} ${container}' >> /etc/hosts" + fi + done + done + + # wait database started + for container in ${containers[@]}; do + if [ ${container} == "bm-1" ]; then + if [ $DATABASE == "mysql" ]; then + log "docker exec ${container} bash -c \"mysql -h bm-mysql -P 3306 -uroot -proot -e 'create database bigtop_manager'\"" + docker exec ${container} bash -c "mysql -h bm-mysql -P 3306 -uroot -proot -e 'create database bigtop_manager'" + docker exec ${container} bash -c "mysql -h bm-mysql -P 3306 -uroot -proot -Dbigtop_manager < /opt/bigtop-manager-server/ddl/MySQL-DDL-CREATE.sql" + + docker exec ${container} bash -c "wget https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.0.33/mysql-connector-j-8.0.33.jar -O /opt/bigtop-manager-server/libs/mysql-connector-java-8.0.33.jar" + docker exec ${container} bash -c "sed -i 's/org.postgresql.Driver/com.mysql.cj.jdbc.Driver/' /opt/bigtop-manager-server/conf/application.yml" + docker exec ${container} bash -c "sed -i 's/postgresql/mysql/' /opt/bigtop-manager-server/conf/application.yml" + docker exec ${container} bash -c "sed -i 's/localhost:5432/bm-mysql:3306/' /opt/bigtop-manager-server/conf/application.yml" + docker exec ${container} bash -c "sed -i 's/postgres/root/' /opt/bigtop-manager-server/conf/application.yml" + elif [ $DATABASE == "postgres" ]; then + docker exec ${container} bash -c "yum install postgresql -y" + docker exec ${container} bash -c "PGPASSWORD=postgres psql -h bm-postgres -p5432 -U postgres -c 'create database bigtop_manager'" + docker exec ${container} bash -c "PGPASSWORD=postgres psql -h bm-postgres -p5432 -U postgres -d bigtop_manager -f /opt/bigtop-manager-server/ddl/PostgreSQL-DDL-CREATE.sql" + docker exec ${container} bash -c "sed -i 's/localhost:5432/bm-postgres:5432/' /opt/bigtop-manager-server/conf/application.yml" + fi + docker exec ${container} bash -c "nohup /bin/bash /opt/bigtop-manager-server/bin/start.sh --debug > /dev/null 2>&1 &" + fi + docker exec ${container} bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh --debug > /dev/null 2>&1 &" + log "All Service Started!!!" + done + +} + +create_db() { + if [ $DATABASE == "mysql" ]; then + docker run --restart=always -it -d \ + -p 3306:3306 \ + --cap-add=SYS_TIME \ + --network bigtop-manager \ + --name bm-mysql \ + --hostname bm-mysql \ + -e MYSQL_ROOT_PASSWORD=root \ + mysql:8.0 + # Loop check log + while true; do + # Use the Docker logs command to retrieve the latest log content + logs=$(docker logs bm-mysql | tail -n 100) + log "$logs" + + # Check if the log contains specific strings + if echo "$logs" | grep -q "/usr/sbin/mysqld: ready for connections"; then + echo "MySQL is ready for connections." + break + else + echo "MySQL is not ready yet, waiting..." + # Wait for a while and check again + sleep 5 + fi + done + elif [ $DATABASE == "postgres" ]; then + docker run --restart=always -d \ + -p 5432:5432 \ + --network bigtop-manager \ + --name bm-postgres \ + --hostname bm-postgres \ + -e POSTGRES_PASSWORD=postgres \ + postgres:16 + fi +} + + +BIN_DIR=$(dirname $0) +cd $BIN_DIR +echo $PWD + +PROG=`basename $0` + +DATABASE=postgres +OS=trunk-rocky-8 +NUM_INSTANCES=3 +SKIP_BUILD=false + +while [ $# -gt 0 ]; do + case "$1" in + -e|--database) + if [ $# -lt 2 ]; then + echo "Requires a db" 1>&2 + usage + fi + if [ $2 != "postgres" ] && [ $2 != "mysql" ]; then + echo "The Database should be [postgres], or [mysql]" 1>&2 + usage + fi + DATABASE=$2 + shift 2;; + -o|--os) + if [ $# -lt 2 ]; then + echo "Requires a os" 1>&2 + usage + fi + if [ $2 != "trunk-rocky-8" ] && [ $2 != "trunk-centos-7" ] && [ $2 != "trunk-openeuler-22" ]; then + echo "The OS should be [trunk-rocky-8], [trunk-centos-7], or [trunk-openeuler-22]" 1>&2 + usage + fi + OS=$2 + shift 2;; + -c|--create) + if [ $# -lt 2 ]; then + echo "Requires a container number" 1>&2 + usage + fi + if [ $2 -gt 10 ] || [ $2 -lt 3 ]; then + echo "NUM-INSTANCES should be between [3-10]" 1>&2 + usage + fi + NUM_INSTANCES=$2 + shift 2;; + --skip-compile) + SKIP_BUILD=true + shift;; + -d|--destroy) + destroy + shift;; + -h|--help) + usage + shift;; + *) + echo "Unknown argument: '$1'" 1>&2 + usage;; + esac +done + +log "DATABASE: $DATABASE; OS: $OS; NUM_INSTANCES: $NUM_INSTANCES; SKIP_BUILD: $SKIP_BUILD; " + +build + +create diff --git a/dev-support/docker/rocky8/Dockerfile b/dev-support/docker/image/Dockerfile.template similarity index 97% rename from dev-support/docker/rocky8/Dockerfile rename to dev-support/docker/image/Dockerfile.template index 1e12fe29b..1b3659489 100644 --- a/dev-support/docker/rocky8/Dockerfile +++ b/dev-support/docker/image/Dockerfile.template @@ -13,7 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM rockylinux:8 +FROM OS:VERSION + +MAINTAINER dev@bigtop.apache.org RUN yum -y install sudo wget openssh-clients openssh-server vim mariadb mariadb-server net-tools chrony krb5-server krb5-libs krb5-workstation git rpm-build python3 procps-ng RUN wget https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz -O /tmp/jdk.tar.gz --no-check-certificate \ @@ -29,5 +31,3 @@ RUN wget https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement RUN /bin/sed -i 's,# StrictHostKeyChecking ask,StrictHostKeyChecking no,g' /etc/ssh/ssh_config RUN ssh-keygen -f "/root/.ssh/id_rsa" -N "" - -EXPOSE 1-65535 diff --git a/dev-support/docker/image/build.sh b/dev-support/docker/image/build.sh new file mode 100644 index 000000000..cc0d380d9 --- /dev/null +++ b/dev-support/docker/image/build.sh @@ -0,0 +1,78 @@ +#!/bin/sh + +# 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 -ex + +log() { + echo -e "\n[LOG] $1\n" +} + +exception() { + echo "[ERROR] Unsupported [${OS}-${VERSION}]" + exit 1 +} + +BIN_DIR=$(dirname $0) +cd $BIN_DIR +echo $PWD + +if [ $# != 1 ]; then + echo "Creates bigtop-manager/develop image" + echo + echo "Usage: build.sh " + echo + echo "Example: build.sh trunk-rocky-8" + echo " : build.sh 1.0.0-rocky-8" + exit 1 +fi + +PREFIX=$(echo "$1" | cut -d '-' -f 1) +OS=$(echo "$1" | cut -d '-' -f 2) +VERSION=$(echo "$1" | cut -d '-' -f 3-) + + +# Decimals are not supported. Either use integers only +# e.g. 16.04 -> 16 +VERSION_INT=$(echo "$VERSION" | cut -d '.' -f 1) + +log "PREFIX: ${PREFIX}; OS: ${OS}; VERSION: ${VERSION}; VERSION_INT: ${VERSION_INT}" +DOCKER_OS=${OS} +DOCKER_VERSION=${VERSION} +CUSTOM_REPO="" +case ${OS}-${VERSION_INT} in + centos-7) + CUSTOM_REPO="RUN mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.back \ + && curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo" + ;; + rocky-8) + DOCKER_OS=rockylinux + ;; + openeuler-22) + DOCKER_OS=openeuler/openeuler + DOCKER_VERSION=22.03 + ;; + *) + echo "Unsupported OS ${OS}-${VERSION}." + exit 1 +esac + +# generate Dockerfile for build +sed -e "s|OS|${DOCKER_OS}|;s|VERSION|${DOCKER_VERSION}|" Dockerfile.template | + sed -e "/MAINTAINER dev@bigtop.apache.org/a\\$CUSTOM_REPO" > Dockerfile + +docker build --rm --no-cache -t bigtop-manager/develop:${PREFIX}-${OS}-${VERSION} -f Dockerfile ../.. +rm -f Dockerfile diff --git a/dev-support/docker/openeuler22/Dockerfile b/dev-support/docker/openeuler22/Dockerfile deleted file mode 100644 index 631f5eaba..000000000 --- a/dev-support/docker/openeuler22/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -# 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. - -FROM openeuler/openeuler:22.03 - -RUN dnf -y install sudo wget openssh-clients openssh-server vim mariadb mariadb-server net-tools chrony krb5-server krb5-libs krb5-workstation git rpm-build python3 procps-ng -RUN wget https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz -O /tmp/jdk.tar.gz --no-check-certificate \ - && mkdir -p /usr/local/java && tar -xzf /tmp/jdk.tar.gz -C /usr/local/java --strip-components=1 \ - && rm -f /tmp/jdk.tar.gz \ - && ln -s /usr/local/java/bin/java /usr/bin/java -RUN wget https://archive.apache.org/dist/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz -O /tmp/apache-maven.tar.gz --no-check-certificate \ - && mkdir -p /usr/share/maven && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \ - && rm -f /tmp/apache-maven.tar.gz \ - && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn -RUN wget https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl3.py -O /usr/bin/systemctl - -RUN /bin/sed -i 's,# StrictHostKeyChecking ask,StrictHostKeyChecking no,g' /etc/ssh/ssh_config - -RUN ssh-keygen -f "/root/.ssh/id_rsa" -N "" - -EXPOSE 1-65535 diff --git a/dev-support/docker/openeuler22/build-containers.sh b/dev-support/docker/openeuler22/build-containers.sh deleted file mode 100755 index 23844dd13..000000000 --- a/dev-support/docker/openeuler22/build-containers.sh +++ /dev/null @@ -1,133 +0,0 @@ -#!/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 -# -# https://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. -# - -BIN_DIR=$(dirname $0) -cd $BIN_DIR -echo $PWD - -SKIP_BUILD=false - -for arg in "$@" -do - if [ "$arg" == "--skip-build" ]; then - SKIP_BUILD=true - fi -done - -if ! $SKIP_BUILD; then - echo -e "\033[32mBuild on docker\033[0m" - echo -e "\033[32mStarting container bigtop-manager-build-oe22\033[0m" - if [[ -z $(docker ps -a --format "table {{.Names}}" | grep "bigtop-manager-build-oe22") ]];then - docker run -it -d --name bigtop-manager-build-oe22 -u $(id -u):$(id -g) -v $PWD/../../../:/opt/develop/bigtop-manager/ -w /opt/develop/bigtop-manager bigtop-manager/develop:trunk-openeuler-22 - else - docker start bigtop-manager-build-oe22 - fi - - echo -e "\033[32mCompiling bigtop-manager\033[0m" - docker exec bigtop-manager-build-oe22 bash -c "mvn clean package -DskipTests" - docker stop bigtop-manager-build-oe22 -fi - -echo -e "\033[32mCreating network bigtop-manager\033[0m" -docker network create --driver bridge bigtop-manager - -echo -e "\033[32mCreating container bigtop-manager-server\033[0m" -docker run -it -d -p 13306:3306 -p 15005:5005 -p 15006:5006 -p 18080:8080 --name bigtop-manager-server --hostname bigtop-manager-server --network bigtop-manager --cap-add=SYS_TIME bigtop-manager/develop:trunk-openeuler-22 -docker cp ../../../bigtop-manager-server/target/bigtop-manager-server bigtop-manager-server:/opt/ -docker cp ../../../bigtop-manager-agent/target/bigtop-manager-agent bigtop-manager-server:/opt/ -SERVER_PUB_KEY=`docker exec bigtop-manager-server /bin/cat /root/.ssh/id_rsa.pub` -docker exec bigtop-manager-server bash -c "echo '$SERVER_PUB_KEY' > /root/.ssh/authorized_keys" -docker exec bigtop-manager-server ssh-keygen -N '' -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key -docker exec bigtop-manager-server ssh-keygen -N '' -t ecdsa -b 256 -f /etc/ssh/ssh_host_ecdsa_key -docker exec bigtop-manager-server ssh-keygen -N '' -t ed25519 -b 256 -f /etc/ssh/ssh_host_ed25519_key -docker exec bigtop-manager-server /bin/systemctl start sshd - -echo -e "\033[32mSetting up mariadb-server\033[0m" -docker exec bigtop-manager-server bash -c "systemctl start mariadb" -docker exec bigtop-manager-server bash -c "mysql -e \"UPDATE mysql.user SET Password = PASSWORD('root') WHERE User = 'root'\"" -docker exec bigtop-manager-server bash -c "mysql -e \"GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION\"" -docker exec bigtop-manager-server bash -c "mysql -e \"CREATE DATABASE bigtop_manager\"" -docker exec bigtop-manager-server bash -c "mysql -e \"FLUSH PRIVILEGES\"" -docker exec bigtop-manager-server bash -c "mysql -e \"DROP USER 'root'@'localhost'\"" - -echo -e "\033[32mCreating container bigtop-manager-agent-01\033[0m" -docker run -it -d --name bigtop-manager-agent-01 --hostname bigtop-manager-agent-01 --network bigtop-manager --cap-add=SYS_TIME bigtop-manager/develop:trunk-openeuler-22 -docker cp ../../../bigtop-manager-agent/target/bigtop-manager-agent bigtop-manager-agent-01:/opt/ -docker exec bigtop-manager-agent-01 bash -c "echo '$SERVER_PUB_KEY' > /root/.ssh/authorized_keys" -docker exec bigtop-manager-agent-01 ssh-keygen -N '' -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key -docker exec bigtop-manager-agent-01 ssh-keygen -N '' -t ecdsa -b 256 -f /etc/ssh/ssh_host_ecdsa_key -docker exec bigtop-manager-agent-01 ssh-keygen -N '' -t ed25519 -b 256 -f /etc/ssh/ssh_host_ed25519_key -docker exec bigtop-manager-agent-01 /bin/systemctl start sshd - -echo -e "\033[32mCreating container bigtop-manager-agent-02\033[0m" -docker run -it -d --name bigtop-manager-agent-02 --hostname bigtop-manager-agent-02 --network bigtop-manager --cap-add=SYS_TIME bigtop-manager/develop:trunk-openeuler-22 -docker cp ../../../bigtop-manager-agent/target/bigtop-manager-agent bigtop-manager-agent-02:/opt/ -docker exec bigtop-manager-agent-02 bash -c "echo '$SERVER_PUB_KEY' > /root/.ssh/authorized_keys" -docker exec bigtop-manager-agent-02 ssh-keygen -N '' -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key -docker exec bigtop-manager-agent-02 ssh-keygen -N '' -t ecdsa -b 256 -f /etc/ssh/ssh_host_ecdsa_key -docker exec bigtop-manager-agent-02 ssh-keygen -N '' -t ed25519 -b 256 -f /etc/ssh/ssh_host_ed25519_key -docker exec bigtop-manager-agent-02 /bin/systemctl start sshd - -echo -e "\033[32mConfiguring hosts file\033[0m" -BIGTOP_MANAGER_SERVER_IP=`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' bigtop-manager-server` -BIGTOP_MANAGER_AGENT_01_IP=`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' bigtop-manager-agent-01` -BIGTOP_MANAGER_AGENT_02_IP=`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' bigtop-manager-agent-02` -docker exec bigtop-manager-server bash -c "echo '$BIGTOP_MANAGER_AGENT_01_IP bigtop-manager-agent-01' >> /etc/hosts" -docker exec bigtop-manager-server bash -c "echo '$BIGTOP_MANAGER_AGENT_02_IP bigtop-manager-agent-02' >> /etc/hosts" -docker exec bigtop-manager-agent-01 bash -c "echo '$BIGTOP_MANAGER_SERVER_IP bigtop-manager-server' >> /etc/hosts" -docker exec bigtop-manager-agent-01 bash -c "echo '$BIGTOP_MANAGER_AGENT_02_IP bigtop-manager-agent-02' >> /etc/hosts" -docker exec bigtop-manager-agent-02 bash -c "echo '$BIGTOP_MANAGER_SERVER_IP bigtop-manager-server' >> /etc/hosts" -docker exec bigtop-manager-agent-02 bash -c "echo '$BIGTOP_MANAGER_AGENT_01_IP bigtop-manager-agent-01' >> /etc/hosts" - -echo -e "\033[32mSynchronize Chrony\033[0m" -docker exec bigtop-manager-server bash -c "systemctl start chronyd" -docker exec bigtop-manager-server bash -c "chronyc tracking" -docker exec bigtop-manager-agent-01 bash -c "systemctl start chronyd" -docker exec bigtop-manager-agent-01 bash -c "chronyc tracking" -docker exec bigtop-manager-agent-02 bash -c "systemctl start chronyd" -docker exec bigtop-manager-agent-02 bash -c "chronyc tracking" - -echo -e "\033[32mServer Settings\033[0m" -docker exec bigtop-manager-server bash -c "wget https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.0.33/mysql-connector-j-8.0.33.jar -O /opt/bigtop-manager-server/libs/mysql-connector-java-8.0.33.jar" -docker exec bigtop-manager-server bash -c "sed -i 's/org.postgresql.Driver/com.mysql.cj.jdbc.Driver/' /opt/bigtop-manager-server/conf/application.yml" -docker exec bigtop-manager-server bash -c "sed -i 's/postgresql/mysql/' /opt/bigtop-manager-server/conf/application.yml" -docker exec bigtop-manager-server bash -c "sed -i 's/localhost:5432/localhost:3306/' /opt/bigtop-manager-server/conf/application.yml" -docker exec bigtop-manager-server bash -c "sed -i 's/postgres/root/' /opt/bigtop-manager-server/conf/application.yml" - -docker exec bigtop-manager-server bash -c "sed -i 's/host: localhost/host: $BIGTOP_MANAGER_SERVER_IP/' /opt/bigtop-manager-agent/conf/application.yml" -docker exec bigtop-manager-agent-01 bash -c "sed -i 's/host: localhost/host: $BIGTOP_MANAGER_SERVER_IP/' /opt/bigtop-manager-agent/conf/application.yml" -docker exec bigtop-manager-agent-02 bash -c "sed -i 's/host: localhost/host: $BIGTOP_MANAGER_SERVER_IP/' /opt/bigtop-manager-agent/conf/application.yml" - -docker exec bigtop-manager-server bash -c "mysql -uroot -proot -Dbigtop_manager < /opt/bigtop-manager-server/ddl/MySQL-DDL-CREATE.sql" -docker exec bigtop-manager-server bash -c "nohup /bin/bash /opt/bigtop-manager-server/bin/start.sh --debug > /dev/null 2>&1 &" -docker exec bigtop-manager-server bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh --debug > /dev/null 2>&1 &" -docker exec bigtop-manager-agent-01 bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-agent-02 bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" - -echo -e "\033[32mPrint Bigtop-Manager Server RSA Private Key\033[0m" -docker exec bigtop-manager-server bash -c "cat ~/.ssh/id_rsa" - -# MySQL HOST: bigtop-manager-server -# MySQL PORT: 3306 -# DATABASE NAME: bigtop_manager -# DATABASE USER NAME: root -# DATABASE PASSWORD: root - diff --git a/dev-support/docker/openeuler22/build-image.sh b/dev-support/docker/openeuler22/build-image.sh deleted file mode 100755 index 5694daff8..000000000 --- a/dev-support/docker/openeuler22/build-image.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/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 -# -# https://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. -# - -BIN_DIR=$(dirname $0) -cd $BIN_DIR -echo $PWD - -echo -e "\033[32mRemoving image bigtop-manager:trunk-openeuler-22\033[0m" -docker rmi bigtop-manager/develop:trunk-openeuler-22 - -echo -e "\033[32mBuilding image bigtop-manager:trunk-openeuler-22\033[0m" -docker build -t bigtop-manager/develop:trunk-openeuler-22 . diff --git a/dev-support/docker/openeuler22/clear-containers.sh b/dev-support/docker/openeuler22/clear-containers.sh deleted file mode 100755 index 896296045..000000000 --- a/dev-support/docker/openeuler22/clear-containers.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/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 -# -# https://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. -# - -if docker ps -a | grep -q 'bigtop-manager-build-oe22'; then - echo -e "\033[32mStopping container bigtop-manager-build-oe22 and maven process\033[0m" - if [ `docker inspect --format '{{.State.Running}}' bigtop-manager-build-oe22` == true ];then - docker exec bigtop-manager-build-oe22 bash -c "pkill -KILL -f maven" - docker stop bigtop-manager-build-oe22 - fi -fi - -echo -e "\033[32mRemoving container bigtop-manager-server\033[0m" -docker rm -f bigtop-manager-server - -echo -e "\033[32mRemoving container bigtop-manager-agent-01\033[0m" -docker rm -f bigtop-manager-agent-01 - -echo -e "\033[32mRemoving container bigtop-manager-agent-02\033[0m" -docker rm -f bigtop-manager-agent-02 - -echo -e "\033[32mRemoving network bigtop-manager\033[0m" -docker network rm bigtop-manager \ No newline at end of file diff --git a/dev-support/docker/openeuler22/distribute-scripts.sh b/dev-support/docker/openeuler22/distribute-scripts.sh deleted file mode 100755 index e35c10534..000000000 --- a/dev-support/docker/openeuler22/distribute-scripts.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/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 -# -# https://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. -# - -echo -e "\033[32mSynchronizing script to bigtop-manager-server\033[0m" -docker cp ../../../bigtop-manager-server/src/main/resources/stacks/ bigtop-manager-server:/opt/bigtop-manager-server/ - -docker exec bigtop-manager-server bash -c "ps -ef | grep 'org.apache.bigtop.manager.server.ServerApplication' | grep -v 'grep' | awk '{print $2}' | xargs kill" -docker exec bigtop-manager-server bash -c "ps -ef | grep 'org.apache.bigtop.manager.agent.AgentApplication' | grep -v 'grep' | awk '{print $2}' | xargs kill" -docker exec bigtop-manager-agent-01 bash -c "ps -ef | grep 'org.apache.bigtop.manager.agent.AgentApplication' | grep -v 'grep' | awk '{print $2}' | xargs kill" -docker exec bigtop-manager-agent-02 bash -c "ps -ef | grep 'org.apache.bigtop.manager.agent.AgentApplication' | grep -v 'grep' | awk '{print $2}' | xargs kill" - -docker exec bigtop-manager-server bash -c "nohup /bin/bash /opt/bigtop-manager-server/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-server bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-agent-01 bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-agent-02 bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" - -echo -e "\033[32mDone!\033[0m" \ No newline at end of file diff --git a/dev-support/docker/openeuler22/restart-containers.sh b/dev-support/docker/openeuler22/restart-containers.sh deleted file mode 100755 index 7e0a49784..000000000 --- a/dev-support/docker/openeuler22/restart-containers.sh +++ /dev/null @@ -1,43 +0,0 @@ -# -# 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 -# -# https://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. -# - -echo -e "\033[32mRestarting containers\033[0m" -docker restart bigtop-manager-server -docker restart bigtop-manager-agent-01 -docker restart bigtop-manager-agent-02 - -echo -e "\033[32mRe-enabling systemctl servers\033[0m" -docker exec bigtop-manager-server bash -c "systemctl start mariadb" -docker exec bigtop-manager-server bash -c "systemctl start sshd" -docker exec bigtop-manager-server bash -c "systemctl start chronyd" -docker exec bigtop-manager-agent-01 bash -c "systemctl start sshd" -docker exec bigtop-manager-agent-01 bash -c "systemctl start chronyd" -docker exec bigtop-manager-agent-02 bash -c "systemctl start sshd" -docker exec bigtop-manager-agent-02 bash -c "systemctl start chronyd" - -echo -e "\033[32mSynchronize Chrony\033[0m" -docker exec bigtop-manager-server bash -c "chronyc tracking" -docker exec bigtop-manager-agent-01 bash -c "chronyc tracking" -docker exec bigtop-manager-agent-02 bash -c "chronyc tracking" - -echo -e "\033[32mRestarting bigtop-manager servers\033[0m" -docker exec bigtop-manager-server bash -c "nohup /bin/bash /opt/bigtop-manager-server/bin/start.sh --debug > /dev/null 2>&1 &" -docker exec bigtop-manager-server bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-agent-01 bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-agent-02 bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" diff --git a/dev-support/docker/rocky8/build-containers.sh b/dev-support/docker/rocky8/build-containers.sh deleted file mode 100755 index 86f4184eb..000000000 --- a/dev-support/docker/rocky8/build-containers.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/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 -# -# https://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. -# - -BIN_DIR=$(dirname $0) -cd $BIN_DIR -echo $PWD - -SKIP_BUILD=false - -for arg in "$@" -do - if [ "$arg" == "--skip-build" ]; then - SKIP_BUILD=true - fi -done - -if ! $SKIP_BUILD; then - echo -e "\033[32mBuild on docker\033[0m" - echo -e "\033[32mStarting container bigtop-manager-build-r8\033[0m" - if [[ -z $(docker ps -a --format "table {{.Names}}" | grep "bigtop-manager-build-r8") ]];then - docker run -it -d --name bigtop-manager-build-r8 -u $(id -u):$(id -g) -v $PWD/../../../:/opt/develop/bigtop-manager/ -w /opt/develop/bigtop-manager bigtop-manager/develop:trunk-rocky-8 - else - docker start bigtop-manager-build-r8 - fi - - echo -e "\033[32mCompiling bigtop-manager\033[0m" - docker exec bigtop-manager-build-r8 bash -c "mvn clean package -DskipTests" - docker stop bigtop-manager-build-r8 -fi - -echo -e "\033[32mCreating network bigtop-manager\033[0m" -docker network create --driver bridge bigtop-manager - -echo -e "\033[32mCreating container bigtop-manager-server\033[0m" -docker run -it -d -p 13306:3306 -p 15005:5005 -p 15006:5006 -p 18080:8080 --name bigtop-manager-server --hostname bigtop-manager-server --network bigtop-manager --cap-add=SYS_TIME bigtop-manager/develop:trunk-rocky-8 -docker cp ../../../bigtop-manager-server/target/bigtop-manager-server bigtop-manager-server:/opt/ -docker cp ../../../bigtop-manager-agent/target/bigtop-manager-agent bigtop-manager-server:/opt/ -SERVER_PUB_KEY=`docker exec bigtop-manager-server /bin/cat /root/.ssh/id_rsa.pub` -docker exec bigtop-manager-server bash -c "echo '$SERVER_PUB_KEY' > /root/.ssh/authorized_keys" -docker exec bigtop-manager-server ssh-keygen -N '' -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key -docker exec bigtop-manager-server ssh-keygen -N '' -t ecdsa -b 256 -f /etc/ssh/ssh_host_ecdsa_key -docker exec bigtop-manager-server ssh-keygen -N '' -t ed25519 -b 256 -f /etc/ssh/ssh_host_ed25519_key -docker exec bigtop-manager-server /bin/systemctl start sshd - -echo -e "\033[32mSetting up mariadb-server\033[0m" -docker exec bigtop-manager-server bash -c "systemctl start mariadb" -docker exec bigtop-manager-server bash -c "mysql -e \"UPDATE mysql.user SET Password = PASSWORD('root') WHERE User = 'root'\"" -docker exec bigtop-manager-server bash -c "mysql -e \"GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION\"" -docker exec bigtop-manager-server bash -c "mysql -e \"CREATE DATABASE bigtop_manager\"" -docker exec bigtop-manager-server bash -c "mysql -e \"FLUSH PRIVILEGES\"" - -echo -e "\033[32mCreating container bigtop-manager-agent-01\033[0m" -docker run -it -d --name bigtop-manager-agent-01 --hostname bigtop-manager-agent-01 --network bigtop-manager --cap-add=SYS_TIME bigtop-manager/develop:trunk-rocky-8 -docker cp ../../../bigtop-manager-agent/target/bigtop-manager-agent bigtop-manager-agent-01:/opt/ -docker exec bigtop-manager-agent-01 bash -c "echo '$SERVER_PUB_KEY' > /root/.ssh/authorized_keys" -docker exec bigtop-manager-agent-01 ssh-keygen -N '' -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key -docker exec bigtop-manager-agent-01 ssh-keygen -N '' -t ecdsa -b 256 -f /etc/ssh/ssh_host_ecdsa_key -docker exec bigtop-manager-agent-01 ssh-keygen -N '' -t ed25519 -b 256 -f /etc/ssh/ssh_host_ed25519_key -docker exec bigtop-manager-agent-01 /bin/systemctl start sshd - -echo -e "\033[32mCreating container bigtop-manager-agent-02\033[0m" -docker run -it -d --name bigtop-manager-agent-02 --hostname bigtop-manager-agent-02 --network bigtop-manager --cap-add=SYS_TIME bigtop-manager/develop:trunk-rocky-8 -docker cp ../../../bigtop-manager-agent/target/bigtop-manager-agent bigtop-manager-agent-02:/opt/ -docker exec bigtop-manager-agent-02 bash -c "echo '$SERVER_PUB_KEY' > /root/.ssh/authorized_keys" -docker exec bigtop-manager-agent-02 ssh-keygen -N '' -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key -docker exec bigtop-manager-agent-02 ssh-keygen -N '' -t ecdsa -b 256 -f /etc/ssh/ssh_host_ecdsa_key -docker exec bigtop-manager-agent-02 ssh-keygen -N '' -t ed25519 -b 256 -f /etc/ssh/ssh_host_ed25519_key -docker exec bigtop-manager-agent-02 /bin/systemctl start sshd - -echo -e "\033[32mConfiguring hosts file\033[0m" -BIGTOP_MANAGER_SERVER_IP=`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' bigtop-manager-server` -BIGTOP_MANAGER_AGENT_01_IP=`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' bigtop-manager-agent-01` -BIGTOP_MANAGER_AGENT_02_IP=`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' bigtop-manager-agent-02` -docker exec bigtop-manager-server bash -c "echo '$BIGTOP_MANAGER_AGENT_01_IP bigtop-manager-agent-01' >> /etc/hosts" -docker exec bigtop-manager-server bash -c "echo '$BIGTOP_MANAGER_AGENT_02_IP bigtop-manager-agent-02' >> /etc/hosts" -docker exec bigtop-manager-agent-01 bash -c "echo '$BIGTOP_MANAGER_SERVER_IP bigtop-manager-server' >> /etc/hosts" -docker exec bigtop-manager-agent-01 bash -c "echo '$BIGTOP_MANAGER_AGENT_02_IP bigtop-manager-agent-02' >> /etc/hosts" -docker exec bigtop-manager-agent-02 bash -c "echo '$BIGTOP_MANAGER_SERVER_IP bigtop-manager-server' >> /etc/hosts" -docker exec bigtop-manager-agent-02 bash -c "echo '$BIGTOP_MANAGER_AGENT_01_IP bigtop-manager-agent-01' >> /etc/hosts" - -echo -e "\033[32mSynchronize Chrony\033[0m" -docker exec bigtop-manager-server bash -c "systemctl start chronyd" -docker exec bigtop-manager-server bash -c "chronyc tracking" -docker exec bigtop-manager-agent-01 bash -c "systemctl start chronyd" -docker exec bigtop-manager-agent-01 bash -c "chronyc tracking" -docker exec bigtop-manager-agent-02 bash -c "systemctl start chronyd" -docker exec bigtop-manager-agent-02 bash -c "chronyc tracking" - -echo -e "\033[32mServer Settings\033[0m" -docker exec bigtop-manager-server bash -c "wget https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.0.33/mysql-connector-j-8.0.33.jar -O /opt/bigtop-manager-server/libs/mysql-connector-java-8.0.33.jar" -docker exec bigtop-manager-server bash -c "sed -i 's/org.postgresql.Driver/com.mysql.cj.jdbc.Driver/' /opt/bigtop-manager-server/conf/application.yml" -docker exec bigtop-manager-server bash -c "sed -i 's/postgresql/mysql/' /opt/bigtop-manager-server/conf/application.yml" -docker exec bigtop-manager-server bash -c "sed -i 's/localhost:5432/localhost:3306/' /opt/bigtop-manager-server/conf/application.yml" -docker exec bigtop-manager-server bash -c "sed -i 's/postgres/root/' /opt/bigtop-manager-server/conf/application.yml" - -docker exec bigtop-manager-server bash -c "sed -i 's/host: localhost/host: $BIGTOP_MANAGER_SERVER_IP/' /opt/bigtop-manager-agent/conf/application.yml" -docker exec bigtop-manager-agent-01 bash -c "sed -i 's/host: localhost/host: $BIGTOP_MANAGER_SERVER_IP/' /opt/bigtop-manager-agent/conf/application.yml" -docker exec bigtop-manager-agent-02 bash -c "sed -i 's/host: localhost/host: $BIGTOP_MANAGER_SERVER_IP/' /opt/bigtop-manager-agent/conf/application.yml" - -docker exec bigtop-manager-server bash -c "mysql -uroot -proot -Dbigtop_manager < /opt/bigtop-manager-server/ddl/MySQL-DDL-CREATE.sql" -docker exec bigtop-manager-server bash -c "nohup /bin/bash /opt/bigtop-manager-server/bin/start.sh --debug > /dev/null 2>&1 &" -docker exec bigtop-manager-server bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh --debug > /dev/null 2>&1 &" -docker exec bigtop-manager-agent-01 bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-agent-02 bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" - -echo -e "\033[32mPrint Bigtop-Manager Server RSA Private Key\033[0m" -docker exec bigtop-manager-server bash -c "cat ~/.ssh/id_rsa" - -# MySQL HOST: bigtop-manager-server -# MySQL PORT: 3306 -# DATABASE NAME: bigtop_manager -# DATABASE USER NAME: root -# DATABASE PASSWORD: root - diff --git a/dev-support/docker/rocky8/build-image.sh b/dev-support/docker/rocky8/build-image.sh deleted file mode 100755 index 7725364cd..000000000 --- a/dev-support/docker/rocky8/build-image.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/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 -# -# https://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. -# - -BIN_DIR=$(dirname $0) -cd $BIN_DIR -echo $PWD - -echo -e "\033[32mRemoving image bigtop-manager:trunk-rocky-8\033[0m" -docker rmi bigtop-manager/develop:trunk-rocky-8 - -echo -e "\033[32mBuilding image bigtop-manager:trunk-rocky-8\033[0m" -docker build -t bigtop-manager/develop:trunk-rocky-8 . diff --git a/dev-support/docker/rocky8/clear-containers.sh b/dev-support/docker/rocky8/clear-containers.sh deleted file mode 100755 index 86b6ae249..000000000 --- a/dev-support/docker/rocky8/clear-containers.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/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 -# -# https://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. -# - -if docker ps -a | grep -q 'bigtop-manager-build-r8'; then - echo -e "\033[32mStopping container bigtop-manager-build-r8 and maven process\033[0m" - if [ `docker inspect --format '{{.State.Running}}' bigtop-manager-build-r8` == true ];then - docker exec bigtop-manager-build-r8 bash -c "pkill -KILL -f maven" - docker stop bigtop-manager-build-r8 - fi -fi - -echo -e "\033[32mRemoving container bigtop-manager-server\033[0m" -docker rm -f bigtop-manager-server - -echo -e "\033[32mRemoving container bigtop-manager-agent-01\033[0m" -docker rm -f bigtop-manager-agent-01 - -echo -e "\033[32mRemoving container bigtop-manager-agent-02\033[0m" -docker rm -f bigtop-manager-agent-02 - -echo -e "\033[32mRemoving network bigtop-manager\033[0m" -docker network rm bigtop-manager \ No newline at end of file diff --git a/dev-support/docker/rocky8/distribute-scripts.sh b/dev-support/docker/rocky8/distribute-scripts.sh deleted file mode 100755 index e35c10534..000000000 --- a/dev-support/docker/rocky8/distribute-scripts.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/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 -# -# https://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. -# - -echo -e "\033[32mSynchronizing script to bigtop-manager-server\033[0m" -docker cp ../../../bigtop-manager-server/src/main/resources/stacks/ bigtop-manager-server:/opt/bigtop-manager-server/ - -docker exec bigtop-manager-server bash -c "ps -ef | grep 'org.apache.bigtop.manager.server.ServerApplication' | grep -v 'grep' | awk '{print $2}' | xargs kill" -docker exec bigtop-manager-server bash -c "ps -ef | grep 'org.apache.bigtop.manager.agent.AgentApplication' | grep -v 'grep' | awk '{print $2}' | xargs kill" -docker exec bigtop-manager-agent-01 bash -c "ps -ef | grep 'org.apache.bigtop.manager.agent.AgentApplication' | grep -v 'grep' | awk '{print $2}' | xargs kill" -docker exec bigtop-manager-agent-02 bash -c "ps -ef | grep 'org.apache.bigtop.manager.agent.AgentApplication' | grep -v 'grep' | awk '{print $2}' | xargs kill" - -docker exec bigtop-manager-server bash -c "nohup /bin/bash /opt/bigtop-manager-server/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-server bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-agent-01 bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-agent-02 bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" - -echo -e "\033[32mDone!\033[0m" \ No newline at end of file diff --git a/dev-support/docker/rocky8/restart-containers.sh b/dev-support/docker/rocky8/restart-containers.sh deleted file mode 100755 index 7e0a49784..000000000 --- a/dev-support/docker/rocky8/restart-containers.sh +++ /dev/null @@ -1,43 +0,0 @@ -# -# 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 -# -# https://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. -# - -echo -e "\033[32mRestarting containers\033[0m" -docker restart bigtop-manager-server -docker restart bigtop-manager-agent-01 -docker restart bigtop-manager-agent-02 - -echo -e "\033[32mRe-enabling systemctl servers\033[0m" -docker exec bigtop-manager-server bash -c "systemctl start mariadb" -docker exec bigtop-manager-server bash -c "systemctl start sshd" -docker exec bigtop-manager-server bash -c "systemctl start chronyd" -docker exec bigtop-manager-agent-01 bash -c "systemctl start sshd" -docker exec bigtop-manager-agent-01 bash -c "systemctl start chronyd" -docker exec bigtop-manager-agent-02 bash -c "systemctl start sshd" -docker exec bigtop-manager-agent-02 bash -c "systemctl start chronyd" - -echo -e "\033[32mSynchronize Chrony\033[0m" -docker exec bigtop-manager-server bash -c "chronyc tracking" -docker exec bigtop-manager-agent-01 bash -c "chronyc tracking" -docker exec bigtop-manager-agent-02 bash -c "chronyc tracking" - -echo -e "\033[32mRestarting bigtop-manager servers\033[0m" -docker exec bigtop-manager-server bash -c "nohup /bin/bash /opt/bigtop-manager-server/bin/start.sh --debug > /dev/null 2>&1 &" -docker exec bigtop-manager-server bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-agent-01 bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" -docker exec bigtop-manager-agent-02 bash -c "nohup /bin/bash /opt/bigtop-manager-agent/bin/start.sh > /dev/null 2>&1 &" diff --git a/dev-support/example/bigtop_manager/user.sql b/dev-support/example/bigtop_manager/user.sql deleted file mode 100644 index 9786777df..000000000 --- a/dev-support/example/bigtop_manager/user.sql +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 - * - * https://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. - */ - -INSERT INTO bigtop_manager.user (id, create_time, update_time, nickname, password, status, username)VALUES (1, now(), now(), 'Administrator', '21232f297a57a5a743894a0e4a801fc3', true, 'admin'); \ No newline at end of file