Skip to content

Commit a957bba

Browse files
author
caoguowei
committed
初始化
1 parent 6656788 commit a957bba

File tree

380 files changed

+55744
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

380 files changed

+55744
-2
lines changed

.gitignore

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Compiled class file
2+
*.class
3+
4+
# Log file
5+
*.log
6+
7+
# BlueJ files
8+
*.ctxt
9+
10+
# Mobile Tools for Java (J2ME)
11+
.mtj.tmp/
12+
13+
# Package Files #
14+
*.jar
15+
*.war
16+
*.nar
17+
*.ear
18+
*.zip
19+
*.tar.gz
20+
*.rar
21+
22+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23+
hs_err_pid*
24+
/dhorse-api/.classpath
25+
/dhorse-api/.project
26+
/dhorse-api/.settings
27+
/dhorse-api/target
28+
/dhorse-application/.classpath
29+
/dhorse-application/.project
30+
/dhorse-application/.settings
31+
/dhorse-application/target
32+
/dhorse-infrastructure/.classpath
33+
/dhorse-infrastructure/.project
34+
/dhorse-infrastructure/.settings
35+
/dhorse-infrastructure/target
36+
/dhorse-rest/.classpath
37+
/dhorse-rest/.project
38+
/dhorse-rest/.settings
39+
/dhorse-rest/target
40+
/dhorse-web/.classpath
41+
/dhorse-web/.project
42+
/dhorse-web/.settings
43+
/dhorse-web/target
44+
/dhorse-script/.classpath
45+
/dhorse-script/.project
46+
/dhorse-script/.settings
47+
/dhorse-script/target
48+
/target
49+
/data
50+
/log

