#!/bin/bash
#menu
source ~/.bashrc
source /etc/profile
source ~/.bash_profile
date
mkdir -p /data/software
cd /data/software
echo "-------------powered by YadeaIOT---------------"
echo
echo -e '\033[0;31;1m''请选择你需要安装的软件,安装过程中请注意是否有错误,直接输入序号即可\033[0m'
echo -e '\033[0;36;1m'Please select the software you need to install. '\033[0m'
echo -e '\033[0;31;1m'Please pay attention to whether there are errors during the installation process. '\033[0m'
echo -e '\033[36;1m''非阿里云服务器建议先选择12进行服务器参数优化\033[0m'
echo
echo '############################################################'
#start
echo '###   0 JAVA'
echo "###   1 elasticsearch"
echo -e '###   \033[31;47m2 KIBANA, MUST INSTALLD ES\033[0m'
echo "###   3 kafka"
echo "###   4 MYSQL,Default password: yadea123"
echo -e "###   \033[31;47m5 nginx \033[0m"
echo "###   6 skywalking, MUST INSTALLD ES"
echo "###   7 NACOS"
echo -e "###   \033[31;47m8 redis, port:5495, password:yadea123\033[0m"
echo "###   9 PULSAR"
echo "###   10 Prometheus-client(客户端)"
echo -e "###   \033[31;47m11 Prometheus-server(服务端)、grafana\033[0m"
echo "###   12 服务器参数优化"
echo "###   13 server服务器建立目录"
echo -e "###   \033[31;47m14 安装XXL-JOB，必须先安装java\033[0m"
echo "###   15 加入jumpserver堡垒机"
echo "###   16 安装filebeat"
echo -e "###   \033[31;47m17 一键安装新增服务所需的全部环境\033[0m"
echo "###   18 安装ossutil64"
echo "###   19 exit"
echo '############################################################'
echo
echo -e "\033[0;31;1m Please enter your choise: number \033[0m "
    read input

case $input in
        0)
        echo "准备安装JAVA，请稍候..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/java.sh && sh java.sh;;
        1)
        echo "准备安装ElasticSearch,请稍候..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/elasticsearch.sh && sh elasticsearch.sh;;
        2)
        echo "准备安装kibana,安装前必须先安装ES，请稍候..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/kibana.sh && sh kibana.sh;;
        3)
        echo "准备安装KAFKA,请稍候..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/kafka.sh && sh kafka.sh;;
        4)
        echo "准备安装MYSQL,请稍候..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/mysql.sh && sh mysql.sh;;
        5)
        echo "准备安装NGINX,请稍候..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/nginx.sh && sh nginx.sh;;
        6)
        echo "准备安装skywalking,安装前必须先安装ES，请稍候..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/skywalking.sh && sh skywalking.sh;;
        7)
        echo "准备安装NACOS,请稍候..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/nacos.sh && sh nacos.sh;;
        8)
        echo "准备安装REDIS,请稍候..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/redis.sh && sh redis.sh;;
        9)
        echo "准备安装pulsar,请稍候..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/pulsar.sh && sh pulsar.sh;;
	10)
        echo "准备安装prometheus-client,请稍候..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/prometheus-client.sh && sh prometheus-client.sh;;
        11)
        echo "准备安装prometheus-server(服务端),grafana请稍候..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/prometheus-server.sh && sh prometheus-server.sh;;
        12)
        echo "服务器参数优化start,请稍候..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/serverparameter.sh && sh serverparameter.sh;;
        13)
        echo "server服务器建立目录,请稍候..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/serverfile.sh && sh serverfile.sh;;
        14)
        echo "准备安装xxl-job,请稍候..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/xxl-job.sh && sh xxl-job.sh;;
        15)
        echo "准备将本主机加入堡垒机,请稍候..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/jumpserver.sh && sh jumpserver.sh;;
        16)
        echo "准备安装filebeat,请稍候..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/filebeat.sh && sh filebeat.sh;;
        17)
        echo "一键安装新增服务所需的全部环境，请稍后..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/deploy-all.sh && sh deploy-all.sh;;
        18)
        echo "安装阿里云ossutil64，请稍后..."
        sleep 1
        curl -sO http://down.yadeaiot.net:8000/install/ossutil64.sh && sh ossutil64.sh;;
	19)
        exit;;
esac
