Skip to content

Commit

Permalink
初始化
Browse files Browse the repository at this point in the history
  • Loading branch information
caoguowei committed Oct 16, 2022
1 parent 6656788 commit a957bba
Show file tree
Hide file tree
Showing 380 changed files with 55,744 additions and 2 deletions.
50 changes: 50 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/dhorse-api/.classpath
/dhorse-api/.project
/dhorse-api/.settings
/dhorse-api/target
/dhorse-application/.classpath
/dhorse-application/.project
/dhorse-application/.settings
/dhorse-application/target
/dhorse-infrastructure/.classpath
/dhorse-infrastructure/.project
/dhorse-infrastructure/.settings
/dhorse-infrastructure/target
/dhorse-rest/.classpath
/dhorse-rest/.project
/dhorse-rest/.settings
/dhorse-rest/target
/dhorse-web/.classpath
/dhorse-web/.project
/dhorse-web/.settings
/dhorse-web/target
/dhorse-script/.classpath
/dhorse-script/.project
/dhorse-script/.settings
/dhorse-script/target
/target
/data
/log
10 changes: 10 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

DHorse
Copyright 2021-2022 The Apache Software Foundation

This product includes software developed at Github
(https://github.com/tiandizhiguai/dhorse).

This product uses the following Project:

Springboot、Mybatis、Mybatis-plus、Maven-core、Jib-core、Layuimini、Smart-doc、H2、Mysql
72 changes: 70 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,70 @@
# dhorse
一个简单易用的DevOps开发平台
# DHorse项目
DHorse是一个简单易用的DevOps开发平台,主要特点:部署简单、功能快速、操作简洁。

## 架构
![Image text](./static/images/architecture.jpg)

## 主要特性
* 简洁的操作界面
* 支持Springboot项目部署
* 无需安装Maven即可打包
* 无需安装Docker即可构建镜像
* 支持日志收集
* 支持多环境部署

## 主要技术
Springboot、Mybatis、Mybatis-plus、Maven-core、Jib-core、Layuimini、Smart-doc、H2、Mysql等。

## 快速开始
首先需要安装大于等于Java11的环境。

下载安装文件:[Linux、Mac和Cygwin](https://gitee.com/tiandizhiguai/release2/raw/master/dhorse-1.0.2-x64_bin.tar.gz)[Windows](https://gitee.com/tiandizhiguai/release2/raw/master/dhorse-1.0.2-x64_bin.tar.gz),然后解压:

```bash
$ tar -xzf dhorse-*.tar.gz
```

进入解压目录并查看文件内容:

```bash
$ cd dhorse-* && ls -l
```

文件内容如下:

```bash
total 24
drwxr-xr-x 2 root root 115 Oct 6 19:56 bin
drwxr-xr-x 2 root root 48 Oct 6 19:56 conf
drwxr-xr-x 3 root root 46 Oct 6 19:56 lib
-rw-r--r-- 1 root root 11558 Dec 10 2021 LICENSE
-rw-r--r-- 1 root root 5141 Dec 26 2021 NOTICE
-rw-r--r-- 1 root root 1337 Jan 21 2022 README.txt
drwxr-xr-x 8 root root 93 Sep 23 16:09 static
```

启动服务:

```bash
$ bin/dhorse-start.sh
```

在浏览器里访问地址:`http://127.0.0.1:8100`,并在出现的登录页面中输入账号:admin,密码:admin后,页面如下:

![Image text](./static/images/home.jpg)

最后,关闭服务:

```bash
$ bin/dhorse-stop.sh
```

## 开源许可

本软件遵守Apache开源许可协议2.0,详情《 [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)》。

## 社区交流

如果想了解更多内容,请加如下微信(邀请进群),感谢您的使用。

<img src="./static/images/weixin.jpg" align='left'/>
2 changes: 2 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
本软件遵守Apache开源许可协议2.0,
详情见:http://www.apache.org/licenses/LICENSE-2.0
13 changes: 13 additions & 0 deletions bin/unix/dhorse-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# 本软件遵守Apache开源许可协议2.0,
# 详情见:http://www.apache.org/licenses/LICENSE-2.0
#
# ---------------------------------------------------------------------------
# Start script for the DHorse Server
# ---------------------------------------------------------------------------

bin=`dirname "$0"`
bin=`cd "$bin"; pwd`

. "$bin"/server.sh start
13 changes: 13 additions & 0 deletions bin/unix/dhorse-stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# 本软件遵守Apache开源许可协议2.0,
# 详情见:http://www.apache.org/licenses/LICENSE-2.0
#
# ---------------------------------------------------------------------------
# Stop script for the DHorse Server
# ---------------------------------------------------------------------------

bin=`dirname "$0"`
bin=`cd "$bin"; pwd`

. "$bin"/server.sh stop
144 changes: 144 additions & 0 deletions bin/unix/server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#!/bin/sh

os=`uname`
JAVA_HOME=$JAVA_HOME

APP_NAME=dhorse
JAR_NAME=$APP_NAME-rest-${project.version}.jar
DHORSE_HOME=`dirname "$bin"`
JAR_PATH=$DHORSE_HOME/lib/$JAR_NAME
CONF_PATH=$DHORSE_HOME/conf/$APP_NAME.yml

#jvm参数
JAVA_OPTS="-server -Xms256m -Xmx256m -Xmn96m -XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=128m"

dhorse_banner(){
echo " _ _ "
echo " | | | "
echo " __| | |__ ___ _ __ ___ ___ "
echo " / _\` | '_ \ / _ \| '__/ __|/ _ \\"
echo " | (_| | | | | (_) | | \__ \ __/"
echo " \__,_|_| |_|\___/|_| |___/\___|"
echo " :: DHorse :: (v${project.version})"
echo " "
}

#如果没有指定data目录,则在当前的部署目录下创建
mkdir_data_path(){
data_path_config=`grep 'data.path' $DHORSE_HOME/conf/dhorse.yml`
if [[ ! $data_path_config =~ ^# ]]; then
key_value=(${data_path_config//:/ })
data_path=`echo "${key_value[1]}"`
fi
if test -z "$data_path"; then
data_path=$DHORSE_HOME/data
fi
if [ ! -d "$data_path" ];then
mkdir $data_path
fi
}

is_exist() {
pid_number=$(ps -ef | grep $JAR_NAME | grep -v grep | awk '{print $2}')
#如果不存在返回1,存在返回0
if test -z "$pid_number"; then
return 1
else
return 0
fi
}

#启动方法
start() {
dhorse_banner
if [[ -z "$JAVA_HOME" ]]; then
echo "JAVA_HOME could not be found"
exit 0
fi
echo "Starting $APP_NAME service, please wait a moment..."
is_exist
if test $? -eq "0"; then
echo "The $APP_NAME service is already running, pid is $pid_number"
else
mkdir_data_path
nohup $JAVA_HOME/bin/java $JAVA_OPTS -jar $JAR_PATH --spring.config.location=$CONF_PATH >/dev/null 2>&1 &
for i in {0..9}; do
if [[ $os == "Darwin" ]]; then
process=`lsof -a -p $! | grep $JAR_NAME | grep java`
else
process=`netstat -tlpn | grep $!`
fi
if test -z "$process"; then
sleep 1
else
echo $! > $data_path/pid
echo "Start $APP_NAME service successfully, pid is $!"
exit 0
fi
done
echo "The $APP_NAME service startup failure"
fi
}

#停止方法
stop() {
dhorse_banner
mkdir_data_path
if [ ! -f "$data_path/pid" ]; then
echo "The $APP_NAME service is not running"
return
fi
pidf=$(cat $data_path/pid)
if test -z "$pidf"; then
echo "The $APP_NAME service is not running"
return
fi
echo "Stoping $APP_NAME service, pid is $pidf"
kill $pidf
rm -rf $data_path/pid
sleep 2
is_exist
if test $? -eq "0"; then
kill -9 $pid_number
sleep 2
echo "Stop $APP_NAME service successfully"
else
echo "Stop $APP_NAME service successfully"
fi
}

#重启
restart(){
stop
start
}

#输出运行状态
status(){
is_exist
if [ $? -eq "0" ]; then
echo "The $APP_NAME service is running, pid is $pid_number"
else
echo "The $APP_NAME service is not running"
fi
}

#根据输入参数,选择执行对应方法,不输入则执行使用说明
case "$1" in
"start")
start
;;
"stop")
stop
;;
"status")
status
;;
"restart")
restart
;;
*)
echo "usage: [start | stop]"
;;
esac
exit 0
41 changes: 41 additions & 0 deletions bin/windows/dhorse-start.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@echo off

rem This software complies with Apache License 2.0,
rem detail: http://www.apache.org/licenses/LICENSE-2.0
rem
rem
rem JAVA_HOME Must point at your Java Development Kit installation.
rem Required to run the with the "debug" argument.
rem
rem JAVA_OPTS (Optional) Java runtime options used when any command
rem is executed.


setlocal

set "CURRENT_DIR=%cd%"
cd ..
set "DHORSE_HOME=%cd%"
cd "%CURRENT_DIR%"

if "%JAVA_HOME%" == "" (
echo JAVA_HOME could not be found
pause
goto end
)

set JAVA_HOME=%JAVA_HOME%

set JAVA_CMD=%JAVA_HOME%\bin\java

set JAVA_OPTS=-server -Xms256m -Xmx256m -Xmn96m -XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=128m

set JAR_PATH=%DHORSE_HOME%/lib/dhorse-rest-${project.version}.jar

set CONFIG_LOCATION=%DHORSE_HOME%/conf/dhorse.yml

%JAVA_CMD% %JAVA_OPTS% -Dfile.encoding=utf-8 -jar %JAR_PATH% --spring.config.location=%CONFIG_LOCATION% &

pause

:end
17 changes: 17 additions & 0 deletions bin/windows/dhorse-stop.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@echo off

rem This software complies with Apache License 2.0,
rem detail: http://www.apache.org/licenses/LICENSE-2.0
rem
rem ---------------------------------------------------------------------------
rem Stop script for the DHorse Server
rem ---------------------------------------------------------------------------


setlocal

for /f "tokens=1" %%a in ('jps ^| findstr dhorse') do (
taskkill /f /pid %%a
)

pause
Loading

0 comments on commit a957bba

Please sign in to comment.