mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 01:29:26 +08:00
@@ -0,0 +1,30 @@
|
||||
---
|
||||
name: BUG提交
|
||||
about: 问题描述
|
||||
---
|
||||
|
||||
## 什么系统 ?
|
||||
|
||||
Debian x, Centos x, Centos x stream, Ubuntu x?
|
||||
|
||||
## 错误信息 ?
|
||||
|
||||
Ex:
|
||||
```bash
|
||||
................start mw success
|
||||
bash: line 149: ./scripts/init.d/mw: No such file or directory
|
||||
```
|
||||
|
||||
## 错误截图 ?
|
||||
|
||||
...
|
||||
|
||||
|
||||
## 浏览器版本 ?
|
||||
|
||||
...
|
||||
|
||||
|
||||
## 软件版本(插件/面板) ?
|
||||
|
||||
...
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
name: 需求提交
|
||||
about: 需求描述
|
||||
---
|
||||
|
||||
## 需求
|
||||
|
||||
想开发一个什么插件?
|
||||
想有什么功能?
|
||||
|
||||
|
||||
## 提供参考
|
||||
|
||||
给开发者提供参考!
|
||||
@@ -1,13 +1,13 @@
|
||||
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
||||
|
||||
name: MW APP
|
||||
name: MW APP MySQL80
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches: [ "master","dev" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
branches: [ "master","dev" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -26,10 +26,17 @@ jobs:
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: "3.10"
|
||||
- name: Install dependencies
|
||||
- name: Install MW
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
if [ -f requirements.txt ]; then pip3 install -r requirements.txt; fi
|
||||
sudo bash scripts/install_dev.sh
|
||||
- name: Install MySQL80
|
||||
run: |
|
||||
sudo mkdir -p /tmp
|
||||
sudo cat /www/server/mdserver-web/plugins/mysql/versions/8.0/install.sh > /tmp/t.log
|
||||
sudo echo "export MAKEJN=-j12\n" >> /www/server/mdserver-web/plugins/mysql/versions/8.0/install.sh
|
||||
sudo cat /tmp/t.log >> /www/server/mdserver-web/plugins/mysql/versions/8.0/install.sh
|
||||
|
||||
cd /www/server/mdserver-web/plugins/mysql && sudo bash install.sh install 8.0
|
||||
- name: Start DEBUG
|
||||
run: |
|
||||
gunicorn -c setting.py app:app
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
||||
|
||||
name: MW APP 3.6.8
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
#runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python 3.6.8
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: "3.6.8"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
if [ -f requirements.txt ]; then pip3 install -r requirements.txt; fi
|
||||
- name: Start DEBUG
|
||||
run: |
|
||||
gunicorn -c setting.py app:app
|
||||
python3 task.py &
|
||||
@@ -130,3 +130,8 @@ include
|
||||
data/api_login.txt
|
||||
data/sessions
|
||||
data/ssl.pl
|
||||
data/port.pl
|
||||
plugins/openlitespeed
|
||||
plugins/gdrive/
|
||||
data/ipv6.pl
|
||||
data/restart.pl
|
||||
|
||||
@@ -2,14 +2,6 @@
|
||||
简单的Linux面板,感谢BT.CN写出如此好的web管理软件。我一看到,就知道这是我一直想要的页面化管理方式。
|
||||
复制了后台管理界面,按照自己想要的方式写了一版。
|
||||
|
||||
```
|
||||
为了兼容CentOS,Ubuntu,Debian,Fedora, 由chkconfig改systemd管理。原来都要重新安装。还在进行修改..
|
||||
|
||||
chkconfig 支持 Fedora,CentOS
|
||||
update-rc.d 支持 Ubuntu,Debian | 功能不够
|
||||
systemd 支持 CentOS,Ubuntu,Debian,Fedora...
|
||||
|
||||
```
|
||||
|
||||

|
||||

|
||||
@@ -22,7 +14,6 @@ systemd 支持 CentOS,Ubuntu,Debian,Fedora...
|
||||
* 面板收藏功能
|
||||
* 网站子目录绑定
|
||||
* 网站备份功能
|
||||
* 自动更新优化
|
||||
* 插件方式管理
|
||||
|
||||
基本上可以使用,后续会继续优化!欢迎提供意见!
|
||||
@@ -48,9 +39,8 @@ systemd 支持 CentOS,Ubuntu,Debian,Fedora...
|
||||
|
||||
|
||||
### 问题
|
||||
- Ubuntu 20 无法安装mysql5.7 && mysql 80.
|
||||
- Ftp debian无法安装成功。
|
||||
- php52,在debian无法安装成功。
|
||||
- OP防火墙,暂不要开启。
|
||||
|
||||
|
||||
|
||||
### GW使用
|
||||
@@ -82,6 +72,14 @@ curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/update_cn.s
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 通用安装
|
||||
|
||||
```
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/quick/app.sh | bash
|
||||
```
|
||||
|
||||
|
||||
### DEV使用
|
||||
|
||||
- 自动安装
|
||||
@@ -111,10 +109,9 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/up
|
||||
如果你自己写了插件,想分享出来,也可以提Issue。
|
||||
```
|
||||
|
||||
- 开发文档 - https://github.com/midoks/mdserver-web/wiki/插件开发
|
||||
- 简单例子 - https://github.com/mw-plugin/simple-plugin
|
||||
- 插件地址 - https://github.com/mw-plugin
|
||||
- 例子 - https://github.com/mw-plugin/simple-plugin
|
||||
|
||||
- 开发文档 - https://github.com/midoks/mdserver-web/wiki/插件开发
|
||||
|
||||
|
||||
### Stargazers over time
|
||||
@@ -122,11 +119,9 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/up
|
||||
[](https://starchart.cc/midoks/mdserver-web)
|
||||
|
||||
|
||||
### 感谢
|
||||
### 感谢开发赞助
|
||||
|
||||
- 开发赞助
|
||||
|
||||
[digitalvirt](https://digitalvirt.com/)
|
||||
[](https://digitalvirt.com/)
|
||||
|
||||
### 授权许可
|
||||
|
||||
|
||||
@@ -14,13 +14,19 @@ from geventwebsocket.handler import WebSocketHandler
|
||||
|
||||
try:
|
||||
if __name__ == "__main__":
|
||||
f = open('data/port.pl')
|
||||
PORT = int(f.read())
|
||||
HOST = '0.0.0.0'
|
||||
|
||||
PORT = 7200
|
||||
if os.path.exists('data/port.pl'):
|
||||
f = open('data/port.pl')
|
||||
PORT = int(f.read())
|
||||
f.close()
|
||||
|
||||
HOST = '0.0.0.0'
|
||||
http_server = WSGIServer(
|
||||
(HOST, PORT), app, handler_class=WebSocketHandler)
|
||||
|
||||
http_server.serve_forever()
|
||||
|
||||
socketio.run(app, host=HOST, port=PORT)
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
|
||||
@@ -20,10 +20,9 @@ from flask import redirect
|
||||
|
||||
|
||||
def init():
|
||||
|
||||
initDB()
|
||||
initInitD()
|
||||
initUserInfo()
|
||||
initInitD()
|
||||
|
||||
|
||||
def local():
|
||||
@@ -57,7 +56,6 @@ def doContentReplace(src, dst):
|
||||
|
||||
|
||||
def initInitD():
|
||||
mw.setHostAddr(mw.getLocalIp())
|
||||
|
||||
# systemctl
|
||||
# 有问题
|
||||
@@ -97,6 +95,9 @@ def initInitD():
|
||||
mw.execShell('which chkconfig && chkconfig --add mw')
|
||||
mw.execShell('which update-rc.d && update-rc.d -f mw defaults')
|
||||
|
||||
# 获取系统IPV4
|
||||
mw.setHostAddr(mw.getLocalIp())
|
||||
|
||||
|
||||
def initUserInfo():
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class config_api:
|
||||
# 本版解决自启动问题
|
||||
# 文件管理重命名
|
||||
# 优化计划任务管理
|
||||
__version = '0.8.6'
|
||||
__version = '0.8.6.1'
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
+18
-1
@@ -570,7 +570,7 @@ def downloadHook(count, blockSize, totalSize):
|
||||
print('%02d%%' % (100.0 * count * blockSize / totalSize))
|
||||
|
||||
|
||||
def getLocalIp():
|
||||
def getLocalIpBack():
|
||||
# 取本地外网IP
|
||||
try:
|
||||
import re
|
||||
@@ -591,6 +591,23 @@ def getLocalIp():
|
||||
return '127.0.0.1'
|
||||
|
||||
|
||||
def getLocalIp():
|
||||
# 取本地外网IP
|
||||
try:
|
||||
import re
|
||||
filename = 'data/iplist.txt'
|
||||
ipaddress = readFile(filename)
|
||||
if not ipaddress or ipaddress == '127.0.0.1':
|
||||
import urllib
|
||||
url = 'https://v6r.ipip.net/?format=text'
|
||||
req = urllib.request.urlopen(url, timeout=10)
|
||||
ipaddress = req.read().decode('utf-8')
|
||||
writeFile(filename, ipaddress)
|
||||
return ipaddress
|
||||
except Exception as ex:
|
||||
return '127.0.0.1'
|
||||
|
||||
|
||||
def inArray(arrays, searchStr):
|
||||
# 搜索数据中是否存在
|
||||
for key in arrays:
|
||||
|
||||
+18
-12
@@ -1526,9 +1526,13 @@ class site_api:
|
||||
def getSecurity(self, sid, name):
|
||||
filename = self.getHostConf(name)
|
||||
conf = mw.readFile(filename)
|
||||
|
||||
if type(conf) == bool:
|
||||
return mw.returnJson(False, '读取配置文件失败!')
|
||||
|
||||
data = {}
|
||||
if conf.find('SECURITY-START') != -1:
|
||||
rep = "#SECURITY-START(\n|.){1,500}#SECURITY-END"
|
||||
rep = "#SECURITY-START(.|\n)*#SECURITY-END"
|
||||
tmp = re.search(rep, conf).group()
|
||||
data['fix'] = re.search(
|
||||
"\(.+\)\$", tmp).group().replace('(', '').replace(')$', '').replace('|', ',')
|
||||
@@ -1553,22 +1557,22 @@ class site_api:
|
||||
if os.path.exists(file):
|
||||
conf = mw.readFile(file)
|
||||
if conf.find('SECURITY-START') != -1:
|
||||
rep = "\s{0,4}#SECURITY-START(\n|.){1,500}#SECURITY-END\n?"
|
||||
rep = "\s{0,4}#SECURITY-START(\n|.)*#SECURITY-END\n?"
|
||||
conf = re.sub(rep, '', conf)
|
||||
mw.writeLog('网站管理', '站点[' + name + ']已关闭防盗链设置!')
|
||||
else:
|
||||
rconf = '''#SECURITY-START 防盗链配置
|
||||
location ~ .*\.(%s)$
|
||||
{
|
||||
expires 30d;
|
||||
access_log /dev/null;
|
||||
valid_referers none blocked %s;
|
||||
if ($invalid_referer){
|
||||
return 404;
|
||||
location ~ .*\.(%s)$
|
||||
{
|
||||
expires 30d;
|
||||
access_log /dev/null;
|
||||
valid_referers none blocked %s;
|
||||
if ($invalid_referer){
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
}
|
||||
# SECURITY-END
|
||||
include enable-php-''' % (fix.strip().replace(',', '|'), domains.strip().replace(',', ' '))
|
||||
#SECURITY-END
|
||||
include enable-php-''' % (fix.strip().replace(',', '|'), domains.strip().replace(',', ' '))
|
||||
conf = re.sub("include\s+enable-php-", rconf, conf)
|
||||
mw.writeLog('网站管理', '站点[' + name + ']已开启防盗链!')
|
||||
mw.writeFile(file, conf)
|
||||
@@ -1619,6 +1623,8 @@ include enable-php-''' % (fix.strip().replace(',', '|'), domains.strip().replace
|
||||
os.makedirs(path)
|
||||
if not mw.isAppleSystem():
|
||||
mw.execShell('chown -R www:www ' + path)
|
||||
|
||||
mw.writeFile(path + '/index.html', '已经开始工作!!!')
|
||||
mw.execShell('chmod -R 755 ' + path)
|
||||
|
||||
def nginxAddDomain(self, webname, domain, port):
|
||||
|
||||
@@ -102,12 +102,9 @@ class system_api:
|
||||
return mw.returnJson(True, '正在重启服务器!')
|
||||
##### ----- end ----- ###
|
||||
|
||||
@mw_async
|
||||
def restartMw(self):
|
||||
sleep(0.3)
|
||||
# cmd = mw.getRunDir() + '/scripts/init.d/mw restart'
|
||||
# print cmd
|
||||
mw.execShell('service mw restart')
|
||||
mw.writeFile('data/restart.pl', 'True')
|
||||
return True
|
||||
|
||||
@mw_async
|
||||
def restartServer(self):
|
||||
|
||||
@@ -42,6 +42,8 @@ class task_api:
|
||||
_page['tojs'] = 'remind'
|
||||
_page['p'] = p
|
||||
|
||||
# return data
|
||||
_ret['count'] = count
|
||||
_ret['page'] = mw.getPage(_page)
|
||||
return mw.getJson(_ret)
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ mw_start_debug(){
|
||||
}
|
||||
|
||||
mw_start_debug2(){
|
||||
gunicorn -c setting.py app:app
|
||||
python3 task.py &
|
||||
gunicorn -b :7200 -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 app:app
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ INSERT INTO `firewall` (`id`, `port`, `ps`, `addtime`) VALUES
|
||||
(2, '7200', 'WEB面板', '0000-00-00 00:00:00'),
|
||||
(3, '22', 'SSH远程管理服务', '0000-00-00 00:00:00'),
|
||||
(4, '888', 'phpMyAdmin默认端口', '0000-00-00 00:00:00'),
|
||||
(5, '3306', 'MySQL端口', '0000-00-00 00:00:00');
|
||||
(5, '443', 'HTTPS', '0000-00-00 00:00:00');
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class mysqlDb:
|
||||
def __Conn(self):
|
||||
'''连接MYSQL数据库'''
|
||||
try:
|
||||
socket = '/tmp/mysql.sock'
|
||||
socket = '/www/server/mysql/mysql.sock'
|
||||
try:
|
||||
import MySQLdb
|
||||
except Exception as ex:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
echo `date`
|
||||
|
||||
GITADDR="{$GITROOTURL}/{$USERNAME}/{$PROJECT}"
|
||||
GITADDR="{$GITROOTURL}/{$USERNAME}/{$PROJECT}.git"
|
||||
GIT_SDIR="{$CODE_DIR}"
|
||||
|
||||
GIT_USER_DIR="${GIT_SDIR}/{$USERNAME}"
|
||||
@@ -24,7 +24,7 @@ cd $GIT_PROJECT_DIR && git pull
|
||||
# cd $GIT_PROJECT_DIR && env -i git pull origin master
|
||||
|
||||
|
||||
|
||||
#更新的目的地址
|
||||
WEB_PATH={$WEB_ROOT}/{$USERNAME}/{$PROJECT}
|
||||
mkdir -p $WEB_PATH
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="bt-w-menu">
|
||||
<p class="bgw" onclick="pluginService('gogs');">服务</p>
|
||||
<p onclick="pluginInitD('gogs');">自启动</p>
|
||||
<p onclick="pluginConfig('gogs',null, 'init_conf');">启动配置</p>
|
||||
<!-- <p onclick="pluginConfig('gogs',null, 'init_conf');">启动配置</p> -->
|
||||
<p onclick="gogsEdit();">手动编辑</p>
|
||||
<p onclick="pluginConfig('gogs',null, 'conf');">配置文件</p>
|
||||
<p onclick="gogsSetConfig();">配置修改</p>
|
||||
|
||||
+97
-47
@@ -11,10 +11,11 @@ sys.path.append(os.getcwd() + "/class/core")
|
||||
import mw
|
||||
|
||||
|
||||
cmd = 'ls /usr/local/lib/ | grep python | cut -d \\ -f 1 | awk \'END {print}\''
|
||||
info = mw.execShell(cmd)
|
||||
p = "/usr/local/lib/" + info[0].strip() + "/site-packages"
|
||||
sys.path.append(p)
|
||||
# cmd = 'ls /usr/local/lib/ | grep python | cut -d \\ -f 1 | awk \'END {print}\''
|
||||
# info = mw.execShell(cmd)
|
||||
# p = "/usr/local/lib/" + info[0].strip() + "/site-packages"
|
||||
# sys.path.append(p)
|
||||
|
||||
import psutil
|
||||
|
||||
|
||||
@@ -61,6 +62,13 @@ def getArgs():
|
||||
return tmp
|
||||
|
||||
|
||||
def checkArgs(data, ck=[]):
|
||||
for i in range(len(ck)):
|
||||
if not ck[i] in data:
|
||||
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
|
||||
return (True, mw.returnJson(True, 'ok'))
|
||||
|
||||
|
||||
def getInitdConfTpl():
|
||||
path = getPluginDir() + "/init.d/gogs.tpl"
|
||||
return path
|
||||
@@ -170,9 +178,14 @@ def getRootUrl():
|
||||
content = mw.readFile(getConf())
|
||||
rep = 'ROOT_URL\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
if not tmp:
|
||||
return ''
|
||||
return tmp.groups()[0]
|
||||
if tmp:
|
||||
return tmp.groups()[0]
|
||||
|
||||
rep = 'EXTERNAL_URL\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
if tmp:
|
||||
return tmp.groups()[0]
|
||||
return ''
|
||||
|
||||
|
||||
def getSshPort():
|
||||
@@ -218,8 +231,7 @@ def getDbConfValue():
|
||||
return r
|
||||
|
||||
|
||||
def pMysqlDb():
|
||||
conf = getDbConfValue()
|
||||
def pMysqlDb(conf):
|
||||
|
||||
host = conf['HOST'].split(':')
|
||||
conn = mysqlDb.mysqlDb()
|
||||
@@ -232,6 +244,53 @@ def pMysqlDb():
|
||||
return conn
|
||||
|
||||
|
||||
def pSqliteDb(conf):
|
||||
# print(conf)
|
||||
import db
|
||||
psDb = db.Sql()
|
||||
|
||||
# 默认
|
||||
gsdir = getServerDir() + '/data'
|
||||
dbname = 'gogs'
|
||||
if conf['PATH'][0] == '/':
|
||||
# 绝对路径
|
||||
pass
|
||||
else:
|
||||
path = conf['PATH'].split('/')
|
||||
gsdir = getServerDir() + '/' + path[0]
|
||||
dbname = path[1].split('.')[0]
|
||||
|
||||
# print(gsdir, dbname)
|
||||
psDb.dbPos(gsdir, dbname)
|
||||
return psDb
|
||||
|
||||
|
||||
def getGogsDbType(conf):
|
||||
|
||||
if 'DB_TYPE' in conf:
|
||||
return conf['DB_TYPE']
|
||||
|
||||
if 'TYPE' in conf:
|
||||
return conf['TYPE']
|
||||
|
||||
return 'NONE'
|
||||
|
||||
|
||||
def pQuery(sql):
|
||||
conf = getDbConfValue()
|
||||
gtype = getGogsDbType(conf)
|
||||
if gtype == 'sqlite3':
|
||||
db = pSqliteDb(conf)
|
||||
data = db.query(sql, []).fetchall()
|
||||
return data
|
||||
elif gtype == 'mysql':
|
||||
db = pMysqlDb(conf)
|
||||
return db.query(sql)
|
||||
|
||||
print("仅支持mysql|sqlite3配置")
|
||||
exit(0)
|
||||
|
||||
|
||||
def isSqlError(mysqlMsg):
|
||||
# 检测数据库执行错误
|
||||
_mysqlMsg = str(mysqlMsg)
|
||||
@@ -255,37 +314,35 @@ def isSqlError(mysqlMsg):
|
||||
return mw.returnData(True, 'OK')
|
||||
|
||||
|
||||
def start():
|
||||
|
||||
def gogsOp(method):
|
||||
file = initDreplace()
|
||||
data = mw.execShell(__SR + file + ' start')
|
||||
|
||||
if not mw.isAppleSystem():
|
||||
data = mw.execShell('systemctl ' + method + ' gogs')
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return 'fail'
|
||||
|
||||
data = mw.execShell(__SR + file + ' ' + method)
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[0]
|
||||
|
||||
|
||||
def start():
|
||||
return gogsOp('start')
|
||||
|
||||
|
||||
def stop():
|
||||
file = initDreplace()
|
||||
data = mw.execShell(__SR + file + ' stop')
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[1]
|
||||
return gogsOp('stop')
|
||||
|
||||
|
||||
def restart():
|
||||
file = initDreplace()
|
||||
data = mw.execShell(__SR + file + ' restart')
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[1]
|
||||
return gogsOp('restart')
|
||||
|
||||
|
||||
def reload():
|
||||
file = initDreplace()
|
||||
data = mw.execShell(__SR + file + ' reload')
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[1]
|
||||
return gogsOp('reload')
|
||||
|
||||
|
||||
def initdStatus():
|
||||
@@ -391,15 +448,13 @@ def userList():
|
||||
import math
|
||||
args = getArgs()
|
||||
|
||||
page = 1
|
||||
page_size = 10
|
||||
data = checkArgs(args, ['page', 'page_size'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
page = int(args['page'])
|
||||
page_size = int(args['page_size'])
|
||||
search = ''
|
||||
if 'page' in args:
|
||||
page = int(args['page'])
|
||||
|
||||
if 'page_size' in args:
|
||||
page_size = int(args['page_size'])
|
||||
|
||||
if 'search' in args:
|
||||
search = args['search']
|
||||
|
||||
@@ -407,17 +462,13 @@ def userList():
|
||||
|
||||
data['root_url'] = getRootUrl()
|
||||
|
||||
pm = pMysqlDb()
|
||||
start = (page - 1) * page_size
|
||||
list_count = pm.query('select count(id) as num from user')
|
||||
list_count = pQuery('select count(id) as num from user')
|
||||
count = list_count[0][0]
|
||||
|
||||
list_data = pm.query(
|
||||
list_data = pQuery(
|
||||
'select id,name,email from user order by id desc limit ' + str(start) + ',' + str(page_size))
|
||||
|
||||
page_info = {'count': count, 'p': page,
|
||||
'row': page_size, 'tojs': 'gogsUserList'}
|
||||
data['list'] = mw.getPage(page_info)
|
||||
data['list'] = mw.getPage({'count': count, 'p': page,
|
||||
'row': page_size, 'tojs': 'gogsUserList'})
|
||||
data['page'] = page
|
||||
data['page_size'] = page_size
|
||||
data['page_count'] = int(math.ceil(count / page_size))
|
||||
@@ -542,8 +593,8 @@ def projectScriptLoad():
|
||||
|
||||
cc_content = mw.readFile(commit_tpl)
|
||||
|
||||
sshUrl = 'http://127.0.0.1:' + getHttpPort()
|
||||
cc_content = cc_content.replace('{$GITROOTURL}', sshUrl)
|
||||
gitPath = getRootPath()
|
||||
cc_content = cc_content.replace('{$GITROOTURL}', gitPath)
|
||||
cc_content = cc_content.replace('{$CODE_DIR}', codeDir)
|
||||
cc_content = cc_content.replace('{$USERNAME}', user)
|
||||
cc_content = cc_content.replace('{$PROJECT}', args['name'])
|
||||
@@ -620,8 +671,7 @@ def getTotalStatistics():
|
||||
st = status()
|
||||
data = {}
|
||||
if st.strip() == 'start':
|
||||
pm = pMysqlDb()
|
||||
list_count = pm.query('select count(id) as num from repository')
|
||||
list_count = pQuery('select count(id) as num from repository')
|
||||
|
||||
if list_count.find("error") > -1:
|
||||
data['status'] = False
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
[Unit]
|
||||
Description=Gogs
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
# Modify these two values and uncomment them if you have
|
||||
# repos with lots of files and get an HTTP error 500 because
|
||||
# of that
|
||||
###
|
||||
#LimitMEMLOCK=infinity
|
||||
#LimitNOFILE=65535
|
||||
Type=simple
|
||||
User=git
|
||||
Group=git
|
||||
WorkingDirectory={$SERVER_PATH}/gogs
|
||||
ExecStart={$SERVER_PATH}/gogs/gogs web
|
||||
ExecReload=/bin/kill -USR2 $MAINPID
|
||||
Restart=always
|
||||
Environment=USER=git HOME=/home/git
|
||||
|
||||
# Some distributions may not support these hardening directives. If you cannot start the service due
|
||||
# to an unknown option, comment out the ones not supported by your version of systemd.
|
||||
ProtectSystem=full
|
||||
PrivateDevices=yes
|
||||
PrivateTmp=yes
|
||||
NoNewPrivileges=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,30 +1,12 @@
|
||||
[Unit]
|
||||
Description=Gogs
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
After=mariadb.service mysqld.service postgresql.service memcached.service redis.service
|
||||
|
||||
[Service]
|
||||
# Modify these two values and uncomment them if you have
|
||||
# repos with lots of files and get an HTTP error 500 because
|
||||
# of that
|
||||
###
|
||||
#LimitMEMLOCK=infinity
|
||||
#LimitNOFILE=65535
|
||||
Type=simple
|
||||
User=root
|
||||
Group=root
|
||||
WorkingDirectory={$SERVER_PATH}/gogs
|
||||
ExecStart={$SERVER_PATH}/gogs/gogs web
|
||||
Restart=always
|
||||
Environment=USER=git HOME=/home/git
|
||||
|
||||
# Some distributions may not support these hardening directives. If you cannot start the service due
|
||||
# to an unknown option, comment out the ones not supported by your version of systemd.
|
||||
ProtectSystem=full
|
||||
PrivateDevices=yes
|
||||
PrivateTmp=yes
|
||||
NoNewPrivileges=true
|
||||
Type=forking
|
||||
ExecStart={$SERVER_PATH}/gogs/init.d/gogs start
|
||||
ExecStop={$SERVER_PATH}/gogs/init.d/gogs stop
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
+18
-1
@@ -35,6 +35,16 @@ Install_gogs()
|
||||
version=$1
|
||||
os=`getOs`
|
||||
|
||||
# if id git &> /dev/null ;then
|
||||
# echo "git uid is `id -u git`"
|
||||
# echo "git shell is `grep "^git:" /etc/passwd |cut -d':' -f7 `"
|
||||
# else
|
||||
# groupadd git
|
||||
# useradd -g git git
|
||||
# fi
|
||||
|
||||
git config --global push.default simple
|
||||
|
||||
if [ "darwin" == "$os" ];then
|
||||
file=gogs_${version}_darwin_amd64.zip
|
||||
else
|
||||
@@ -47,8 +57,11 @@ Install_gogs()
|
||||
|
||||
cd $serverPath/source/gogs && unzip -o $file -d gogs_${version}
|
||||
mv $serverPath/source/gogs/gogs_${version}/gogs/ $serverPath/gogs
|
||||
echo $version > $serverPath/gogs/version.pl
|
||||
|
||||
|
||||
if [ -d $serverPath/gogs ];then
|
||||
echo $version > $serverPath/gogs/version.pl
|
||||
fi
|
||||
# if id -u gogs > /dev/null 2>&1; then
|
||||
# echo "gogs user exists"
|
||||
# else
|
||||
@@ -63,6 +76,10 @@ Install_gogs()
|
||||
Uninstall_gogs()
|
||||
{
|
||||
rm -rf $serverPath/gogs
|
||||
if [ -f /usr/lib/systemd/system/gogs.service ];then
|
||||
systemctl stop gogs
|
||||
rm -rf /usr/lib/systemd/system/gogs.service
|
||||
fi
|
||||
echo 'uninstall success' > $install_tmp
|
||||
}
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ function getRsaPublic(){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
var con = '<div class="tab-con">\
|
||||
<div class="myKeyCon ptb15">\
|
||||
<textarea style="margin:0px;width:580px;height:110px;outline:none;" spellcheck="false">'+rdata.public+'</textarea>\
|
||||
<textarea style="margin:0px;width:580px;height:110px;outline:none;" spellcheck="false">'+rdata.mw+'</textarea>\
|
||||
</div>\
|
||||
<ul class="help-info-text c7 pull-left"></ul>\
|
||||
</div>'
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
"name": "mongodb",
|
||||
"title": "Mongodb",
|
||||
"shell": "install.sh",
|
||||
"versions":["4.4.14","5.0.9"],
|
||||
"updates":["4.4.14","5.0.9"],
|
||||
"versions":["4.4.14","5.0.4"],
|
||||
"updates":["4.4.14","5.0.4"],
|
||||
"tip": "soft",
|
||||
"checks": "server/mongodb",
|
||||
"path": "server/mongodb",
|
||||
|
||||
@@ -30,7 +30,7 @@ class mysqlDb:
|
||||
'''连接MYSQL数据库'''
|
||||
try:
|
||||
import mw
|
||||
socket = '/tmp/mysql.sock'
|
||||
socket = '/www/server/mysql/mysql.sock'
|
||||
try:
|
||||
import MySQLdb
|
||||
except Exception as ex:
|
||||
|
||||
@@ -80,7 +80,7 @@ innodb_write_io_threads = 1
|
||||
innodb_file_per_table=1
|
||||
|
||||
|
||||
secure-file-priv=/tmp
|
||||
secure-file-priv={$SERVER_APP_PATH}/tmp
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
|
||||
@@ -76,7 +76,7 @@ innodb_read_io_threads = 1
|
||||
innodb_write_io_threads = 1
|
||||
innodb_file_per_table=1
|
||||
|
||||
secure-file-priv=/tmp
|
||||
secure-file-priv={$SERVER_APP_PATH}/tmp
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
|
||||
@@ -77,7 +77,7 @@ innodb_write_io_threads = 1
|
||||
innodb_file_per_table=1
|
||||
binlog_expire_logs_seconds=2592000
|
||||
|
||||
secure-file-priv=/tmp
|
||||
secure-file-priv={$SERVER_APP_PATH}/tmp
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
|
||||
+63
-77
@@ -103,6 +103,8 @@ def getConf():
|
||||
|
||||
def getInitdTpl(version=''):
|
||||
path = getPluginDir() + '/init.d/mysql' + version + '.tpl'
|
||||
if not os.path.exists(path):
|
||||
path = getPluginDir() + '/init.d/mysql.tpl'
|
||||
return path
|
||||
|
||||
|
||||
@@ -161,6 +163,11 @@ def initDreplace(version=''):
|
||||
if not os.path.exists(mysql_conf_dir):
|
||||
os.mkdir(mysql_conf_dir)
|
||||
|
||||
mysql_tmp = getServerDir() + '/tmp'
|
||||
if not os.path.exists(mysql_tmp):
|
||||
os.mkdir(mysql_tmp)
|
||||
mw.execShell("chown -R mysql:mysql " + mysql_tmp)
|
||||
|
||||
mysql_conf = mysql_conf_dir + '/my.cnf'
|
||||
if not os.path.exists(mysql_conf):
|
||||
mysql_conf_tpl = getPluginDir() + '/conf/my' + version + '.cnf'
|
||||
@@ -291,8 +298,8 @@ def initMysqlData():
|
||||
cmd = 'cd ' + serverdir + ' && ./scripts/mysql_install_db --user=' + \
|
||||
user + ' --basedir=' + serverdir + ' --ldata=' + datadir
|
||||
mw.execShell(cmd)
|
||||
return 0
|
||||
return 1
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def initMysql57Data():
|
||||
@@ -302,10 +309,10 @@ def initMysql57Data():
|
||||
myconf = serverdir + "/etc/my.cnf"
|
||||
user = pGetDbUser()
|
||||
cmd = 'cd ' + serverdir + ' && ./bin/mysqld --defaults-file=' + myconf + \
|
||||
' --initialize --explicit_defaults_for_timestamp'
|
||||
' --initialize-insecure --explicit_defaults_for_timestamp'
|
||||
mw.execShell(cmd)
|
||||
return 0
|
||||
return 1
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def initMysql8Data():
|
||||
@@ -313,12 +320,16 @@ def initMysql8Data():
|
||||
if not os.path.exists(datadir + '/mysql'):
|
||||
serverdir = getServerDir()
|
||||
user = pGetDbUser()
|
||||
# cmd = 'cd ' + serverdir + ' && ./bin/mysqld --basedir=' + serverdir + ' --datadir=' + \
|
||||
# datadir + ' --initialize'
|
||||
|
||||
cmd = 'cd ' + serverdir + ' && ./bin/mysqld --basedir=' + serverdir + ' --datadir=' + \
|
||||
datadir + ' --initialize'
|
||||
datadir + ' --initialize-insecure'
|
||||
|
||||
# print(cmd)
|
||||
mw.execShell(cmd)
|
||||
return 0
|
||||
return 1
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def initMysqlPwd():
|
||||
@@ -328,8 +339,8 @@ def initMysqlPwd():
|
||||
|
||||
pwd = mw.getRandomString(16)
|
||||
cmd_pass = serverdir + '/bin/mysqladmin -uroot password ' + pwd
|
||||
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))
|
||||
mw.execShell(cmd_pass)
|
||||
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))
|
||||
return True
|
||||
|
||||
|
||||
@@ -347,62 +358,29 @@ def mysql8IsInitedPasswd():
|
||||
|
||||
|
||||
def initMysql8Pwd():
|
||||
is_start = False
|
||||
for x in range(60):
|
||||
data = mw.execShell(
|
||||
"ps -ef|grep mysql|grep -v grep|grep -v py|grep -v init.d|awk '{print $2}'")
|
||||
if data[0] != "":
|
||||
# print("mysql start ok!")
|
||||
is_start = True
|
||||
break
|
||||
time.sleep(0.5)
|
||||
|
||||
if not is_start:
|
||||
# print("mysql start fail!")
|
||||
return False
|
||||
time.sleep(2)
|
||||
|
||||
serverdir = getServerDir()
|
||||
pwd = mw.getRandomString(16)
|
||||
|
||||
pass_cmd = "cat " + serverdir + \
|
||||
"/data/error.log | grep root@localhost | awk -F 'root@localhost:' '{print $2}'"
|
||||
passdata = mw.execShell(pass_cmd)
|
||||
password = passdata[0].strip()
|
||||
|
||||
if len(password) == 0:
|
||||
return True
|
||||
|
||||
# print('localhost', 3306, 'root', password,
|
||||
# "/www/server/mysql/mysql.sock")
|
||||
|
||||
# import MySQLdb as mdb
|
||||
# dbconn = mdb.connect(host='localhost', port=3306, user='root',
|
||||
# passwd=password, unix_socket="/www/server/mysql/mysql.sock")
|
||||
# dbconn.autocommit(True)
|
||||
# dbcurr = dbconn.cursor()
|
||||
# dbcurr.execute('SET NAMES UTF8MB4')
|
||||
|
||||
# # with mysql_native_password
|
||||
alter_root_pwd = 'flush privileges;'
|
||||
alter_root_pwd = alter_root_pwd + \
|
||||
"alter user 'root'@'localhost' IDENTIFIED by '" + pwd + "';"
|
||||
alter_root_pwd = alter_root_pwd + \
|
||||
"alter user 'root'@'localhost' IDENTIFIED WITH mysql_native_password by '" + pwd + "';"
|
||||
alter_root_pwd = alter_root_pwd + "flush privileges;"
|
||||
# dbcurr.execute(alter_root_pwd)
|
||||
|
||||
cmd_pass = serverdir + '/bin/mysqladmin -uroot password root'
|
||||
data = mw.execShell(cmd_pass)
|
||||
# print(data)
|
||||
|
||||
tmp_file = "/tmp/mysql_init_tmp.log"
|
||||
mw.writeFile(tmp_file, alter_root_pwd)
|
||||
cmd_pass = serverdir + '/bin/mysql --connect-expired-password -uroot -p"' + \
|
||||
password + '" < ' + tmp_file
|
||||
# print(cmd_pass)
|
||||
cmd_pass = serverdir + '/bin/mysql -uroot -proot < ' + tmp_file
|
||||
|
||||
data = mw.execShell(cmd_pass)
|
||||
if data[1].find("ERROR") != -1:
|
||||
# print(data[1])
|
||||
pass
|
||||
else:
|
||||
mw.writeFile(serverdir + "/data/error.log", "")
|
||||
os.remove(tmp_file)
|
||||
# print(data)
|
||||
os.remove(tmp_file)
|
||||
|
||||
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))
|
||||
|
||||
@@ -413,9 +391,11 @@ def myOp(version, method):
|
||||
# import commands
|
||||
init_file = initDreplace()
|
||||
try:
|
||||
initData = initMysqlData()
|
||||
if initData == 0:
|
||||
isInited = initMysqlData()
|
||||
if not isInited:
|
||||
mw.execShell('systemctl start mysql')
|
||||
initMysqlPwd()
|
||||
mw.execShell('systemctl stop mysql')
|
||||
|
||||
mw.execShell('systemctl ' + method + ' mysql')
|
||||
return 'ok'
|
||||
@@ -424,39 +404,46 @@ def myOp(version, method):
|
||||
|
||||
|
||||
def my8cmd(version, method):
|
||||
# mysql 8.0 and 5.7 ok
|
||||
# mysql 8.0 and 5.7
|
||||
init_file = initDreplace(version)
|
||||
if version == '5.7':
|
||||
initMysql57Data()
|
||||
elif version == '8.0':
|
||||
initMysql8Data()
|
||||
cmd = init_file + ' ' + method
|
||||
try:
|
||||
if version == '5.7':
|
||||
isInited = initMysql57Data()
|
||||
elif version == '8.0':
|
||||
isInited = initMysql8Data()
|
||||
|
||||
if not mysql8IsInitedPasswd():
|
||||
setSkipGrantTables(True)
|
||||
cmd_init_start = init_file + ' start'
|
||||
subprocess.Popen(cmd_init_start, stdout=subprocess.PIPE, shell=True,
|
||||
bufsize=4096, stderr=subprocess.PIPE)
|
||||
if not isInited:
|
||||
|
||||
if mw.isAppleSystem():
|
||||
cmd_init_start = init_file + ' start'
|
||||
subprocess.Popen(cmd_init_start, stdout=subprocess.PIPE, shell=True,
|
||||
bufsize=4096, stderr=subprocess.PIPE)
|
||||
|
||||
time.sleep(6)
|
||||
else:
|
||||
mw.execShell('systemctl start mysql')
|
||||
|
||||
time.sleep(6)
|
||||
initMysql8Pwd()
|
||||
|
||||
cmd_init_stop = init_file + ' stop'
|
||||
subprocess.Popen(cmd_init_stop, stdout=subprocess.PIPE, shell=True,
|
||||
bufsize=4096, stderr=subprocess.PIPE)
|
||||
setSkipGrantTables(False)
|
||||
if mw.isAppleSystem():
|
||||
cmd_init_stop = init_file + ' stop'
|
||||
subprocess.Popen(cmd_init_stop, stdout=subprocess.PIPE, shell=True,
|
||||
bufsize=4096, stderr=subprocess.PIPE)
|
||||
time.sleep(3)
|
||||
else:
|
||||
mw.execShell('systemctl stop mysql')
|
||||
|
||||
time.sleep(3)
|
||||
my8cmd(version, method)
|
||||
if mw.isAppleSystem():
|
||||
sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True,
|
||||
bufsize=4096, stderr=subprocess.PIPE)
|
||||
sub.wait(5)
|
||||
else:
|
||||
mw.execShell('systemctl ' + method + ' mysql')
|
||||
|
||||
return 'ok'
|
||||
except Exception as e:
|
||||
return str(e)
|
||||
|
||||
return 'fail'
|
||||
|
||||
|
||||
def appCMD(version, action):
|
||||
if version == '8.0' or version == '5.7':
|
||||
@@ -481,9 +468,8 @@ def reload(version=''):
|
||||
|
||||
|
||||
def initdStatus():
|
||||
if not app_debug:
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
shell_cmd = 'systemctl status mysql | grep loaded | grep "enabled;"'
|
||||
data = mw.execShell(shell_cmd)
|
||||
@@ -673,7 +659,7 @@ def isSqlError(mysqlMsg):
|
||||
# 检测数据库执行错误
|
||||
mysqlMsg = str(mysqlMsg)
|
||||
if "MySQLdb" in mysqlMsg:
|
||||
return mw.returnJson(False, 'MySQLdb组件缺失! <br>进入SSH命令行输入: pip install mysql-python')
|
||||
return mw.returnJson(False, 'MySQLdb组件缺失! <br>进入SSH命令行输入: pip install mysql-python | pip install mysqlclient==2.0.3')
|
||||
if "2002," in mysqlMsg:
|
||||
return mw.returnJson(False, '数据库连接失败,请检查数据库服务是否启动!')
|
||||
if "2003," in mysqlMsg:
|
||||
|
||||
@@ -805,6 +805,8 @@ function setDbPs(id, name, obj) {
|
||||
function openPhpmyadmin(name,username,password){
|
||||
|
||||
data = syncPost('/plugins/check',{'name':'phpmyadmin'});
|
||||
|
||||
|
||||
if (!data.status){
|
||||
layer.msg(data.msg,{icon:2,shade: [0.3, '#000']});
|
||||
return;
|
||||
@@ -815,7 +817,7 @@ function openPhpmyadmin(name,username,password){
|
||||
layer.msg('phpMyAdmin未启动',{icon:2,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
// console.log(data);
|
||||
data = syncPost('/plugins/run',{'name':'phpmyadmin','func':'get_home_page'});
|
||||
var rdata = $.parseJSON(data.data);
|
||||
if (!rdata.status){
|
||||
@@ -830,16 +832,28 @@ function openPhpmyadmin(name,username,password){
|
||||
return;
|
||||
}
|
||||
|
||||
var murl = $("#toPHPMyAdmin").attr('action');
|
||||
$("#pma_username").val(username);
|
||||
$("#pma_password").val(password);
|
||||
$("#db").val(name);
|
||||
//检查版本
|
||||
data = syncPost('/plugins/run',{'name':'phpmyadmin','func':'version'});
|
||||
bigVer = data.data.split('.')[0]
|
||||
if (bigVer>=5){
|
||||
|
||||
layer.msg('正在打开phpMyAdmin',{icon:16,shade: [0.3, '#000'],time:1000});
|
||||
setTimeout(function(){
|
||||
$("#toPHPMyAdmin").submit();
|
||||
},3000);
|
||||
layer.msg('phpMyAdmin['+data.data+']需要手动登录😭',{icon:16,shade: [0.3, '#000'],time:4000});
|
||||
|
||||
} else{
|
||||
var murl = $("#toPHPMyAdmin").attr('action');
|
||||
$("#pma_username").val(username);
|
||||
$("#pma_password").val(password);
|
||||
$("#db").val(name);
|
||||
|
||||
setTimeout(function(){
|
||||
$("#toPHPMyAdmin").submit();
|
||||
},2000);
|
||||
layer.msg('正在打开phpMyAdmin',{icon:16,shade: [0.3, '#000'],time:2000});
|
||||
|
||||
setTimeout(function(){
|
||||
$("#toPHPMyAdmin").submit();
|
||||
},3000);
|
||||
}
|
||||
}
|
||||
|
||||
function delBackup(filename,name){
|
||||
|
||||
@@ -14,16 +14,23 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mysqlDir=${serverPath}/source/mysql
|
||||
|
||||
|
||||
Install_mysql()
|
||||
{
|
||||
mkdir -p ${mysqlDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u www`"
|
||||
echo "mysql Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ ! -f ${mysqlDir}/mysql-5.5.62.tar.gz ];then
|
||||
@@ -47,11 +54,18 @@ Install_mysql()
|
||||
-DENABLED_LOCAL_INFILE=1 \
|
||||
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||
-DEXTRA_CHARSETS=all \
|
||||
-DDEFAULT_CHARSET=utf8 \
|
||||
-DDEFAULT_COLLATION=utf8_general_ci \
|
||||
&& make && make install && make clean \
|
||||
&& echo '5.5' > $serverPath/mysql/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
-DDEFAULT_CHARSET=utf8mb4 \
|
||||
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||
-DCMAKE_C_COMPILER=/usr/bin/gcc \
|
||||
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
|
||||
&& make ${MAKEJN:--j2} && make install && make clean
|
||||
|
||||
if [ -d $serverPath/mysql ];then
|
||||
echo '5.5' > $serverPath/mysql/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
else
|
||||
echo '安装失败' > $install_tmp
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -17,16 +17,23 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mysqlDir=${serverPath}/source/mysql
|
||||
|
||||
|
||||
Install_mysql()
|
||||
{
|
||||
mkdir -p ${mysqlDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u www`"
|
||||
echo "mysql Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
|
||||
@@ -51,11 +58,19 @@ Install_mysql()
|
||||
-DENABLED_LOCAL_INFILE=1 \
|
||||
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||
-DEXTRA_CHARSETS=all \
|
||||
-DDEFAULT_CHARSET=utf8 \
|
||||
-DDEFAULT_COLLATION=utf8_general_ci \
|
||||
&& make && make install && make clean
|
||||
echo '5.6' > $serverPath/mysql/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
-DDEFAULT_CHARSET=utf8mb4 \
|
||||
-DCMAKE_C_COMPILER=/usr/bin/gcc \
|
||||
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
|
||||
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||
&& make ${MAKEJN:--j2} && make install && make clean
|
||||
|
||||
|
||||
if [ -d $serverPath/mysql ];then
|
||||
echo '5.6' > $serverPath/mysql/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
else
|
||||
echo '安装失败' > $install_tmp
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -19,22 +19,43 @@ mysqlDir=${serverPath}/source/mysql
|
||||
|
||||
VERSION="5.7.37"
|
||||
|
||||
|
||||
Install_mysql()
|
||||
{
|
||||
mkdir -p ${mysqlDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u www`"
|
||||
echo "mysql Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f ${mysqlDir}/mysql-boost-${VERSION}.tar.gz ];then
|
||||
wget -O ${mysqlDir}/mysql-boost-${VERSION}.tar.gz https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-boost-${VERSION}.tar.gz
|
||||
fi
|
||||
|
||||
#检测文件是否损坏.
|
||||
md5_mysql_ok=d0489fc3880248a58759c50bfb286dbb
|
||||
if [ -f ${mysqlDir}/mysql-boost-${VERSION}.tar.gz ];then
|
||||
md5_mysql=`md5sum ${mysqlDir}/mysql-boost-${VERSION}.tar.gz | awk '{print $1}'`
|
||||
if [ "${md5_mysql_ok}" == "${md5_mysql}" ]; then
|
||||
echo "mysql5.7 file check ok"
|
||||
else
|
||||
# 重新下载
|
||||
rm -rf ${mysqlDir}/mysql-${VERSION}
|
||||
wget -O ${mysqlDir}/mysql-boost-${VERSION}.tar.gz https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-boost-${VERSION}.tar.gz
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d ${mysqlDir}/mysql-${VERSION} ];then
|
||||
cd ${mysqlDir} && tar -zxvf ${mysqlDir}/mysql-boost-${VERSION}.tar.gz
|
||||
fi
|
||||
@@ -51,11 +72,13 @@ Install_mysql()
|
||||
-DENABLED_LOCAL_INFILE=1 \
|
||||
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||
-DEXTRA_CHARSETS=all \
|
||||
-DDEFAULT_CHARSET=utf8 \
|
||||
-DDEFAULT_COLLATION=utf8_general_ci \
|
||||
-DDEFAULT_CHARSET=utf8mb4 \
|
||||
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||
-DDOWNLOAD_BOOST=1 \
|
||||
-DCMAKE_C_COMPILER=/usr/bin/gcc \
|
||||
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
|
||||
-DWITH_BOOST=${mysqlDir}/mysql-${VERSION}/boost/
|
||||
make && make install && make clean
|
||||
make ${MAKEJN:--j2} && make install && make clean
|
||||
echo '5.7' > $serverPath/mysql/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
fi
|
||||
|
||||
@@ -22,13 +22,19 @@ Install_mysql()
|
||||
mkdir -p ${mysqlDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u www`"
|
||||
echo "mysql Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
INSTALL_CMD=cmake
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
|
||||
INSTALL_CMD=cmake
|
||||
fi
|
||||
|
||||
@@ -36,10 +42,24 @@ Install_mysql()
|
||||
wget -O ${mysqlDir}/mysql-boost-8.0.25.tar.gz https://cdn.mysql.com/archives/mysql-8.0/mysql-boost-8.0.25.tar.gz
|
||||
fi
|
||||
|
||||
#检测文件是否损坏.
|
||||
md5_mysql_ok=e142c2058313b4646c36fa9bb1b38493
|
||||
if [ -f ${mysqlDir}/mysql-boost-8.0.25.tar.gz ];then
|
||||
md5_mysql=`md5sum ${mysqlDir}/mysql-boost-8.0.25.tar.gz | awk '{print $1}'`
|
||||
if [ "${md5_mysql_ok}" == "${md5_mysql}" ]; then
|
||||
echo "mysql8.0 file check ok"
|
||||
else
|
||||
# 重新下载
|
||||
rm -rf ${mysqlDir}/mysql-8.0.25
|
||||
wget -O ${mysqlDir}/mysql-boost-8.0.25.tar.gz https://cdn.mysql.com/archives/mysql-8.0/mysql-boost-8.0.25.tar.gz
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d ${mysqlDir}/mysql-8.0.25 ];then
|
||||
cd ${mysqlDir} && tar -zxvf ${mysqlDir}/mysql-boost-8.0.25.tar.gz
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d $serverPath/mysql ];then
|
||||
cd ${mysqlDir}/mysql-8.0.25 && ${INSTALL_CMD} \
|
||||
-DCMAKE_INSTALL_PREFIX=$serverPath/mysql \
|
||||
@@ -52,13 +72,18 @@ Install_mysql()
|
||||
-DENABLED_LOCAL_INFILE=1 \
|
||||
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||
-DEXTRA_CHARSETS=all \
|
||||
-DDEFAULT_CHARSET=utf8 \
|
||||
-DDEFAULT_COLLATION=utf8_general_ci \
|
||||
-DDEFAULT_CHARSET=utf8mb4 \
|
||||
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||
-DDOWNLOAD_BOOST=1 \
|
||||
-DFORCE_INSOURCE_BUILD=1 \
|
||||
-DCMAKE_C_COMPILER=/usr/bin/gcc \
|
||||
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
|
||||
-DWITH_BOOST=${mysqlDir}/mysql-8.0.25/boost/
|
||||
make && make install && make clean
|
||||
echo '8.0' > $serverPath/mysql/version.pl
|
||||
make ${MAKEJN:--j2} && make install && make clean
|
||||
|
||||
if [ -d $serverPath/mysql ];then
|
||||
echo '8.0' > $serverPath/mysql/version.pl
|
||||
fi
|
||||
echo '安装完成' > $install_tmp
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -15,8 +15,10 @@ Install_of(){
|
||||
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
mkdir -p $serverPath/op_waf
|
||||
mkdir -p $rootPath/wwwlogs/waf
|
||||
|
||||
if [ -f $serverPath/openresty ];then
|
||||
mkdir -p $serverPath/openresty/nginx/conf/waf
|
||||
fi
|
||||
echo '0.1' > $serverPath/op_waf/version.pl
|
||||
echo 'install ok' > $install_tmp
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>网站防火墙</title>
|
||||
<title>OP网站防火墙</title>
|
||||
<style>
|
||||
*{margin:0;padding:0;color:#444}
|
||||
body{font-size:14px;font-family:"宋体"}
|
||||
@@ -18,7 +18,7 @@ ol li{line-height:30px}
|
||||
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="title">网站防火墙</div>
|
||||
<div class="title">OP网站防火墙</div>
|
||||
<div class="content">
|
||||
<p class="t1">您的请求带有不合法参数,已被网站管理员设置拦截!</p>
|
||||
<p class="t2">可能原因:</p>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>网站防火墙</title>
|
||||
<title>OP网站防火墙</title>
|
||||
<style>
|
||||
*{margin:0;padding:0;color:#444}
|
||||
body{font-size:14px;font-family:"宋体"}
|
||||
@@ -18,7 +18,7 @@ ol li{line-height:30px}
|
||||
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="title">网站防火墙</div>
|
||||
<div class="title">OP网站防火墙</div>
|
||||
<div class="content">
|
||||
<p class="t1">您的请求带有不合法参数,已被网站管理员设置拦截!</p>
|
||||
<p class="t2">可能原因:</p>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>网站防火墙</title>
|
||||
<title>OP网站防火墙</title>
|
||||
<style>
|
||||
*{margin:0;padding:0;color:#444}
|
||||
body{font-size:14px;font-family:"宋体"}
|
||||
@@ -18,7 +18,7 @@ ol li{line-height:30px}
|
||||
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="title">网站防火墙</div>
|
||||
<div class="title">OP网站防火墙</div>
|
||||
<div class="content">
|
||||
<p class="t1">您的请求带有不合法参数,已被网站管理员设置拦截!</p>
|
||||
<p class="t2">可能原因:</p>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>网站防火墙</title>
|
||||
<title>OP网站防火墙</title>
|
||||
<style>
|
||||
*{margin:0;padding:0;color:#444}
|
||||
body{font-size:14px;font-family:"宋体"}
|
||||
@@ -18,7 +18,7 @@ ol li{line-height:30px}
|
||||
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="title">网站防火墙</div>
|
||||
<div class="title">OP网站防火墙</div>
|
||||
<div class="content">
|
||||
<p class="t1">您的请求带有不合法参数,已被网站管理员设置拦截!</p>
|
||||
<p class="t2">可能原因:</p>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>网站防火墙</title>
|
||||
<title>OP网站防火墙</title>
|
||||
<style>
|
||||
*{margin:0;padding:0;color:#444}
|
||||
body{font-size:14px;font-family:"宋体"}
|
||||
@@ -18,7 +18,7 @@ ol li{line-height:30px}
|
||||
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="title">网站防火墙</div>
|
||||
<div class="title">OP网站防火墙</div>
|
||||
<div class="content">
|
||||
<p class="t1">您的请求带有不合法参数,已被网站管理员设置拦截!</p>
|
||||
<p class="t2">可能原因:</p>
|
||||
|
||||
@@ -317,26 +317,35 @@ function post_data_chekc()
|
||||
if C:return_post_data() then return false end
|
||||
request_args = ngx.req.get_post_args()
|
||||
if not request_args then return false end
|
||||
if not request_header['Content-Type'] then return false end
|
||||
av=string.match(request_header['Content-Type'],"=.+")
|
||||
|
||||
if request_header then
|
||||
if not request_header['Content-Type'] then return false end
|
||||
av = string.match(request_header['Content-Type'],"=.+")
|
||||
end
|
||||
|
||||
if not av then return false end
|
||||
ac=split(av,'=')
|
||||
ac = split(av,'=')
|
||||
|
||||
if not ac then return false end
|
||||
|
||||
list_list=nil
|
||||
for i,v in ipairs(ac)
|
||||
do
|
||||
list_list='--'..v
|
||||
end
|
||||
|
||||
if not list_list then return false end
|
||||
aaa=nil
|
||||
for k,v in pairs(request_args)
|
||||
do
|
||||
aaa=v
|
||||
end
|
||||
|
||||
if not aaa then return false end
|
||||
if tostring(aaa) == 'true' then return false end
|
||||
if type(aaa) ~= "string" then return false end
|
||||
data_len=split(aaa,list_list)
|
||||
|
||||
--return return_message(200,data_len)
|
||||
if not data_len then return false end
|
||||
if arrlen(data_len) ==0 then return false end
|
||||
|
||||
@@ -133,9 +133,7 @@ def confReplace():
|
||||
|
||||
# 主配置文件
|
||||
nconf = getServerDir() + '/nginx/conf/nginx.conf'
|
||||
__content = mw.readFile(nconf)
|
||||
if __content.find('#user'):
|
||||
mw.writeFile(nconf, content)
|
||||
mw.writeFile(nconf, content)
|
||||
|
||||
# 静态配置
|
||||
static_conf = getServerDir() + '/nginx/conf/enable-php-00.conf'
|
||||
|
||||
@@ -45,7 +45,7 @@ Install_openresty()
|
||||
--with-http_slice_module \
|
||||
--with-http_stub_status_module
|
||||
|
||||
gmake && gmake install && make clean
|
||||
make && make install && make clean
|
||||
|
||||
if [ -d $serverPath/openresty ];then
|
||||
echo "${VERSION}" > $serverPath/openresty/version.pl
|
||||
|
||||
@@ -26,7 +26,8 @@ function phpPost(method, version, args,callback){
|
||||
$.post('/plugins/run', req_data, function(data) {
|
||||
layer.close(loadT);
|
||||
if (!data.status){
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
//错误展示10S
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [10, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,16 +70,16 @@ if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
fi
|
||||
|
||||
if [ ! -f $sourcePath/php/php-5.2.17-fpm-0.5.14.diff.gz ]; then
|
||||
wget -O $sourcePath/php/php-5.2.17-fpm-0.5.14.diff.gz http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz
|
||||
wget --no-check-certificate -O $sourcePath/php/php-5.2.17-fpm-0.5.14.diff.gz http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f $sourcePath/php/php-5.2.17-max-input-vars.patch ]; then
|
||||
wget -O $sourcePath/php/php-5.2.17-max-input-vars.patch https://raw.github.com/laruence/laruence.github.com/master/php-5.2-max-input-vars/php-5.2.17-max-input-vars.patch
|
||||
wget --no-check-certificate -O $sourcePath/php/php-5.2.17-max-input-vars.patch https://raw.github.com/laruence/laruence.github.com/master/php-5.2-max-input-vars/php-5.2.17-max-input-vars.patch
|
||||
fi
|
||||
|
||||
if [ ! -f $sourcePath/php/php-5.x.x.patch ]; then
|
||||
wget -O $sourcePath/php/php-5.x.x.patch https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt
|
||||
wget --no-check-certificate -O $sourcePath/php/php-5.x.x.patch https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
|
||||
version=5.3.29
|
||||
PHP_VER=53
|
||||
Install_php()
|
||||
@@ -34,15 +35,6 @@ if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
fi
|
||||
|
||||
|
||||
if [ -f $serverPath/php/53/bin/php.dSYM ];then
|
||||
mv $serverPath/php/53/bin/php.dSYM $serverPath/php/53/bin/php
|
||||
fi
|
||||
|
||||
if [ -f $serverPath/php/53/sbin/php-fpm.dSYM ];then
|
||||
mv $serverPath/php/53/sbin/php-fpm.dSYM $serverPath/php/53/sbin/php-fpm
|
||||
fi
|
||||
|
||||
|
||||
if [ -f $serverPath/php/53/bin/php ];then
|
||||
return
|
||||
fi
|
||||
@@ -92,8 +84,8 @@ if [ ! -d $serverPath/php/53 ];then
|
||||
--enable-sysvshm \
|
||||
--disable-fileinfo \
|
||||
$OPTIONS \
|
||||
--enable-fpm \
|
||||
&& make && make install && make clean
|
||||
--enable-fpm
|
||||
make clean && make ${MAKEJN:--j2} && make install && make clean
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ else
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d $serverPath/php/${PHP_VER} ];then
|
||||
cd $sourcePath/php/php${PHP_VER} && ./configure \
|
||||
--prefix=$serverPath/php/${PHP_VER} \
|
||||
@@ -67,8 +68,37 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then
|
||||
--enable-sysvshm \
|
||||
--disable-fileinfo \
|
||||
$OPTIONS \
|
||||
--enable-fpm \
|
||||
&& make && make install && make clean
|
||||
--enable-fpm
|
||||
|
||||
make clean && make ${MAKEJN:--j2}
|
||||
|
||||
#debian11,没有生成php54 man
|
||||
if [ ! -f sapi/cli/php.1 ];then
|
||||
cp -rf sapi/cli/php.1.in sapi/cli/php.1
|
||||
fi
|
||||
|
||||
if [ ! -f sapi/cgi/php-cgi.1 ];then
|
||||
cp -rf sapi/cgi/php-cgi.1.in sapi/cgi/php-cgi.1
|
||||
fi
|
||||
|
||||
if [ ! -f scripts/man1/phpize.1 ];then
|
||||
cp -rf scripts/man1/phpize.1.in scripts/man1/phpize.1
|
||||
fi
|
||||
|
||||
if [ ! -f scripts/man1/php-config.1 ];then
|
||||
cp -rf scripts/man1/php-config.1.in scripts/man1/php-config.1
|
||||
fi
|
||||
|
||||
if [ ! -f ext/phar/phar.1 ];then
|
||||
cp -rf ext/phar/phar.1.in ext/phar/phar.1
|
||||
fi
|
||||
|
||||
if [ ! -f ext/phar/phar.phar.1 ];then
|
||||
cp -rf ext/phar/phar.phar.1.in ext/phar/phar.phar.1
|
||||
fi
|
||||
|
||||
|
||||
make install && make clean
|
||||
fi
|
||||
|
||||
#------------------------ install end ------------------------------------#
|
||||
|
||||
@@ -67,8 +67,8 @@ if [ ! -d $serverPath/php/55 ];then
|
||||
--disable-intl \
|
||||
--disable-fileinfo \
|
||||
$OPTIONS \
|
||||
--enable-fpm \
|
||||
&& make && make install && make clean
|
||||
--enable-fpm
|
||||
make clean && make ${MAKEJN:--j2} && make install && make clean
|
||||
fi
|
||||
|
||||
#------------------------ install end ------------------------------------#
|
||||
|
||||
@@ -44,6 +44,7 @@ else
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d $serverPath/php/56 ];then
|
||||
cd $sourcePath/php/php${PHP_VER} && ./configure \
|
||||
--prefix=$serverPath/php/56 \
|
||||
@@ -69,8 +70,8 @@ if [ ! -d $serverPath/php/56 ];then
|
||||
--disable-intl \
|
||||
--disable-fileinfo \
|
||||
$OPTIONS \
|
||||
--enable-fpm \
|
||||
&& make clean && make && make install && make clean
|
||||
--enable-fpm
|
||||
make clean && make ${MAKEJN:--j2} && make install && make clean
|
||||
fi
|
||||
|
||||
#------------------------ install end ------------------------------------#
|
||||
|
||||
@@ -10,7 +10,7 @@ sourcePath=${serverPath}/source
|
||||
sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
version=7.0.30
|
||||
version=7.0.33
|
||||
PHP_VER=70
|
||||
Install_php()
|
||||
{
|
||||
@@ -25,7 +25,7 @@ cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
|
||||
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz http://au1.php.net/distributions/php-${version}.tar.xz
|
||||
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz
|
||||
fi
|
||||
|
||||
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz
|
||||
@@ -66,8 +66,8 @@ if [ ! -d $serverPath/php/70 ];then
|
||||
--disable-intl \
|
||||
--disable-fileinfo \
|
||||
$OPTIONS \
|
||||
--enable-fpm \
|
||||
&& make && make install && make clean
|
||||
--enable-fpm
|
||||
make clean && make ${MAKEJN:--j2} && make install && make clean
|
||||
fi
|
||||
|
||||
#------------------------ install end ------------------------------------#
|
||||
|
||||
@@ -43,6 +43,7 @@ else
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d $serverPath/php/71 ];then
|
||||
cd $sourcePath/php/php${PHP_VER} && ./configure \
|
||||
--prefix=$serverPath/php/71 \
|
||||
@@ -65,8 +66,8 @@ if [ ! -d $serverPath/php/71 ];then
|
||||
--disable-intl \
|
||||
--disable-fileinfo \
|
||||
$OPTIONS \
|
||||
--enable-fpm \
|
||||
&& make && make install && make clean
|
||||
--enable-fpm
|
||||
make clean && make ${MAKEJN:--j2} && make install && make clean
|
||||
fi
|
||||
|
||||
#------------------------ install end ------------------------------------#
|
||||
|
||||
@@ -44,6 +44,7 @@ else
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d $serverPath/php/72 ];then
|
||||
cd $sourcePath/php/php${PHP_VER} && ./configure \
|
||||
--prefix=$serverPath/php/72 \
|
||||
@@ -66,8 +67,8 @@ if [ ! -d $serverPath/php/72 ];then
|
||||
--disable-intl \
|
||||
--disable-fileinfo \
|
||||
$OPTIONS \
|
||||
--enable-fpm \
|
||||
&& make && make install && make clean
|
||||
--enable-fpm
|
||||
make clean && make ${MAKEJN:--j2} && make install && make clean
|
||||
fi
|
||||
|
||||
#------------------------ install end ------------------------------------#
|
||||
|
||||
@@ -71,8 +71,8 @@ if [ ! -d $serverPath/php/73 ];then
|
||||
--disable-intl \
|
||||
--disable-fileinfo \
|
||||
$OPTIONS \
|
||||
--enable-fpm \
|
||||
&& make && make install && make clean
|
||||
--enable-fpm
|
||||
make clean && make ${MAKEJN:--j2} && make install && make clean
|
||||
fi
|
||||
|
||||
#------------------------ install end ------------------------------------#
|
||||
|
||||
@@ -11,7 +11,7 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
version=7.4.30
|
||||
version=7.4.26
|
||||
PHP_VER=74
|
||||
Install_php()
|
||||
{
|
||||
@@ -28,7 +28,7 @@ cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash libzip.sh
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
|
||||
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz http://au1.php.net/distributions/php-${version}.tar.xz
|
||||
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz
|
||||
fi
|
||||
|
||||
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz
|
||||
@@ -49,13 +49,11 @@ if [ $sysName == 'Darwin' ]; then
|
||||
export LDFLAGS="-L/usr/local/opt/libxml2/lib"
|
||||
else
|
||||
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
|
||||
OPTIONS="${OPTIONS} --with-freetype-dir=${serverPath}/lib/freetype"
|
||||
OPTIONS="${OPTIONS} --with-gd --enable-gd-native-ttf"
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
OPTIONS="${OPTIONS} --with-libzip=${serverPath}/lib/libzip"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
echo "$sourcePath/php/php${PHP_VER}"
|
||||
|
||||
if [ ! -d $serverPath/php/${PHP_VER} ];then
|
||||
@@ -81,8 +79,8 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then
|
||||
--disable-intl \
|
||||
--disable-fileinfo \
|
||||
$OPTIONS \
|
||||
--enable-fpm \
|
||||
&& make && make install && make clean
|
||||
--enable-fpm
|
||||
make ${MAKEJN:--j2} && make install && make clean
|
||||
fi
|
||||
#------------------------ install end ------------------------------------#
|
||||
}
|
||||
|
||||
@@ -49,13 +49,9 @@ if [ $sysName == 'Darwin' ]; then
|
||||
export LDFLAGS="-L/usr/local/opt/libxml2/lib"
|
||||
else
|
||||
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
|
||||
OPTIONS="${OPTIONS} --with-freetype-dir=${serverPath}/lib/freetype"
|
||||
OPTIONS="${OPTIONS} --with-gd"
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
OPTIONS="${OPTIONS} --with-libzip=${serverPath}/lib/libzip"
|
||||
fi
|
||||
|
||||
|
||||
echo "$sourcePath/php/php${PHP_VER}"
|
||||
|
||||
if [ ! -d $serverPath/php/${PHP_VER} ];then
|
||||
@@ -81,8 +77,8 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then
|
||||
--disable-intl \
|
||||
--disable-fileinfo \
|
||||
$OPTIONS \
|
||||
--enable-fpm \
|
||||
&& make && make install && make clean
|
||||
--enable-fpm
|
||||
make clean && make ${MAKEJN:--j2} && make install && make clean
|
||||
fi
|
||||
#------------------------ install end ------------------------------------#
|
||||
}
|
||||
|
||||
@@ -82,8 +82,8 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then
|
||||
--disable-intl \
|
||||
--disable-fileinfo \
|
||||
$OPTIONS \
|
||||
--enable-fpm \
|
||||
&& make && make install && make clean
|
||||
--enable-fpm
|
||||
make clean && make ${MAKEJN:--j2} && make install && make clean
|
||||
fi
|
||||
#------------------------ install end ------------------------------------#
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ $cfg['Servers'][$i]['host'] = '127.0.0.1';
|
||||
$cfg['Servers'][$i]['connect_type'] = 'tcp';
|
||||
$cfg['Servers'][$i]['compress'] = false;
|
||||
$cfg['Servers'][$i]['AllowNoPassword'] = false;
|
||||
$cfg['TempDir'] = '/www/server/phpmyadmin/tmp';
|
||||
$cfg['UploadDir'] = '';
|
||||
$cfg['SaveDir'] = '';
|
||||
?>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<p onclick="safeConf();">安全设置</p>
|
||||
<p onclick="pluginLogs('phpmyadmin','','access_log');">访问日志</p>
|
||||
<p onclick="pluginLogs('phpmyadmin','','error_log');">错误日志</p>
|
||||
<p onclick="pluginConfig('phpmyadmin','','config_inc');" title="config.inc.php">配置</p>
|
||||
</div>
|
||||
<div class="bt-w-con pd15">
|
||||
<div class="soft-man-con"></div>
|
||||
|
||||
@@ -48,6 +48,10 @@ def getConf():
|
||||
return mw.getServerDir() + '/web_conf/nginx/vhost/phpmyadmin.conf'
|
||||
|
||||
|
||||
def getConfInc():
|
||||
return getServerDir() + '/phpmyadmin/config.inc.php'
|
||||
|
||||
|
||||
def getPort():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
@@ -116,6 +120,10 @@ def start():
|
||||
centent = contentReplace(centent)
|
||||
mw.writeFile(file_run, centent)
|
||||
|
||||
tmp = getServerDir() + '/phpmyadmin/tmp'
|
||||
if not os.path.exists(tmp):
|
||||
os.mkdir(tmp)
|
||||
|
||||
conf_run = getServerDir() + '/phpmyadmin/config.inc.php'
|
||||
if not os.path.exists(conf_run):
|
||||
conf_tpl = getPluginDir() + '/conf/config.inc.php'
|
||||
@@ -208,6 +216,10 @@ def errorLog():
|
||||
return '/www/server/phpmyadmin/error.log'
|
||||
|
||||
|
||||
def Version():
|
||||
return mw.readFile(getServerDir() + '/version.pl')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
if func == 'status':
|
||||
@@ -222,6 +234,10 @@ if __name__ == "__main__":
|
||||
print(reload())
|
||||
elif func == 'conf':
|
||||
print(getConf())
|
||||
elif func == 'version':
|
||||
print(Version())
|
||||
elif func == 'config_inc':
|
||||
print(getConfInc())
|
||||
elif func == 'get_home_page':
|
||||
print(getHomePage())
|
||||
elif func == 'set_php_ver':
|
||||
|
||||
@@ -31,6 +31,9 @@ Install_phpmyadmin()
|
||||
cp -r $serverPath/source/phpmyadmin/$FDIR $serverPath/phpmyadmin/
|
||||
cd $serverPath/phpmyadmin/ && mv $FDIR phpmyadmin
|
||||
|
||||
mkdir -p $serverPath/phpmyadmin/tmp
|
||||
chown -R www:www $serverPath/phpmyadmin/tmp
|
||||
|
||||
echo "${1}" > ${serverPath}/phpmyadmin/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
|
||||
|
||||
@@ -109,6 +109,16 @@ def initDreplace():
|
||||
content = contentReplace(content)
|
||||
mw.writeFile(pureFtpdConfig, content)
|
||||
|
||||
# systemd
|
||||
systemDir = '/lib/systemd/system'
|
||||
systemService = systemDir + '/pureftp.service'
|
||||
systemServiceTpl = getPluginDir() + '/init.d/pureftp.service.tpl'
|
||||
if os.path.exists(systemDir) and not os.path.exists(systemService):
|
||||
se_content = mw.readFile(systemServiceTpl)
|
||||
se_content = se_content.replace('{$SERVER_PATH}', service_path)
|
||||
mw.writeFile(systemService, se_content)
|
||||
mw.execShell('systemctl daemon-reload')
|
||||
|
||||
return file_bin
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"tip":"soft",
|
||||
"name":"pureftp",
|
||||
"ps":"一款免费FTP服务器软件",
|
||||
"versions": "1.0.51",
|
||||
"versions": "1.0.49",
|
||||
"shell":"install.sh",
|
||||
"checks":"server/pureftp",
|
||||
"path":"server/pureftp",
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Pure-FTPd is a fast, production-quality, standard-conformant FTP server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart={$SERVER_PATH}/pureftp/sbin/pure-ftpd {$SERVER_PATH}/pureftp/etc/pure-ftpd.conf --daemonize
|
||||
ExecStop=/bin/kill -HUP $MAINPID
|
||||
ExecReload=/bin/kill -USR2 $MAINPID
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
+32
-11
@@ -30,28 +30,49 @@ fi
|
||||
|
||||
Install_pureftp()
|
||||
{
|
||||
mkdir -p ${serverPath}/pureftp
|
||||
# mkdir -p ${serverPath}/pureftp
|
||||
mkdir -p ${serverPath}/source/pureftp
|
||||
|
||||
# https://github.com/jedisct1/pure-ftpd/releases/download/1.0.49/pure-ftpd-1.0.49.tar.gz
|
||||
# https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.49.tar.gz
|
||||
# DOWNLOAD=https://github.com/jedisct1/pure-ftpd/releases/download/${VER}/pure-ftpd-${VER}.tar.gz
|
||||
|
||||
VER=$1
|
||||
FILE=pure-ftpd-${VER}.tar.gz
|
||||
FDIR=pure-ftpd-${VER}
|
||||
DOWNLOAD=https://download.pureftpd.org/pub/pure-ftpd/releases/$FILE
|
||||
DOWNLOAD=https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-${VER}.tar.gz
|
||||
|
||||
|
||||
if [ ! -f $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz ];then
|
||||
wget --no-check-certificate -O $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz $DOWNLOAD
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ ! -f $serverPath/source/pureftp/$FILE ];then
|
||||
wget -O $serverPath/source/pureftp/$FILE $DOWNLOAD
|
||||
#检测文件是否损坏.
|
||||
md5_ok=451879495ba61c1d7dcfca8dd231119f
|
||||
if [ -f $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz ];then
|
||||
md5_check=`md5sum $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz | awk '{print $1}'`
|
||||
if [ "${md5_ok}" == "${md5_check}" ]; then
|
||||
echo "pure-ftpd file check ok"
|
||||
else
|
||||
# 重新下载
|
||||
rm -rf $serverPath/source/pureftp/pure-ftpd-${VER}
|
||||
wget --no-check-certificate -O $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz $DOWNLOAD
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/source/pureftp/$FDIR ];then
|
||||
cd $serverPath/source/pureftp && tar zxvf $FILE
|
||||
if [ ! -d $serverPath/source/pureftp/pure-ftpd-${VER} ];then
|
||||
cd $serverPath/source/pureftp && tar zxvf pure-ftpd-${VER}.tar.gz
|
||||
fi
|
||||
|
||||
cd $serverPath/source/pureftp/$FDIR && ./configure --prefix=${serverPath}/pureftp \
|
||||
cd $serverPath/source/pureftp/pure-ftpd-${VER} && ./configure --prefix=${serverPath}/pureftp \
|
||||
--with-everything && make && make install && make clean
|
||||
|
||||
echo "${1}" > ${serverPath}/pureftp/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
if [ -d ${serverPath}/pureftp ];then
|
||||
echo "${1}" > ${serverPath}/pureftp/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
else
|
||||
echo '安装失败' > $install_tmp
|
||||
fi
|
||||
}
|
||||
|
||||
Uninstall_pureftp()
|
||||
|
||||
+16
-24
@@ -81,33 +81,29 @@ def status():
|
||||
return 'start'
|
||||
|
||||
|
||||
def start():
|
||||
data = mw.execShell('systemctl start ' + getPluginName())
|
||||
def vaOp(method):
|
||||
mw.execShell("systemctl daemon-reload")
|
||||
data = mw.execShell('systemctl ' + method + ' ' + getPluginName())
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return 'fail'
|
||||
|
||||
|
||||
def start():
|
||||
return vaOp('start')
|
||||
|
||||
|
||||
def stop():
|
||||
data = mw.execShell('systemctl stop ' + getPluginName())
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return 'fail'
|
||||
return vaOp('stop')
|
||||
|
||||
|
||||
def restart():
|
||||
data = mw.execShell('systemctl restart ' + getPluginName())
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return 'fail'
|
||||
return vaOp('restart')
|
||||
|
||||
|
||||
def reload():
|
||||
# file = initDreplace()
|
||||
data = mw.execShell('systemctl reload ' + getPluginName())
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return 'fail'
|
||||
return vaOp('reload')
|
||||
|
||||
|
||||
def runInfo():
|
||||
@@ -138,9 +134,8 @@ def readConfigTpl():
|
||||
|
||||
|
||||
def initdStatus():
|
||||
if not app_debug:
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
shell_cmd = 'systemctl status ' + \
|
||||
getPluginName() + ' | grep loaded | grep "enabled;"'
|
||||
@@ -151,19 +146,16 @@ def initdStatus():
|
||||
|
||||
|
||||
def initdInstall():
|
||||
import shutil
|
||||
if not app_debug:
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
mw.execShell('systemctl enable ' + getPluginName())
|
||||
return 'ok'
|
||||
|
||||
|
||||
def initdUinstall():
|
||||
if not app_debug:
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
mw.execShell('systemctl disable ' + getPluginName())
|
||||
return 'ok'
|
||||
|
||||
@@ -20,7 +20,7 @@ function varnishStatus() {
|
||||
}
|
||||
|
||||
var rdata = $.parseJSON(data.data);
|
||||
// console.log(rdata);
|
||||
console.log(rdata);
|
||||
|
||||
var tmp = "";
|
||||
for (let i in rdata) {
|
||||
|
||||
+4
-4
@@ -15,13 +15,13 @@ flask-sqlalchemy==2.3.2
|
||||
cryptography==3.3.2
|
||||
requests==2.20.0
|
||||
ConfigParser==5.2.0
|
||||
python-engineio==3.13.2
|
||||
python-socketio==4.2.0
|
||||
Flask-SocketIO==3.0.2
|
||||
python-engineio==4.3.2
|
||||
python-socketio>=4.2.0
|
||||
flask-socketio==5.2.0
|
||||
zmq==0.0.0
|
||||
paramiko>=2.8.0
|
||||
pymongo
|
||||
pillow
|
||||
Jinja2>=2.11.2
|
||||
flask-caching>=1.10.1
|
||||
mysql-connector-python
|
||||
mysqlclient>=2.0.3
|
||||
|
||||
+45
-14
@@ -315,7 +315,7 @@ def index(reqClass=None, reqAction=None, reqData=None):
|
||||
'plugins_api', 'system_api', 'site_api', 'task_api')
|
||||
className = reqClass + '_api'
|
||||
if not className in classFile:
|
||||
return "error"
|
||||
return "api request error"
|
||||
|
||||
eval_str = "__import__('" + className + "')." + className + '()'
|
||||
newInstance = eval(eval_str)
|
||||
@@ -323,13 +323,9 @@ def index(reqClass=None, reqAction=None, reqData=None):
|
||||
return publicObject(newInstance, reqAction)
|
||||
|
||||
|
||||
##################### ssh start ###########################
|
||||
ssh = None
|
||||
shell = None
|
||||
try:
|
||||
import paramiko
|
||||
ssh = paramiko.SSHClient()
|
||||
except:
|
||||
mw.execShell('pip3 install paramiko &')
|
||||
|
||||
|
||||
def create_rsa():
|
||||
@@ -340,12 +336,21 @@ def create_rsa():
|
||||
|
||||
|
||||
def clear_ssh():
|
||||
# 服务器IP
|
||||
ip = mw.getHostAddr()
|
||||
sh = '''
|
||||
#!/bin/bash
|
||||
PLIST=`who | grep localhost | awk '{print $2}'`
|
||||
for i in $PLIST
|
||||
do
|
||||
ps -t /dev/$i |grep -v TTY |awk '{print $1}' | xargs kill -9
|
||||
ps -t /dev/$i |grep -v TTY | awk '{print $1}' | xargs kill -9
|
||||
done
|
||||
|
||||
#getHostAddr
|
||||
PLIST=`who | grep "${ip}" | awk '{print $2}'`
|
||||
for i in $PLIST
|
||||
do
|
||||
ps -t /dev/$i |grep -v TTY | awk '{print $1}' | xargs kill -9
|
||||
done
|
||||
'''
|
||||
if not mw.isAppleSystem():
|
||||
@@ -355,21 +360,32 @@ done
|
||||
|
||||
def connect_ssh():
|
||||
# print 'connect_ssh ....'
|
||||
clear_ssh()
|
||||
# clear_ssh()
|
||||
global shell, ssh
|
||||
if not os.path.exists('/root/.ssh/authorized_keys') or not os.path.exists('/root/.ssh/id_rsa') or not os.path.exists('/root/.ssh/id_rsa.pub'):
|
||||
create_rsa()
|
||||
|
||||
# 检查是否写入authorized_keys
|
||||
data = mw.execShell("cat /root/.ssh/id_rsa.pub | awk '{print $3}'")
|
||||
if data[0] != "":
|
||||
ak_data = mw.execShell(
|
||||
"cat /root/.ssh/authorized_keys | grep " + data[0])
|
||||
if ak_data[0] == "":
|
||||
mw.execShell(
|
||||
'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys')
|
||||
mw.execShell('chmod 600 /root/.ssh/authorized_keys')
|
||||
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
|
||||
try:
|
||||
ssh.connect(mw.getHostAddr(), mw.getSSHPort(), timeout=5)
|
||||
except Exception as e:
|
||||
ssh.connect('127.0.0.1', mw.getSSHPort())
|
||||
except Exception as e:
|
||||
ssh.connect('localhost', mw.getSSHPort())
|
||||
except Exception as e:
|
||||
if mw.getSSHStatus():
|
||||
try:
|
||||
ssh.connect('127.0.0.1', mw.getSSHPort())
|
||||
except:
|
||||
return False
|
||||
ssh.connect('127.0.0.1', mw.getSSHPort())
|
||||
return False
|
||||
|
||||
shell = ssh.invoke_shell(term='xterm', width=83, height=21)
|
||||
shell.setblocking(0)
|
||||
return True
|
||||
@@ -420,6 +436,7 @@ def connected_msg(msg):
|
||||
ssh_success = True
|
||||
if not shell:
|
||||
ssh_success = connect_ssh()
|
||||
# print(ssh_success)
|
||||
if not ssh_success:
|
||||
emit('server_response', {'data': '连接SSH服务失败!\r\n'})
|
||||
return
|
||||
@@ -430,3 +447,17 @@ def connected_msg(msg):
|
||||
except Exception as e:
|
||||
pass
|
||||
# print 'connected_msg:' + str(e)
|
||||
|
||||
|
||||
if not mw.isAppleSystem():
|
||||
try:
|
||||
import paramiko
|
||||
ssh = paramiko.SSHClient()
|
||||
|
||||
# 启动尝试时连接
|
||||
# connect_ssh()
|
||||
except Exception as e:
|
||||
print("本地终端无法使用")
|
||||
|
||||
|
||||
##################### ssh end ###########################
|
||||
|
||||
@@ -209,7 +209,7 @@ function setIPv6() {
|
||||
$.post('/config/set_ipv6_status', {}, function (rdata) {
|
||||
layer.close(loadT);
|
||||
layer.msg(rdata.msg, {icon:rdata.status?1:2});
|
||||
setTimeout(function(){window.location.reload();},1500);
|
||||
setTimeout(function(){window.location.reload();},5000);
|
||||
},'json');
|
||||
}
|
||||
|
||||
|
||||
@@ -1310,7 +1310,7 @@ function setChmod(action,fileName){
|
||||
var chown = $("#chown").val();
|
||||
var data = 'filename='+ encodeURIComponent(fileName)+'&user='+chown+'&access='+chmod;
|
||||
var loadT = layer.msg('正在设置...',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
$.post('files/set_file_access',data,function(rdata){
|
||||
$.post('/files/set_file_access',data,function(rdata){
|
||||
layer.close(loadT);
|
||||
if(rdata.status) layer.closeAll();
|
||||
layer.msg(rdata.msg,{icon:rdata.status?1:2});
|
||||
|
||||
@@ -1088,15 +1088,17 @@ function execLog(){
|
||||
function remind(a){
|
||||
a = a == undefined ? 1 : a;
|
||||
$.post("/task/list", "table=tasks&result=2,4,6,8&limit=10&p=" + a, function(g) {
|
||||
// console.log(g);
|
||||
var e = "";
|
||||
var f = false;
|
||||
var task_count = 0;
|
||||
for(var d = 0; d < g.data.length; d++) {
|
||||
if(g.data[d].status != '1'){
|
||||
task_count++;
|
||||
continue;
|
||||
e += '<tr><td><input type="checkbox"></td><td><div class="titlename c3">'+g.data[d].name+'</span><span class="rs-status">【'+lan.bt.task_the+'】<span><span class="rs-time">'+ lan.bt.time + (g.data[d].end - g.data[d].start) + lan.bt.s+'</span></div></td><td class="text-right c3">'+g.data[d].addtime+'</td></tr>'
|
||||
} else{
|
||||
e += '<tr><td><input type="checkbox"></td><td><div class="titlename c3">'+g.data[d].name+'</span><span class="rs-status">【'+lan.bt.task_ok+'】<span><span class="rs-time">'+ lan.bt.time + (g.data[d].end - g.data[d].start) + lan.bt.s+'</span></div></td><td class="text-right c3">'+g.data[d].addtime+'</td></tr>';
|
||||
}
|
||||
e += '<tr><td><input type="checkbox"></td><td><div class="titlename c3">'+g.data[d].name+'</span><span class="rs-status">【'+lan.bt.task_ok+'】<span><span class="rs-time">'+ lan.bt.time + (g.data[d].end - g.data[d].start) + lan.bt.s+'</span></div></td><td class="text-right c3">'+g.data[d].addtime+'</td></tr>'
|
||||
}
|
||||
var con = '<div class="divtable"><table class="table table-hover">\
|
||||
<thead><tr><th width="20"><input id="Rs-checkAll" type="checkbox" onclick="RscheckSelect()"></th><th>'+lan.bt.task_name+'</th><th class="text-right">'+lan.bt.task_time+'</th></tr></thead>\
|
||||
@@ -1112,7 +1114,7 @@ function remind(a){
|
||||
</div>';
|
||||
|
||||
$(".task_count").text(task_count);
|
||||
$(".msg_count").text(g.data.length);
|
||||
$(".msg_count").text(g.count);
|
||||
$(".taskcon").html(con);
|
||||
$("#taskPage").html(g.page);
|
||||
|
||||
@@ -1592,7 +1594,8 @@ function pluginOpService(a, b, v) {
|
||||
}
|
||||
|
||||
setTimeout(function(){
|
||||
location.reload();
|
||||
// location.reload();
|
||||
getSList();
|
||||
},2000);
|
||||
},'json').error(function() {
|
||||
layer.close(e);
|
||||
|
||||
@@ -1085,7 +1085,7 @@ function setSecurity(name,id){
|
||||
$.post('/site/set_security',data,function(rdata){
|
||||
layer.close(loadT);
|
||||
layer.msg(rdata.msg,{icon:rdata.status?1:2});
|
||||
if(rdata.status) setTimeout(function(){Security(id,name);},1000);
|
||||
if(rdata.status) setTimeout(function(){security(id,name);},1000);
|
||||
},'json');
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ function getSList(isdisplay) {
|
||||
var mupdate = '';//(plugin.versions[n] == plugin.updates[n]) '' : '<a class="btlink" onclick="SoftUpdate(\'' + plugin.name + '\',\'' + plugin.versions[n].version + '\',\'' + plugin.updates[n] + '\')">更新</a> | ';
|
||||
// if (plugin.versions[n] == '') mupdate = '';
|
||||
handle = mupdate + '<a class="btlink" onclick="softMain(\'' + plugin.name + '\',\'' + plugin.setup_version + '\')">设置</a> | <a class="btlink" onclick="uninstallVersion(\'' + plugin.name + '\',\'' + plugin.setup_version + '\')">卸载</a>';
|
||||
titleClick = 'onclick="softMain(\'' + plugin.name + '\',\'' + version_info + '\')" style="cursor:pointer"';
|
||||
titleClick = 'onclick="softMain(\'' + plugin.name + '\',\'' + plugin.setup_version + '\')" style="cursor:pointer"';
|
||||
|
||||
softPath = '<span class="glyphicon glyphicon-folder-open" title="' + plugin.path + '" onclick="openPath(\'' + plugin.path + '\')"></span>';
|
||||
if (plugin.coexist){
|
||||
|
||||
@@ -331,7 +331,7 @@ html {
|
||||
cursor: pointer;
|
||||
border:transparent 1px solid;
|
||||
min-height: 20px;
|
||||
min-width: 150px;
|
||||
/*min-width: 150px;*/
|
||||
display: inline-block;
|
||||
}
|
||||
.input-edit:hover{
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB |
+7
-3
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+81
-69
@@ -26,62 +26,71 @@ else
|
||||
echo ""
|
||||
fi
|
||||
|
||||
|
||||
mw_start(){
|
||||
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
|
||||
if [ "$isStart" == '' ];then
|
||||
echo -e "Starting mw... \c"
|
||||
cd $mw_path && gunicorn -c setting.py app:app
|
||||
port=$(cat ${mw_path}/data/port.pl)
|
||||
isStart=""
|
||||
while [[ "$isStart" == "" ]];
|
||||
do
|
||||
echo -e ".\c"
|
||||
sleep 0.5
|
||||
isStart=$(lsof -n -P -i:$port|grep LISTEN|grep -v grep|awk '{print $2}'|xargs)
|
||||
let n+=1
|
||||
if [ $n -gt 15 ];then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
if [ "$isStart" == '' ];then
|
||||
echo -e "\033[31mfailed\033[0m"
|
||||
echo '------------------------------------------------------'
|
||||
tail -n 20 ${mw_path}/logs/error.log
|
||||
echo '------------------------------------------------------'
|
||||
echo -e "\033[31mError: mw service startup failed.\033[0m"
|
||||
return;
|
||||
fi
|
||||
echo -e "\033[32mdone\033[0m"
|
||||
else
|
||||
echo "Starting mw... mw(pid $(echo $isStart)) already running"
|
||||
fi
|
||||
|
||||
|
||||
isStart=$(ps aux |grep 'task.py'|grep -v grep|awk '{print $2}')
|
||||
mw_start_panel()
|
||||
{
|
||||
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
|
||||
if [ "$isStart" == '' ];then
|
||||
echo -e "Starting mw-tasks... \c"
|
||||
cd $mw_path && python3 task.py >> ${mw_path}/logs/task.log 2>&1 &
|
||||
sleep 0.3
|
||||
isStart=$(ps aux |grep 'task.py'|grep -v grep|awk '{print $2}')
|
||||
if [ "$isStart" == '' ];then
|
||||
echo -e "\033[31mfailed\033[0m"
|
||||
echo '------------------------------------------------------'
|
||||
tail -n 20 $mw_path/logs/task.log
|
||||
echo '------------------------------------------------------'
|
||||
echo -e "\033[31mError: mw-tasks service startup failed.\033[0m"
|
||||
return;
|
||||
echo -e "Starting mw-panel... \c"
|
||||
cd $mw_path && gunicorn -c setting.py app:app
|
||||
port=$(cat ${mw_path}/data/port.pl)
|
||||
isStart=""
|
||||
while [[ "$isStart" == "" ]];
|
||||
do
|
||||
echo -e ".\c"
|
||||
sleep 0.5
|
||||
isStart=$(lsof -n -P -i:$port|grep LISTEN|grep -v grep|awk '{print $2}'|xargs)
|
||||
let n+=1
|
||||
if [ $n -gt 15 ];then
|
||||
break;
|
||||
fi
|
||||
echo -e "\033[32mdone\033[0m"
|
||||
done
|
||||
if [ "$isStart" == '' ];then
|
||||
echo -e "\033[31mfailed\033[0m"
|
||||
echo '------------------------------------------------------'
|
||||
tail -n 20 ${mw_path}/logs/error.log
|
||||
echo '------------------------------------------------------'
|
||||
echo -e "\033[31mError: mw-panel service startup failed.\033[0m"
|
||||
return;
|
||||
fi
|
||||
echo -e "\033[32mdone\033[0m"
|
||||
else
|
||||
echo "Starting mw-tasks... mw-tasks (pid $isStart) already running"
|
||||
echo "Starting mw-panel... mw(pid $(echo $isStart)) already running"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
mw_stop()
|
||||
mw_start_task()
|
||||
{
|
||||
echo -e "Stopping mw-tasks... \c";
|
||||
isStart=$(ps aux |grep 'task.py'|grep -v grep|awk '{print $2}')
|
||||
if [ "$isStart" == '' ];then
|
||||
echo -e "Starting mw-tasks... \c"
|
||||
cd $mw_path && python3 task.py >> ${mw_path}/logs/task.log 2>&1 &
|
||||
sleep 0.3
|
||||
isStart=$(ps aux |grep 'task.py'|grep -v grep|awk '{print $2}')
|
||||
if [ "$isStart" == '' ];then
|
||||
echo -e "\033[31mfailed\033[0m"
|
||||
echo '------------------------------------------------------'
|
||||
tail -n 20 $mw_path/logs/task.log
|
||||
echo '------------------------------------------------------'
|
||||
echo -e "\033[31mError: mw-tasks service startup failed.\033[0m"
|
||||
return;
|
||||
fi
|
||||
echo -e "\033[32mdone\033[0m"
|
||||
else
|
||||
echo "Starting mw-tasks... mw-tasks (pid $isStart) already running"
|
||||
fi
|
||||
}
|
||||
|
||||
mw_start()
|
||||
{
|
||||
mw_start_panel
|
||||
mw_start_task
|
||||
}
|
||||
|
||||
|
||||
mw_stop_task()
|
||||
{
|
||||
echo -e "Stopping mw-tasks... \c";
|
||||
pids=$(ps aux | grep 'task.py'|grep -v grep|awk '{print $2}')
|
||||
arr=($pids)
|
||||
|
||||
@@ -90,20 +99,29 @@ mw_stop()
|
||||
kill -9 $p
|
||||
done
|
||||
echo -e "\033[32mdone\033[0m"
|
||||
}
|
||||
|
||||
echo -e "Stopping mw... \c";
|
||||
mw_stop_panel()
|
||||
{
|
||||
echo -e "Stopping mw-panel... \c";
|
||||
arr=`ps aux|grep 'gunicorn -c setting.py app:app'|grep -v grep|awk '{print $2}'`
|
||||
for p in ${arr[@]}
|
||||
for p in ${arr[@]}
|
||||
do
|
||||
kill -9 $p &>/dev/null
|
||||
done
|
||||
|
||||
if [ -f $pidfile ];then
|
||||
rm -f $pidfile
|
||||
rm -f $pidfile
|
||||
fi
|
||||
echo -e "\033[32mdone\033[0m"
|
||||
}
|
||||
|
||||
mw_stop()
|
||||
{
|
||||
mw_stop_panel
|
||||
mw_stop_task
|
||||
}
|
||||
|
||||
mw_status()
|
||||
{
|
||||
isStart=$(ps aux|grep 'gunicorn -c setting.py app:app'|grep -v grep|awk '{print $2}')
|
||||
@@ -163,6 +181,9 @@ case "$1" in
|
||||
'restart')
|
||||
mw_stop
|
||||
mw_start;;
|
||||
'restart_panel')
|
||||
mw_stop_panel
|
||||
mw_start_panel;;
|
||||
'status') mw_status;;
|
||||
'logs') error_logs;;
|
||||
'default')
|
||||
@@ -175,7 +196,7 @@ case "$1" in
|
||||
|
||||
if [ ! -f $mw_path/data/default.pl ];then
|
||||
echo -e "\033[33mInstall Failed\033[0m"
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
|
||||
password=$(cat $mw_path/data/default.pl)
|
||||
@@ -187,24 +208,15 @@ case "$1" in
|
||||
fi
|
||||
|
||||
if [ "$address" = "" ];then
|
||||
v4_available=true
|
||||
v6_available=true
|
||||
{
|
||||
v4=$(curl -4 -sS --connect-timeout 5 -m 60 https://v6r.ipip.net/?format=text)
|
||||
} || {
|
||||
v4_available=false
|
||||
}
|
||||
{
|
||||
v6=$(curl -6 -sS --connect-timeout 5 -m 60 https://v6r.ipip.net/?format=text)
|
||||
} || {
|
||||
v6_available=false
|
||||
}
|
||||
v4=$(python3 $mw_path/tools.py getServerIp 4)
|
||||
v6=$(python3 $mw_path/tools.py getServerIp 6)
|
||||
|
||||
if [ $v4_available = true ] && [ $v6_available = true ]; then
|
||||
address="MW-Panel-Url: http://$v4:$port$auth_path \nMW-Panel-Url: http://[$v6]:$port$auth_path"
|
||||
elif [ $v4_available = true ]; then
|
||||
if [ "$v4" != "" ] && [ "$v6" != "" ]; then
|
||||
address="MW-Panel-Url-Ipv4: http://$v4:$port$auth_path \nMW-Panel-Url-Ipv6: http://[$v6]:$port$auth_path"
|
||||
elif [ "$v4" != "" ]; then
|
||||
address="MW-Panel-Url: http://$v4:$port$auth_path"
|
||||
elif [ $v6_available = true ]; then
|
||||
elif [ "$v6" != "" ]; then
|
||||
echo 'True' > $mw_path/data/ipv6.pl
|
||||
address="MW-Panel-Url: http://[$v6]:$port$auth_path"
|
||||
else
|
||||
address="No v4 or v6 available"
|
||||
@@ -221,7 +233,7 @@ case "$1" in
|
||||
echo -e "password: $password"
|
||||
echo -e "\033[33mWarning:\033[0m"
|
||||
echo -e "\033[33mIf you cannot access the panel, \033[0m"
|
||||
echo -e "\033[33mrelease the following port (7200|888|80|443|20|21) in the security group\033[0m"
|
||||
echo -e "\033[33mrelease the following port (7200|888|80|443|22) in the security group\033[0m"
|
||||
echo -e "=================================================================="
|
||||
;;
|
||||
esac
|
||||
|
||||
+4
-1
@@ -44,6 +44,9 @@ elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; th
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
|
||||
OSNAME='debian'
|
||||
apt update -y
|
||||
apt install -y devscripts
|
||||
apt install -y wget zip unzip
|
||||
apt install -y wget zip unzip
|
||||
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
|
||||
OSNAME='ubuntu'
|
||||
@@ -72,7 +75,7 @@ if [ $OSNAME != "macos" ];then
|
||||
fi
|
||||
|
||||
echo "use system version: ${OSNAME}"
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/install/${OSNAME}.sh | bash
|
||||
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
|
||||
|
||||
chmod +x /www/server/mdserver-web/mw-cli
|
||||
if [ ! -e /usr/bin/mw-cli ]; then
|
||||
|
||||
+2
-36
@@ -26,7 +26,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT
|
||||
service iptables save
|
||||
|
||||
@@ -50,7 +50,7 @@ if [ ! -f /etc/init.d/iptables ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
|
||||
|
||||
@@ -78,44 +78,10 @@ dnf install -y ncurses-devel cmake
|
||||
dnf --enablerepo=crb install mysql-devel
|
||||
|
||||
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
|
||||
if [ ! -f /usr/local/bin/pip3 ];then
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
fi
|
||||
|
||||
|
||||
pip install --upgrade pip
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==21.1.2
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install flask-socketio==5.2.0
|
||||
pip3 install psutil==5.9.1
|
||||
pip3 install pymongo
|
||||
|
||||
|
||||
if [ ! -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && python3 -m venv .
|
||||
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==21.1.2
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install flask-socketio==5.2.0
|
||||
pip3 install psutil==5.9.1
|
||||
pip3 install pymongo
|
||||
fi
|
||||
|
||||
|
||||
cd /www/server/mdserver-web && ./cli.sh start
|
||||
sleep 5
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ yum install -y python3-devel
|
||||
yum install -y python-devel
|
||||
yum install -y vixie-cron
|
||||
yum install -y curl-devel libmcrypt libmcrypt-devel
|
||||
yum install -y mysql-devel
|
||||
|
||||
#https need
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
@@ -30,7 +31,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT
|
||||
service iptables save
|
||||
|
||||
@@ -54,7 +55,7 @@ if [ ! -f /etc/init.d/iptables ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
|
||||
|
||||
@@ -81,62 +82,14 @@ yum install -y libevent libevent-devel libjpeg* libpng* gd* libxslt* unzip
|
||||
yum install -y python-imaging libicu-devel zip bzip2-devel gcc libxml2 libxml2-devel pcre pcre-devel
|
||||
yum install -y libjpeg-devel libpng-devel libwebp libwebp-devel
|
||||
yum install -y lsof net-tools
|
||||
yum install -y ncurses-devel mysql-devel cmake
|
||||
yum install -y ncurses-devel cmake
|
||||
yum install -y MySQL-python
|
||||
|
||||
|
||||
|
||||
if [ ! -f /usr/local/bin/pip3 ];then
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
fi
|
||||
|
||||
|
||||
# echo "start install lib"
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
# echo "end install lib"
|
||||
|
||||
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
|
||||
# echo "start install python lib"
|
||||
|
||||
pip install --upgrade pip
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==21.1.2
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install python-socketio==4.2.0
|
||||
pip3 install psutil==5.9.1
|
||||
pip3 install pymongo
|
||||
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
|
||||
|
||||
# echo "start install python env lib"
|
||||
|
||||
if [ ! -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && python3 -m venv .
|
||||
source /www/server/mdserver-web/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==21.1.2
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install flask-session==0.3.2
|
||||
pip3 install flask-sqlalchemy==2.3.2
|
||||
pip3 install python-socketio==4.2.0
|
||||
pip3 install psutil==5.9.1
|
||||
pip3 install pymongo
|
||||
fi
|
||||
|
||||
# echo "end install python env lib"
|
||||
# echo "end install python lib"
|
||||
|
||||
|
||||
cd /www/server/mdserver-web && ./cli.sh start
|
||||
sleep 5
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ apt install -y wget curl lsof unzip
|
||||
apt install -y python3-pip
|
||||
apt install -y python3-dev
|
||||
apt install -y python3-venv
|
||||
|
||||
apt install -y cron
|
||||
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
@@ -33,7 +32,7 @@ if [ -f /usr/sbin/ufw ];then
|
||||
ufw allow 443/tcp
|
||||
ufw allow 888/tcp
|
||||
ufw allow 7200/tcp
|
||||
ufw allow 3306/tcp
|
||||
# ufw allow 3306/tcp
|
||||
# ufw allow 30000:40000/tcp
|
||||
|
||||
fi
|
||||
@@ -55,7 +54,7 @@ if [ ! -f /usr/sbin/ufw ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
|
||||
# fix:debian10 firewalld faq
|
||||
@@ -87,7 +86,7 @@ echo -e "\e[0;32mfix zlib1g-dev install question end\e[0m"
|
||||
#fix libunwind-dev fail
|
||||
echo -e "\e[0;32mfix libunwind-dev install question start\e[0m"
|
||||
Install_TmpFile=/tmp/debian-fix-libunwind-dev.txt
|
||||
apt install -y zlib1g-dev > ${Install_TmpFile}
|
||||
apt install -y libunwind-dev > ${Install_TmpFile}
|
||||
if [ "$?" != "0" ];then
|
||||
liblzma5_BASE_VER=$(cat ${Install_TmpFile} | grep liblzma-dev | awk -F "=" '{print $2}' | awk -F ")" '{print $1}')
|
||||
liblzma5_BASE_VER=`echo ${liblzma5_BASE_VER} | sed "s/^[ \s]\{1,\}//g;s/[ \s]\{1,\}$//g"`
|
||||
@@ -98,45 +97,12 @@ rm -rf ${Install_TmpFile}
|
||||
echo -e "\e[0;32mfix libunwind-dev install question end\e[0m"
|
||||
|
||||
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
|
||||
|
||||
if [ ! -f /usr/local/bin/pip3 ];then
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
fi
|
||||
|
||||
pip install --upgrade pip
|
||||
|
||||
sed -i "/mysqlclient/d" /www/server/mdserver-web/requirements.txt
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==21.1.2
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install pymongo
|
||||
pip3 install psutil
|
||||
pip3 install flask-socketio==5.2.0
|
||||
|
||||
if [ ! -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && python3 -m venv .
|
||||
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==21.1.2
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install pymongo
|
||||
pip3 install psutil
|
||||
pip3 install flask-socketio==5.2.0
|
||||
fi
|
||||
|
||||
|
||||
cd /www/server/mdserver-web && ./cli.sh start
|
||||
sleep 5
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT
|
||||
service iptables save
|
||||
|
||||
@@ -55,7 +55,7 @@ if [ "${isVersion}" == '' ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
firewall-cmd --reload
|
||||
fi
|
||||
@@ -79,23 +79,10 @@ yum -y install MySQL-python
|
||||
yum -y install python3-devel
|
||||
|
||||
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
if [ ! -f /usr/local/bin/pip3 ];then
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
fi
|
||||
|
||||
pip install --upgrade pip
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
|
||||
if [ ! -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && python3 -m venv .
|
||||
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
fi
|
||||
|
||||
|
||||
cd /www/server/mdserver-web && ./cli.sh start
|
||||
|
||||
@@ -36,6 +36,7 @@ if [ ! -d $DEV/server/lib ]; then
|
||||
cd $DEV/server/mdserver-web/scripts && ./lib.sh
|
||||
fi
|
||||
|
||||
pip3 install mysqlclient
|
||||
|
||||
chmod 755 $DEV/server/mdserver-web/data
|
||||
if [ -f $DEV/server/mdserver-web/bin/activate ];then
|
||||
@@ -44,6 +45,8 @@ else
|
||||
cd $DEV/server/mdserver-web && pip3 install -r $DEV/server/mdserver-web/requirements.txt
|
||||
fi
|
||||
|
||||
pip3 install mysqlclient
|
||||
|
||||
|
||||
cd $DEV/server/mdserver-web && ./cli.sh start
|
||||
cd $DEV/server/mdserver-web && ./cli.sh stop
|
||||
|
||||
@@ -31,7 +31,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT
|
||||
service iptables save
|
||||
|
||||
@@ -55,7 +55,7 @@ if [ ! -f /etc/init.d/iptables ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
|
||||
|
||||
@@ -74,46 +74,13 @@ yum install -y libevent libevent-devel libjpeg* libpng* gd* libxslt* unzip libmc
|
||||
yum install -y wget python-imaging libicu-devel zip bzip2-devel gcc libxml2 libxml2-dev libjpeg-devel libpng-devel libwebp libwebp-devel pcre pcre-devel
|
||||
yum install -y lsof net-tools
|
||||
yum install -y ncurses-devel mysql-devel cmake
|
||||
yum install -y MySQL-python
|
||||
yum install -y MySQL-python
|
||||
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
|
||||
if [ ! -f /usr/local/bin/pip3 ];then
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
fi
|
||||
|
||||
|
||||
pip install --upgrade pip
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==21.1.2
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install python-socketio==4.2.0
|
||||
pip3 install psutil==5.9.1
|
||||
pip3 install pymongo
|
||||
|
||||
|
||||
if [ ! -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && python3 -m venv .
|
||||
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==21.1.2
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install python-socketio==4.2.0
|
||||
pip3 install psutil==5.9.1
|
||||
pip3 install pymongo
|
||||
fi
|
||||
|
||||
|
||||
cd /www/server/mdserver-web && ./cli.sh start
|
||||
sleep 5
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ if [ -f /usr/sbin/ufw ];then
|
||||
ufw allow 443/tcp
|
||||
ufw allow 888/tcp
|
||||
ufw allow 7200/tcp
|
||||
ufw allow 3306/tcp
|
||||
# ufw allow 3306/tcp
|
||||
# ufw allow 30000:40000/tcp
|
||||
|
||||
fi
|
||||
@@ -46,7 +46,7 @@ if [ ! -f /usr/sbin/ufw ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
|
||||
# fix:debian10 firewalld faq
|
||||
@@ -64,44 +64,6 @@ cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
|
||||
if [ ! -f /usr/local/bin/pip3 ];then
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
fi
|
||||
|
||||
pip install --upgrade pip
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
pip install --upgrade setuptools
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==21.1.2
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install flask-socketio==5.2.0
|
||||
pip3 install flask-session==0.3.2
|
||||
pip3 install pymongo
|
||||
pip3 install psutil
|
||||
|
||||
|
||||
if [ ! -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && python3 -m venv .
|
||||
fi
|
||||
|
||||
if [ -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==20.9.0
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
#ubuntu 20 need
|
||||
pip3 install flask-socketio==5.2.0
|
||||
pip3 install flask-session==0.3.2
|
||||
pip3 install pymongo
|
||||
pip3 install psutil
|
||||
fi
|
||||
|
||||
|
||||
cd /www/server/mdserver-web && ./cli.sh start
|
||||
sleep 5
|
||||
|
||||
@@ -44,6 +44,9 @@ elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; th
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
|
||||
OSNAME='debian'
|
||||
apt update -y
|
||||
apt install -y devscripts
|
||||
apt install -y wget zip unzip
|
||||
apt install -y wget zip unzip
|
||||
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
|
||||
OSNAME='ubuntu'
|
||||
@@ -72,7 +75,7 @@ if [ $OSNAME != "macos" ];then
|
||||
fi
|
||||
|
||||
echo "use system version: ${OSNAME}"
|
||||
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/install/${OSNAME}.sh | bash
|
||||
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
|
||||
|
||||
chmod +x /www/server/mdserver-web/mw-cli
|
||||
if [ ! -e /usr/bin/mw-cli ]; then
|
||||
|
||||
@@ -44,6 +44,7 @@ elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; th
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
|
||||
OSNAME='debian'
|
||||
apt update -y
|
||||
apt install -y devscripts
|
||||
apt install -y wget zip unzip
|
||||
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
|
||||
@@ -73,7 +74,11 @@ if [ $OSNAME != "macos" ];then
|
||||
fi
|
||||
|
||||
echo "use system version: ${OSNAME}"
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install/${OSNAME}.sh | bash
|
||||
|
||||
|
||||
# cd /www/server/mdserver-web && bash ./scripts/install/debian.sh
|
||||
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
|
||||
# curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install/${OSNAME}.sh | bash
|
||||
|
||||
chmod +x /www/server/mdserver-web/mw-cli
|
||||
if [ ! -e /usr/bin/mw-cli ]; then
|
||||
|
||||
@@ -290,6 +290,7 @@ if [ "$OSNAME" == "macos" ]; then
|
||||
elif [ "$OSNAME" == "ubuntu" ] || [ "$OSNAME" == "debian" ]; then
|
||||
|
||||
apt install -y devscripts
|
||||
apt install -y net-tools
|
||||
|
||||
apt install -y libffi-dev
|
||||
apt install -y cmake automake make
|
||||
@@ -345,6 +346,7 @@ else
|
||||
yum install -y openssl openssl-devel
|
||||
yum install -y graphviz libxml2 libxml2-devel
|
||||
yum install -y sqlite-devel
|
||||
yum install -y mysql-devel
|
||||
yum install -y oniguruma oniguruma-devel
|
||||
yum install -y ImageMagick ImageMagick-devel
|
||||
|
||||
@@ -354,6 +356,52 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#面板需要的库
|
||||
|
||||
if [ ! -f /usr/local/bin/pip3 ];then
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
fi
|
||||
|
||||
pip install --upgrade pip
|
||||
pip3 install --upgrade setuptools
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==21.1.2
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install flask-session==0.3.2
|
||||
pip3 install pymongo
|
||||
pip3 install psutil
|
||||
pip3 install flask-socketio==5.2.0
|
||||
pip3 install mysqlclient
|
||||
|
||||
if [ ! -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && python3 -m venv .
|
||||
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate
|
||||
else
|
||||
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate
|
||||
fi
|
||||
|
||||
pip install --upgrade pip
|
||||
pip3 install --upgrade setuptools
|
||||
pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==21.1.2
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install flask-session==0.3.2
|
||||
pip3 install pymongo
|
||||
pip3 install psutil
|
||||
pip3 install flask-socketio==5.2.0
|
||||
pip3 install mysqlclient
|
||||
|
||||
|
||||
|
||||
##### common start #####
|
||||
|
||||
# Install_Libiconv
|
||||
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
echo "welcome to mdserver-web panel"
|
||||
|
||||
startTime=`date +%s`
|
||||
|
||||
if [ ! -d /www/server/mdserver-web ];then
|
||||
echo "mdserver-web not exist!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# openresty
|
||||
if [ ! -d /www/server/openresty ];then
|
||||
cd /www/server/mdserver-web/plugins/openresty && bash install.sh install 1.21.4.1
|
||||
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/openresty/index.py start
|
||||
else
|
||||
echo "openresty alreay exist!"
|
||||
fi
|
||||
|
||||
|
||||
# php
|
||||
if [ ! -d /www/server/php/71 ];then
|
||||
cd /www/server/mdserver-web/plugins/php && bash install.sh install 71
|
||||
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 71
|
||||
else
|
||||
echo "php71 alreay exist!"
|
||||
fi
|
||||
|
||||
# mysql
|
||||
if [ ! -d /www/server/mysql ];then
|
||||
cd /www/server/mdserver-web/plugins/mysql && bash install.sh install 5.5
|
||||
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql/index.py start 5.5
|
||||
else
|
||||
echo "mysql alreay exist!"
|
||||
fi
|
||||
|
||||
endTime=`date +%s`
|
||||
((outTime=(${endTime}-${startTime})/60))
|
||||
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
|
||||
|
||||
Executable
+89
@@ -0,0 +1,89 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
echo "welcome to mdserver-web panel"
|
||||
|
||||
startTime=`date +%s`
|
||||
|
||||
if [ ! -d /www/server/mdserver-web ];then
|
||||
echo "mdserver-web not exist!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# openresty
|
||||
if [ ! -d /www/server/openresty ];then
|
||||
cd /www/server/mdserver-web/plugins/openresty && bash install.sh install 1.21.4.1
|
||||
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/openresty/index.py start
|
||||
fi
|
||||
|
||||
|
||||
# php
|
||||
if [ ! -d /www/server/php/71 ];then
|
||||
cd /www/server/mdserver-web/plugins/php && bash install.sh install 71
|
||||
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 71
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# PHP_VER_LIST=(53 54 55 56 71 72 73 74 80 81)
|
||||
# # PHP_VER_LIST=(81)
|
||||
# for PHP_VER in ${PHP_VER_LIST[@]}; do
|
||||
# echo "php${PHP_VER} -- start"
|
||||
# cd $DIR/php$PHP_VER && sh install.sh
|
||||
# dir=$(ls -l $DIR/php$PHP_VER |awk '/^d/ {print $NF}')
|
||||
# for i in $dir
|
||||
# do
|
||||
# cd $DIR/php$PHP_VER/$i && sh install.sh $PHP_VER
|
||||
# done
|
||||
# echo "php${PHP_VER} -- end"
|
||||
# done
|
||||
|
||||
cd /www/server/mdserver-web/plugins/php && bash install.sh install 53
|
||||
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 53
|
||||
|
||||
cd /www/server/mdserver-web/plugins/php && bash install.sh install 54
|
||||
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 54
|
||||
|
||||
cd /www/server/mdserver-web/plugins/php && bash install.sh install 55
|
||||
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 55
|
||||
|
||||
cd /www/server/mdserver-web/plugins/php && bash install.sh install 56
|
||||
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 56
|
||||
cd /www/server/mdserver-web/plugins/php && bash install.sh install 70
|
||||
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 70
|
||||
cd /www/server/mdserver-web/plugins/php && bash install.sh install 71
|
||||
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 71
|
||||
|
||||
cd /www/server/mdserver-web/plugins/php && bash install.sh install 72
|
||||
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 72
|
||||
|
||||
cd /www/server/mdserver-web/plugins/php && bash install.sh install 73
|
||||
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 73
|
||||
|
||||
cd /www/server/mdserver-web/plugins/php && bash install.sh install 74
|
||||
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 74
|
||||
|
||||
cd /www/server/mdserver-web/plugins/php && bash install.sh install 80
|
||||
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 80
|
||||
|
||||
cd /www/server/mdserver-web/plugins/php && bash install.sh install 81
|
||||
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 81
|
||||
|
||||
|
||||
# mysql
|
||||
if [ ! -d /www/server/mysql ];then
|
||||
# cd /www/server/mdserver-web/plugins/mysql && bash install.sh install 5.7
|
||||
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql/index.py start 5.7
|
||||
|
||||
|
||||
# cd /www/server/mdserver-web/plugins/mysql && bash install.sh install 5.6
|
||||
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql/index.py start 5.6
|
||||
cd /www/server/mdserver-web/plugins/mysql && bash install.sh install 8.0
|
||||
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql/index.py start 8.0
|
||||
fi
|
||||
|
||||
endTime=`date +%s`
|
||||
((outTime=(${endTime}-${startTime})/60))
|
||||
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
|
||||
|
||||
+8
-3
@@ -9,13 +9,18 @@ startTime=`date +%s`
|
||||
_os=`uname`
|
||||
echo "use system: ${_os}"
|
||||
|
||||
if [ "$EUID" -ne 0 ]
|
||||
then echo "Please run as root!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
|
||||
sudo ln -sf /bin/bash /bin/sh
|
||||
ln -sf /bin/bash /bin/sh
|
||||
#sudo dpkg-reconfigure dash
|
||||
fi
|
||||
|
||||
if grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
|
||||
sudo ln -sf /bin/bash /bin/sh
|
||||
ln -sf /bin/bash /bin/sh
|
||||
fi
|
||||
|
||||
if [ ${_os} == "Darwin" ]; then
|
||||
@@ -52,7 +57,7 @@ rm -rf /tmp/mdserver-web-master
|
||||
|
||||
#pip uninstall public
|
||||
echo "use system version: ${OSNAME}"
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update/${OSNAME}.sh | bash
|
||||
cd /www/server/mdserver-web && bash scripts/update/${OSNAME}.sh
|
||||
|
||||
endTime=`date +%s`
|
||||
((outTime=($endTime-$startTime)/60))
|
||||
|
||||
@@ -11,39 +11,10 @@ fi
|
||||
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
|
||||
|
||||
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
|
||||
if [ ! -f /usr/local/bin/pip3 ];then
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
fi
|
||||
|
||||
|
||||
pip install --upgrade pip
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
pip3 install flask-socketio==5.2.0
|
||||
|
||||
#venv
|
||||
if [ ! -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && python3 -m venv .
|
||||
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==21.1.2
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install flask-socketio==5.2.0
|
||||
pip3 install psutil==5.9.1
|
||||
pip3 install pymongo
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ -f /etc/init.d/mw ]; then
|
||||
sh /etc/init.d/mw stop && rm -rf /www/server/mdserver-web/scripts/init.d/mw && rm -rf /etc/init.d/mw
|
||||
fi
|
||||
|
||||
@@ -10,7 +10,6 @@ fi
|
||||
|
||||
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
|
||||
|
||||
|
||||
yum install -y curl-devel libmcrypt libmcrypt-devel python3-devel
|
||||
|
||||
|
||||
@@ -18,33 +17,6 @@ cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
|
||||
if [ ! -f /usr/local/bin/pip3 ];then
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
fi
|
||||
|
||||
#venv
|
||||
if [ ! -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && python3 -m venv .
|
||||
fi
|
||||
|
||||
|
||||
if [ -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
else
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
fi
|
||||
|
||||
pip install --upgrade pip
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==21.1.2
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install python-socketio==4.2.0
|
||||
pip3 install psutil==5.9.1
|
||||
pip3 install pymongo
|
||||
|
||||
|
||||
if [ -f /etc/init.d/mw ]; then
|
||||
sh /etc/init.d/mw stop && rm -rf /www/server/mdserver-web/scripts/init.d/mw && rm -rf /etc/init.d/mw
|
||||
fi
|
||||
|
||||
@@ -4,59 +4,14 @@ export PATH
|
||||
LANG=en_US.UTF-8
|
||||
|
||||
|
||||
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
#venv
|
||||
if [ ! -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && python3 -m venv .
|
||||
fi
|
||||
|
||||
if [ ! -f /usr/local/bin/pip3 ];then
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
fi
|
||||
|
||||
pip install --upgrade pip
|
||||
pip install --upgrade setuptools
|
||||
|
||||
sed -i "/mysqlclient/d" /www/server/mdserver-web/requirements.txt
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==21.1.2
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install flask-socketio==5.2.0
|
||||
pip3 install pymongo
|
||||
pip3 install psutil
|
||||
|
||||
|
||||
if [ ! -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && python3 -m venv .
|
||||
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate
|
||||
|
||||
pip install --upgrade pip
|
||||
pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
pip install --upgrade setuptools
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==21.1.2
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install flask-socketio==5.2.0
|
||||
pip3 install pymongo
|
||||
pip3 install psutil
|
||||
fi
|
||||
|
||||
if [ -f /etc/init.d/mw ];then
|
||||
sh /etc/init.d/mw stop && rm -rf /www/server/mdserver-web/scripts/init.d/mw && rm -rf /etc/init.d/mw
|
||||
fi
|
||||
|
||||
|
||||
|
||||
echo -e "stop mw"
|
||||
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
|
||||
|
||||
|
||||
@@ -10,34 +10,12 @@ fi
|
||||
|
||||
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
|
||||
|
||||
wget -O /tmp/master.zip https://codeload.github.com/midoks/mdserver-web/zip/master
|
||||
cd /tmp && unzip /tmp/master.zip
|
||||
/usr/bin/cp -rf /tmp/mdserver-web-master/* /www/server/mdserver-web
|
||||
rm -rf /tmp/master.zip
|
||||
rm -rf /tmp/mdserver-web-master
|
||||
|
||||
|
||||
yum install -y curl-devel libmcrypt libmcrypt-devel python36-devel
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
#venv
|
||||
if [ ! -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && python3 -m venv .
|
||||
fi
|
||||
|
||||
if [ ! -f /usr/local/bin/pip3 ];then
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
fi
|
||||
|
||||
if [ -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
else
|
||||
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
fi
|
||||
|
||||
if [ -f /etc/init.d/mw ];then
|
||||
sh /etc/init.d/mw stop && rm -rf /www/server/mdserver-web/scripts/init.d/mw && rm -rf /etc/init.d/mw
|
||||
|
||||
@@ -18,32 +18,6 @@ cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
|
||||
if [ ! -f /usr/local/bin/pip3 ];then
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
fi
|
||||
|
||||
#venv
|
||||
if [ ! -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && python3 -m venv .
|
||||
fi
|
||||
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
|
||||
if [ ! -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && python3 -m venv .
|
||||
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==21.1.2
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install python-socketio==4.2.0
|
||||
pip3 install psutil==5.9.1
|
||||
pip3 install pymongo
|
||||
fi
|
||||
|
||||
|
||||
if [ -f /etc/init.d/mw ]; then
|
||||
sh /etc/init.d/mw stop && rm -rf /www/server/mdserver-web/scripts/init.d/mw && rm -rf /etc/init.d/mw
|
||||
|
||||
@@ -9,45 +9,6 @@ cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
|
||||
if [ ! -f /usr/local/bin/pip3 ];then
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
fi
|
||||
|
||||
pip install --upgrade pip
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
pip install --upgrade setuptools
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==21.1.2
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install flask-socketio==5.2.0
|
||||
pip3 install flask-session==0.3.2
|
||||
pip3 install pymongo
|
||||
pip3 install psutil
|
||||
|
||||
|
||||
if [ ! -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && python3 -m venv .
|
||||
fi
|
||||
|
||||
if [ -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
pip3 install gunicorn==20.1.0
|
||||
pip3 install gevent==20.9.0
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
#ubuntu 20 need
|
||||
pip3 install flask-socketio==5.2.0
|
||||
pip3 install flask-session==0.3.2
|
||||
pip3 install pymongo
|
||||
pip3 install psutil
|
||||
fi
|
||||
|
||||
|
||||
if [ -f /etc/init.d/mw ];then
|
||||
sh /etc/init.d/mw stop && rm -rf /www/server/mdserver-web/scripts/init.d/mw && rm -rf /etc/init.d/mw
|
||||
fi
|
||||
|
||||
@@ -9,13 +9,18 @@ startTime=`date +%s`
|
||||
_os=`uname`
|
||||
echo "use system: ${_os}"
|
||||
|
||||
if [ "$EUID" -ne 0 ]
|
||||
then echo "Please run as root!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
|
||||
sudo ln -sf /bin/bash /bin/sh
|
||||
ln -sf /bin/bash /bin/sh
|
||||
#sudo dpkg-reconfigure dash
|
||||
fi
|
||||
|
||||
if grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
|
||||
sudo ln -sf /bin/bash /bin/sh
|
||||
ln -sf /bin/bash /bin/sh
|
||||
fi
|
||||
|
||||
if [ ${_os} == "Darwin" ]; then
|
||||
@@ -52,7 +57,7 @@ rm -rf /tmp/mdserver-web-master
|
||||
|
||||
#pip uninstall public
|
||||
echo "use system version: ${OSNAME}"
|
||||
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/update/${OSNAME}.sh | bash
|
||||
cd /www/server/mdserver-web && bash scripts/update/${OSNAME}.sh
|
||||
|
||||
endTime=`date +%s`
|
||||
((outTime=($endTime-$startTime)/60))
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user