NOTICE

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
DHorse
3+
Copyright 2021-2022 The Apache Software Foundation
4+
5+
This product includes software developed at Github
6+
(https://github.com/tiandizhiguai/dhorse).
7+
8+
This product uses the following Project:
9+
10+
Springboot、Mybatis、Mybatis-plus、Maven-core、Jib-core、Layuimini、Smart-doc、H2、Mysql

README.md

+70-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,70 @@
1-
# dhorse
2-
一个简单易用的DevOps开发平台
1+
# DHorse项目
2+
DHorse是一个简单易用的DevOps开发平台,主要特点:部署简单、功能快速、操作简洁。
3+
4+
## 架构
5+
![Image text](./static/images/architecture.jpg)
6+
7+
## 主要特性
8+
* 简洁的操作界面
9+
* 支持Springboot项目部署
10+
* 无需安装Maven即可打包
11+
* 无需安装Docker即可构建镜像
12+
* 支持日志收集
13+
* 支持多环境部署
14+
15+
## 主要技术
16+
Springboot、Mybatis、Mybatis-plus、Maven-core、Jib-core、Layuimini、Smart-doc、H2、Mysql等。
17+
18+
## 快速开始
19+
首先需要安装大于等于Java11的环境。
20+
21+
下载安装文件:[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),然后解压:
22+
23+
```bash
24+
$ tar -xzf dhorse-*.tar.gz
25+
```
26+
27+
进入解压目录并查看文件内容:
28+
29+
```bash
30+
$ cd dhorse-* && ls -l
31+
```
32+
33+
文件内容如下:
34+
35+
```bash
36+
total 24
37+
drwxr-xr-x 2 root root 115 Oct 6 19:56 bin
38+
drwxr-xr-x 2 root root 48 Oct 6 19:56 conf
39+
drwxr-xr-x 3 root root 46 Oct 6 19:56 lib
40+
-rw-r--r-- 1 root root 11558 Dec 10 2021 LICENSE
41+
-rw-r--r-- 1 root root 5141 Dec 26 2021 NOTICE
42+
-rw-r--r-- 1 root root 1337 Jan 21 2022 README.txt
43+
drwxr-xr-x 8 root root 93 Sep 23 16:09 static
44+
```
45+
46+
启动服务:
47+
48+
```bash
49+
$ bin/dhorse-start.sh
50+
```
51+
52+
在浏览器里访问地址:`http://127.0.0.1:8100`,并在出现的登录页面中输入账号:admin,密码:admin后,页面如下:
53+
54+
![Image text](./static/images/home.jpg)
55+
56+
最后,关闭服务:
57+
58+
```bash
59+
$ bin/dhorse-stop.sh
60+
```
61+
62+
## 开源许可
63+
64+
本软件遵守Apache开源许可协议2.0,详情《 [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)》。
65+
66+
## 社区交流
67+
68+
如果想了解更多内容,请加如下微信(邀请进群),感谢您的使用。
69+
70+
<img src="./static/images/weixin.jpg" align='left'/>

README.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
本软件遵守Apache开源许可协议2.0,
2+
详情见:http://www.apache.org/licenses/LICENSE-2.0

bin/unix/dhorse-start.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
# 本软件遵守Apache开源许可协议2.0,
4+
# 详情见:http://www.apache.org/licenses/LICENSE-2.0
5+
#
6+
# ---------------------------------------------------------------------------
7+
# Start script for the DHorse Server
8+
# ---------------------------------------------------------------------------
9+
10+
bin=`dirname "$0"`
11+
bin=`cd "$bin"; pwd`
12+
13+
. "$bin"/server.sh start

bin/unix/dhorse-stop.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
# 本软件遵守Apache开源许可协议2.0,
4+
# 详情见:http://www.apache.org/licenses/LICENSE-2.0
5+
#
6+
# ---------------------------------------------------------------------------
7+
# Stop script for the DHorse Server
8+
# ---------------------------------------------------------------------------
9+
10+
bin=`dirname "$0"`
11+
bin=`cd "$bin"; pwd`
12+
13+
. "$bin"/server.sh stop

bin/unix/server.sh

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
#!/bin/sh
2+
3+
os=`uname`
4+
JAVA_HOME=$JAVA_HOME
5+
6+
APP_NAME=dhorse
7+
JAR_NAME=$APP_NAME-rest-${project.version}.jar
8+
DHORSE_HOME=`dirname "$bin"`
9+
JAR_PATH=$DHORSE_HOME/lib/$JAR_NAME
10+
CONF_PATH=$DHORSE_HOME/conf/$APP_NAME.yml
11+
12+
#jvm参数
13+
JAVA_OPTS="-server -Xms256m -Xmx256m -Xmn96m -XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=128m"
14+
15+
dhorse_banner(){
16+
echo " _ _ "
17+
echo " | | | "
18+
echo " __| | |__ ___ _ __ ___ ___ "
19+
echo " / _\` | '_ \ / _ \| '__/ __|/ _ \\"
20+
echo " | (_| | | | | (_) | | \__ \ __/"
21+
echo " \__,_|_| |_|\___/|_| |___/\___|"
22+
echo " :: DHorse :: (v${project.version})"
23+
echo " "
24+
}
25+
26+
#如果没有指定data目录,则在当前的部署目录下创建
27+
mkdir_data_path(){
28+
data_path_config=`grep 'data.path' $DHORSE_HOME/conf/dhorse.yml`
29+
if [[ ! $data_path_config =~ ^# ]]; then
30+
key_value=(${data_path_config//:/ })
31+
data_path=`echo "${key_value[1]}"`
32+
fi
33+
if test -z "$data_path"; then
34+
data_path=$DHORSE_HOME/data
35+
fi
36+
if [ ! -d "$data_path" ];then
37+
mkdir $data_path
38+
fi
39+
}
40+
41+
is_exist() {
42+
pid_number=$(ps -ef | grep $JAR_NAME | grep -v grep | awk '{print $2}')
43+
#如果不存在返回1,存在返回0
44+
if test -z "$pid_number"; then
45+
return 1
46+
else
47+
return 0
48+
fi
49+
}
50+
51+
#启动方法
52+
start() {
53+
dhorse_banner
54+
if [[ -z "$JAVA_HOME" ]]; then
55+
echo "JAVA_HOME could not be found"
56+
exit 0
57+
fi
58+
echo "Starting $APP_NAME service, please wait a moment..."
59+
is_exist
60+
if test $? -eq "0"; then
61+
echo "The $APP_NAME service is already running, pid is $pid_number"
62+
else
63+
mkdir_data_path
64+
nohup $JAVA_HOME/bin/java $JAVA_OPTS -jar $JAR_PATH --spring.config.location=$CONF_PATH >/dev/null 2>&1 &
65+
for i in {0..9}; do
66+
if [[ $os == "Darwin" ]]; then
67+
process=`lsof -a -p $! | grep $JAR_NAME | grep java`
68+
else
69+
process=`netstat -tlpn | grep $!`
70+
fi
71+
if test -z "$process"; then
72+
sleep 1
73+
else
74+
echo $! > $data_path/pid
75+
echo "Start $APP_NAME service successfully, pid is $!"
76+
exit 0
77+
fi
78+
done
79+
echo "The $APP_NAME service startup failure"
80+
fi
81+
}
82+
83+
#停止方法
84+
stop() {
85+
dhorse_banner
86+
mkdir_data_path
87+
if [ ! -f "$data_path/pid" ]; then
88+
echo "The $APP_NAME service is not running"
89+
return
90+
fi
91+
pidf=$(cat $data_path/pid)
92+
if test -z "$pidf"; then
93+
echo "The $APP_NAME service is not running"
94+
return
95+
fi
96+
echo "Stoping $APP_NAME service, pid is $pidf"
97+
kill $pidf
98+
rm -rf $data_path/pid
99+
sleep 2
100+
is_exist
101+
if test $? -eq "0"; then
102+
kill -9 $pid_number
103+
sleep 2
104+
echo "Stop $APP_NAME service successfully"
105+
else
106+
echo "Stop $APP_NAME service successfully"
107+
fi
108+
}
109+
110+
#重启
111+
restart(){
112+
stop
113+
start
114+
}
115+
116+
#输出运行状态
117+
status(){
118+
is_exist
119+
if [ $? -eq "0" ]; then
120+
echo "The $APP_NAME service is running, pid is $pid_number"
121+
else
122+
echo "The $APP_NAME service is not running"
123+
fi
124+
}
125+
126+
#根据输入参数,选择执行对应方法,不输入则执行使用说明
127+
case "$1" in
128+
"start")
129+
start
130+
;;
131+
"stop")
132+
stop
133+
;;
134+
"status")
135+
status
136+
;;
137+
"restart")
138+
restart
139+
;;
140+
*)
141+
echo "usage: [start | stop]"
142+
;;
143+
esac
144+
exit 0

