diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/OSType.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/OSType.java index 4ac4b8ee..521f081e 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/OSType.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/enums/OSType.java @@ -35,5 +35,7 @@ public enum OSType { DEBIAN11, FEDORA36, + + OPENEULER22, ; } diff --git a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/os/OSDetection.java b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/os/OSDetection.java index df29c860..e5b50bd1 100644 --- a/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/os/OSDetection.java +++ b/bigtop-manager-common/src/main/java/org/apache/bigtop/manager/common/utils/os/OSDetection.java @@ -55,7 +55,7 @@ public class OSDetection { public static String getOS() { if (SystemUtils.IS_OS_LINUX) { - String os = getOSType().toLowerCase() + getOSVersion().toLowerCase(); + String os = getOSType() + getOSVersion().toLowerCase(); ifSupportedOS(os); return os; } else { @@ -102,7 +102,7 @@ public static long totalDisk() { private static String getOSType() { String output = getOSRelease(); - String osType = regexOS(ID_PATTERN, output); + String osType = regexOS(ID_PATTERN, output).toLowerCase(); log.debug("osType: {}", osType); return osType; diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/JobDao.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/JobDao.java index 82efe16a..d8474894 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/JobDao.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/repository/JobDao.java @@ -23,6 +23,7 @@ import org.apache.ibatis.annotations.Param; +import java.util.Collection; import java.util.List; import java.util.Optional; @@ -30,6 +31,8 @@ public interface JobDao extends BaseDao { List findAllByClusterId(@Param("clusterId") Long clusterId); + List findAllByIdsJoin(@Param("ids") Collection ids); + Optional findByIdJoin(@Param("id") Long id); List findAllByClusterIsNull(); diff --git a/bigtop-manager-dao/src/main/resources/mapper/mysql/HostComponentMapper.xml b/bigtop-manager-dao/src/main/resources/mapper/mysql/HostComponentMapper.xml index 51060006..900397c0 100644 --- a/bigtop-manager-dao/src/main/resources/mapper/mysql/HostComponentMapper.xml +++ b/bigtop-manager-dao/src/main/resources/mapper/mysql/HostComponentMapper.xml @@ -115,7 +115,7 @@ - , c.component_name + , c.component_name, h.hostname from host_component hc inner join (select * from host @@ -134,7 +134,7 @@ on hc.host_id = h.id inner join (select * from component - + component_name = #{componentName} diff --git a/bigtop-manager-dao/src/main/resources/mapper/mysql/JobMapper.xml b/bigtop-manager-dao/src/main/resources/mapper/mysql/JobMapper.xml index 6efb75bc..7805bba8 100644 --- a/bigtop-manager-dao/src/main/resources/mapper/mysql/JobMapper.xml +++ b/bigtop-manager-dao/src/main/resources/mapper/mysql/JobMapper.xml @@ -73,7 +73,7 @@ - select @@ -83,8 +83,11 @@ from (select * from job - - cluster_id = #{clusterId} + + id in + + #{id} + ) h @@ -92,6 +95,7 @@ on h.id = st.job_id inner join task tk on tk.job_id = h.id and st.id = tk.stage_id + order by h.id desc + + \ No newline at end of file diff --git a/bigtop-manager-dao/src/main/resources/mapper/mysql/RepoMapper.xml b/bigtop-manager-dao/src/main/resources/mapper/mysql/RepoMapper.xml index b51ab044..cee5e868 100644 --- a/bigtop-manager-dao/src/main/resources/mapper/mysql/RepoMapper.xml +++ b/bigtop-manager-dao/src/main/resources/mapper/mysql/RepoMapper.xml @@ -24,7 +24,7 @@ - id, base_url, os, arch, repo_id, repo_name, cluster_id + id, base_url, os, arch, repo_id, repo_name, repo_type, cluster_id - insert into repo (base_url, os, arch, repo_id, repo_name, cluster_id, create_by, update_by, create_time, update_time) + insert into repo (base_url, os, arch, repo_id, repo_name, repo_type, cluster_id, create_by, update_by, create_time, update_time) values - (#{cluster.baseUrl},#{cluster.os},#{cluster.arch},#{cluster.repoId},#{cluster.repoName},#{cluster.clusterId},#{cluster.createBy},#{cluster.updateBy},#{cluster.createTime},#{cluster.updateTime}) + (#{cluster.baseUrl},#{cluster.os},#{cluster.arch},#{cluster.repoId},#{cluster.repoName},#{cluster.repoType},#{cluster.clusterId},#{cluster.createBy},#{cluster.updateBy},#{cluster.createTime},#{cluster.updateTime}) diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/JobServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/JobServiceImpl.java index 820eab30..b6a30a3c 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/JobServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/JobServiceImpl.java @@ -79,6 +79,9 @@ public PageVO list(Long clusterId) { jobPOList = jobDao.findAllByClusterId(clusterId); } PageInfo pageInfo = new PageInfo<>(jobPOList); + List allByIdsJoin = + jobDao.findAllByIdsJoin(jobPOList.stream().map(JobPO::getId).toList()); + pageInfo.setList(allByIdsJoin); return PageVO.of(pageInfo); } diff --git a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/metainfo.xml b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/metainfo.xml index 53a82c37..810a82c2 100644 --- a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/metainfo.xml +++ b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/metainfo.xml @@ -48,6 +48,14 @@ gpgcheck=0 x86_64 http://123.56.2.244/bigtop/3.3.0/rocky8/x86_64/ + + Bigtop-3.3.0 + Bigtop-3.3.0 for openEuler-22.03 x86_64 + binary + openeuler22 + x86_64 + http://123.56.2.244/bigtop/3.3.0/openeuler22/x86_64/ + \ No newline at end of file diff --git a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/flink/metainfo.xml b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/flink/metainfo.xml index c62639a8..ba3ef91f 100644 --- a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/flink/metainfo.xml +++ b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/flink/metainfo.xml @@ -63,6 +63,7 @@ centos7 rocky8 + openeuler22 x86_64 diff --git a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/hdfs/metainfo.xml b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/hdfs/metainfo.xml index 5878f17f..830a9a52 100644 --- a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/hdfs/metainfo.xml +++ b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/hdfs/metainfo.xml @@ -103,6 +103,7 @@ centos7 rocky8 + openeuler22 x86_64 diff --git a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/kafka/metainfo.xml b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/kafka/metainfo.xml index a31f99c3..4722ea7a 100644 --- a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/kafka/metainfo.xml +++ b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/kafka/metainfo.xml @@ -59,6 +59,7 @@ centos7 rocky8 + openeuler22 x86_64 diff --git a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/mapred/metainfo.xml b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/mapred/metainfo.xml index 4ece698e..c920e2c6 100644 --- a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/mapred/metainfo.xml +++ b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/mapred/metainfo.xml @@ -63,6 +63,7 @@ centos7 rocky8 + openeuler22 x86_64 diff --git a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/metainfo.xml b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/metainfo.xml index 753f5cf7..506669c0 100644 --- a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/metainfo.xml +++ b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/metainfo.xml @@ -53,6 +53,7 @@ centos7 rocky8 + openeuler22 x86_64 diff --git a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/tez/metainfo.xml b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/tez/metainfo.xml index 59aacf0e..7ce3bbd8 100644 --- a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/tez/metainfo.xml +++ b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/tez/metainfo.xml @@ -45,6 +45,7 @@ centos7 rocky8 + openeuler22 x86_64 diff --git a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/yarn/metainfo.xml b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/yarn/metainfo.xml index 6ccd7477..f725d49c 100644 --- a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/yarn/metainfo.xml +++ b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/yarn/metainfo.xml @@ -92,6 +92,7 @@ centos7 rocky8 + openeuler22 x86_64 diff --git a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/zookeeper/metainfo.xml b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/zookeeper/metainfo.xml index df686c0f..52115a5e 100644 --- a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/zookeeper/metainfo.xml +++ b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/zookeeper/metainfo.xml @@ -59,6 +59,7 @@ centos7 rocky8 + openeuler22 x86_64 diff --git a/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/prometheus/metainfo.xml b/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/prometheus/metainfo.xml index 92b2fdd5..97cc63e6 100644 --- a/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/prometheus/metainfo.xml +++ b/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/prometheus/metainfo.xml @@ -49,6 +49,7 @@ centos7 rocky8 + openeuler22 x86_64 diff --git a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsParams.java b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsParams.java index d33865af..b8fb1217 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsParams.java +++ b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/hdfs/HdfsParams.java @@ -85,7 +85,8 @@ public Map coreSite() { Map coreSite = LocalSettings.configurations(serviceName(), "core-site"); List namenodeList = LocalSettings.hosts("namenode"); if (!namenodeList.isEmpty()) { - coreSite.put("fs.defaultFS", MessageFormat.format("hdfs://{0}:8020", namenodeList.get(0))); + coreSite.put( + "fs.defaultFS", ((String) coreSite.get("fs.defaultFS")).replace("localhost", namenodeList.get(0))); } return coreSite; } @@ -98,6 +99,18 @@ public Map hadoopPolicy() { @GlobalParams public Map hdfsSite() { Map hdfsSite = LocalSettings.configurations(serviceName(), "hdfs-site"); + List namenodeList = LocalSettings.hosts("namenode"); + if (!namenodeList.isEmpty()) { + hdfsSite.put( + "dfs.namenode.rpc-address", + ((String) hdfsSite.get("dfs.namenode.rpc-address")).replace("0.0.0.0", namenodeList.get(0))); + hdfsSite.put( + "dfs.datanode.https.address", + ((String) hdfsSite.get("dfs.datanode.https.address")).replace("0.0.0.0", namenodeList.get(0))); + hdfsSite.put( + "dfs.namenode.https-address", + ((String) hdfsSite.get("dfs.namenode.https-address")).replace("0.0.0.0", namenodeList.get(0))); + } dfsDataDir = (String) hdfsSite.get("dfs.datanode.data.dir"); dfsNameNodeDir = (String) hdfsSite.get("dfs.namenode.name.dir"); diff --git a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/PackageManagerType.java b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/PackageManagerType.java index f42af79b..78892eec 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/PackageManagerType.java +++ b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/spi/repo/PackageManagerType.java @@ -28,6 +28,7 @@ import static org.apache.bigtop.manager.common.enums.OSType.DEBIAN10; import static org.apache.bigtop.manager.common.enums.OSType.DEBIAN11; import static org.apache.bigtop.manager.common.enums.OSType.FEDORA36; +import static org.apache.bigtop.manager.common.enums.OSType.OPENEULER22; import static org.apache.bigtop.manager.common.enums.OSType.ROCKY8; import static org.apache.bigtop.manager.common.enums.OSType.UBUNTU20; import static org.apache.bigtop.manager.common.enums.OSType.UBUNTU22; @@ -36,7 +37,7 @@ public enum PackageManagerType { YUM(List.of(CENTOS7)), - DNF(List.of(ROCKY8, FEDORA36)), + DNF(List.of(ROCKY8, FEDORA36, OPENEULER22)), APT(List.of(UBUNTU20, UBUNTU22, DEBIAN10, DEBIAN11)), ; diff --git a/dev-support/docker/openeuler22/Dockerfile b/dev-support/docker/openeuler22/Dockerfile new file mode 100644 index 00000000..631f5eab --- /dev/null +++ b/dev-support/docker/openeuler22/Dockerfile @@ -0,0 +1,33 @@ +# 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 new file mode 100755 index 00000000..23844dd1 --- /dev/null +++ b/dev-support/docker/openeuler22/build-containers.sh @@ -0,0 +1,133 @@ +#!/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 new file mode 100755 index 00000000..5694daff --- /dev/null +++ b/dev-support/docker/openeuler22/build-image.sh @@ -0,0 +1,30 @@ +#!/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 new file mode 100755 index 00000000..89629604 --- /dev/null +++ b/dev-support/docker/openeuler22/clear-containers.sh @@ -0,0 +1,40 @@ +#!/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 new file mode 100755 index 00000000..e35c1053 --- /dev/null +++ b/dev-support/docker/openeuler22/distribute-scripts.sh @@ -0,0 +1,35 @@ +#!/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 new file mode 100755 index 00000000..7e0a4978 --- /dev/null +++ b/dev-support/docker/openeuler22/restart-containers.sh @@ -0,0 +1,43 @@ +# +# 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 &"