Skip to content

Commit

Permalink
Merge pull request #504 from midoks/dev
Browse files Browse the repository at this point in the history
0.16.2
  • Loading branch information
midoks authored Nov 18, 2023
2 parents 29de642 + ad3f420 commit cf00bd3
Show file tree
Hide file tree
Showing 252 changed files with 10,039 additions and 810 deletions.
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,18 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
```


### 版本更新 0.16.1

* 给防盗链增加禁止空来源。
* OpenResty安装兼容。
* Debian10安装优化。
* 安装时默认监控开启。
* MySQL/MYSQL-YUM/MySQL-APT添加重置master功能。
* 支持华为欧拉系统。
* 支持rar解压。
* SSH禁止密码登陆优化。
* 防火墙支持tcp/udp模式。
* 增加mosquitto插件。
* redis负载状态读取优化。
### 版本更新 0.16.2

* keepalived插件改造,集成mysql高可用配置。
* redis(主从/集群)配置识别。
* MySQL主从同步1236错误,添加修复功能。
* MySQL二进制日志查看。
* 源码安装成功后删除解压包,节省体积。
* 网站统计-增加查询条件。
* php增加yaml扩展。
* php扩展ioncube修复。
* php-fpm增加【按需】配置。
* gitea/gogs同步功能改造。

### JSDelivr安装地址

Expand Down
5 changes: 5 additions & 0 deletions class/core/cert_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ def saveConfig(self):
return True

def createCertCron(self):

if mw.isAppleSystem():
print('在Macos上不支持创建证书自动续签任务!')
return ''

# 创建证书自动续签任务
try:
import crontab_api
Expand Down
2 changes: 1 addition & 1 deletion class/core/config_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

class config_api:

__version = '0.16.1.6'
__version = '0.16.2'
__api_addr = 'data/api.json'

def __init__(self):
Expand Down
6 changes: 5 additions & 1 deletion cli.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
DIR=$(cd "$(dirname "$0")"; pwd)
MDIR=$(dirname "$DIR")

Expand Down Expand Up @@ -46,6 +46,10 @@ mw_start(){


mw_start_debug(){
if [ ! -f $DIR/logs/task.log ];then
echo '' > $DIR/logs/task.log
fi

python3 task.py >> $DIR/logs/task.log 2>&1 &
port=7200
if [ -f /www/server/mdserver-web/data/port.pl ];then
Expand Down
2 changes: 1 addition & 1 deletion plugins/gdrive/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"api_doc":"https://developers.google.com/drive/api/guides/about-sdk?hl=zh_CN",
"api_doc2":"https://developers.google.cn/drive/api/reference/rest/v3/comments/list?hl=zh-cn",
"date":"2022-06-26",
"pid":"4"
"pid":"5"
}
2 changes: 1 addition & 1 deletion plugins/gitea/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ def projectScriptSelf_Run():
self_path = custom_hooks + '/self/' + file
self_logs_path = custom_hooks + '/self_logs/' + file + '.log'

shell = "sh -x " + self_path + " 2>" + self_logs_path
shell = "sh -x " + self_path + " 2>" + self_logs_path + ' &'
mw.execShell(shell)
mw.execShell("chown -R www:www " + self_logs_path)
return mw.returnJson(True, '执行成功!')
Expand Down
2 changes: 1 addition & 1 deletion plugins/gogs/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ def projectScriptSelf_Run():
self_path = custom_hooks + '/self/' + file
self_logs_path = custom_hooks + '/self_logs/' + file + '.log'

shell = "sh -x " + self_path + " 2>" + self_logs_path
shell = "sh -x " + self_path + " 2>" + self_logs_path + ' &'
mw.execShell(shell)
return mw.returnJson(True, '执行成功!')

Expand Down
8 changes: 5 additions & 3 deletions plugins/haproxy/conf/haproxy.conf
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
global
daemon
#一般情况下,可关闭
log 127.0.0.1 local0
pidfile /tmp/haproxy.pid
maxconn 4000
user haproxy
group haproxy


defaults
mode http
log global
Expand All @@ -20,6 +20,7 @@ listen stats
mode http
bind *:10800
stats enable
stats refresh 10
stats uri /haproxy
stats realm Haproxy\ Statistics
stats auth admin:admin
Expand All @@ -28,10 +29,11 @@ frontend http-in
bind *:1080
default_backend servers
option forwardfor
option httpclose
#option httpclose
option http-keep-alive

backend servers
balance roundrobin
server web1 0.0.0.0:9090 check
server web1 0.0.0.0:9090 check inter 2000 rise 2 fall 5


26 changes: 11 additions & 15 deletions plugins/haproxy/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def contentReplace(content):
service_path = mw.getServerDir()
content = content.replace('{$ROOT_PATH}', mw.getRootDir())
content = content.replace('{$SERVER_PATH}', service_path)
content = content.replace('{$HA_USER}', mw.getRandomString(8))
content = content.replace('{$HA_PWD}', mw.getRandomString(10))
content = content.replace('{$SERVER_APP}', service_path + '/haproxy')
return content

Expand Down Expand Up @@ -150,6 +152,13 @@ def initDreplace():
def haOp(method):
file = initDreplace()

# check config
sdir = getServerDir()
cmd_check = sdir+'/sbin/haproxy -c -f ' + sdir + '/haproxy.conf'
chk_data = mw.execShell(cmd_check)
if chk_data[1]!= '':
return chk_data[1]

if not mw.isAppleSystem():
data = mw.execShell('systemctl ' + method + ' haproxy')
if data[1] == '':
Expand Down Expand Up @@ -206,19 +215,8 @@ def initdUinstall():


def runLog():
path = getConf()
content = mw.readFile(path)
rep = 'log\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0]


def getPort():
path = getConf()
content = mw.readFile(path)
rep = 'listen\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0]
path = getServerDir() + "/haproxy.log"
return path


if __name__ == "__main__":
Expand Down Expand Up @@ -247,7 +245,5 @@ def getPort():
print(readConfigTpl())
elif func == 'run_log':
print(runLog())
elif func == 'query_log':
print(queryLog())
else:
print('error')
8 changes: 5 additions & 3 deletions plugins/haproxy/install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

# for mac
export PATH=$PATH:/opt/homebrew/bin

curPath=`pwd`
rootPath=$(dirname "$curPath")
Expand All @@ -23,12 +25,12 @@ else
fi

if [ "${2}" == "" ];then
echo '缺少安装脚本...' > $install_tmp
echo '缺少安装脚本...'
exit 0
fi

if [ ! -d $curPath/versions/$2 ];then
echo '缺少安装脚本2...' > $install_tmp
echo '缺少安装脚本2...'
exit 0
fi

Expand Down
2 changes: 1 addition & 1 deletion plugins/haproxy/js/haproxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function spPostMin(method, args, callback){

$.post('/plugins/run', req_data, function(data) {
if (!data.status){
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
layer.msg(data.msg,{icon:0,time:10000,shade: [0.3, '#000']});
return;
}

Expand Down
37 changes: 37 additions & 0 deletions plugins/haproxy/tpl/default.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
global
daemon
pidfile /tmp/haproxy.pid
maxconn 4000
user haproxy
group haproxy


defaults
mode http
log global
option httplog
timeout connect 10s
timeout client 15s
timeout server 15s


listen stats
mode http
bind *:10800
stats enable
stats refresh 10
stats uri /haproxy
stats realm Haproxy\ Statistics
stats auth {$HA_USER}:{$HA_PWD}

frontend http-in
bind *:1080
default_backend servers
option forwardfor
option http-keep-alive

backend servers
balance roundrobin
server web1 0.0.0.0:9090 check inter 2000 rise 2 fall 5


43 changes: 39 additions & 4 deletions plugins/haproxy/versions/2.6/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,26 @@ VERSION=2.6.4
MIN_VERSION=2.6
Install_App()
{

echo '正在安装脚本文件...' > $install_tmp
echo '正在安装Haproxy软件...'
mkdir -p $serverPath/haproxy

APP_DIR=${serverPath}/source/haproxy
mkdir -p $APP_DIR


LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
LOCAL_ADDR=cn
fi


if [ "${LOCAL_ADDR}" == "cn" ];then
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
wget -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://dl.midoks.me/soft/haproxy/haproxy-${VERSION}.tar.gz
fi
fi


if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
if [ $sysName == 'Darwin' ]; then
Expand All @@ -49,7 +63,28 @@ Install_App()
fi

echo $MIN_VERSION > $serverPath/haproxy/version.pl
echo 'Install_HA' > $install_tmp
echo '安装Haproxy成功' > $install_tmp

#Haproxy日志配置
if [ -f /etc/rsyslog.conf ];then
find_ha=`cat /etc/rsyslog.conf | grep haproxy`
if [ "$find_ha" != "" ];then
echo $find_ha
else
echo "---------------------------------------------"
echo "" > ${serverPath}/haproxy/haproxy.log
echo "local0.* ${serverPath}/haproxy/haproxy.log" >> /etc/rsyslog.conf
systemctl restart syslog
echo "syslog默认的haproxy配置"
echo "local0.* ${serverPath}/haproxy/haproxy.log >> /etc/rsyslog.conf"
echo "---------------------------------------------"
fi
fi

#删除解压源码
if [ -d ${APP_DIR}/haproxy-${VERSION} ];then
rm -rf ${APP_DIR}/haproxy-${VERSION}
fi
}

Uninstall_App()
Expand All @@ -59,7 +94,7 @@ Uninstall_App()
fi

rm -rf $serverPath/haproxy
echo "Uninstall_HA" > $install_tmp
echo "卸载Haproxy成功"
}

action=$1
Expand Down
55 changes: 0 additions & 55 deletions plugins/keepalived/config/keepalived.backup.conf

This file was deleted.

Loading

0 comments on commit cf00bd3

Please sign in to comment.