bin/windows/dhorse-start.bat

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
@echo off
2+
3+
rem This software complies with Apache License 2.0,
4+
rem detail: http://www.apache.org/licenses/LICENSE-2.0
5+
rem
6+
rem
7+
rem JAVA_HOME Must point at your Java Development Kit installation.
8+
rem Required to run the with the "debug" argument.
9+
rem
10+
rem JAVA_OPTS (Optional) Java runtime options used when any command
11+
rem is executed.
12+
13+
14+
setlocal
15+
16+
set "CURRENT_DIR=%cd%"
17+
cd ..
18+
set "DHORSE_HOME=%cd%"
19+
cd "%CURRENT_DIR%"
20+
21+
if "%JAVA_HOME%" == "" (
22+
echo JAVA_HOME could not be found
23+
pause
24+
goto end
25+
)
26+
27+
set JAVA_HOME=%JAVA_HOME%
28+
29+
set JAVA_CMD=%JAVA_HOME%\bin\java
30+
31+
set JAVA_OPTS=-server -Xms256m -Xmx256m -Xmn96m -XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=128m
32+
33+
set JAR_PATH=%DHORSE_HOME%/lib/dhorse-rest-${project.version}.jar
34+
35+
set CONFIG_LOCATION=%DHORSE_HOME%/conf/dhorse.yml
36+
37+
%JAVA_CMD% %JAVA_OPTS% -Dfile.encoding=utf-8 -jar %JAR_PATH% --spring.config.location=%CONFIG_LOCATION% &
38+
39+
pause
40+
41+
:end

bin/windows/dhorse-stop.bat

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@echo off
2+
3+
rem This software complies with Apache License 2.0,
4+
rem detail: http://www.apache.org/licenses/LICENSE-2.0
5+
rem
6+
rem ---------------------------------------------------------------------------
7+
rem Stop script for the DHorse Server
8+
rem ---------------------------------------------------------------------------
9+
10+
11+
setlocal
12+
13+
for /f "tokens=1" %%a in ('jps ^| findstr dhorse') do (
14+
taskkill /f /pid %%a
15+
)
16+
17+
pause

0 commit comments

Comments
 (0)