diff --git a/plugins/walle/ico.png b/plugins/walle/ico.png deleted file mode 100644 index c44b9dc4b..000000000 Binary files a/plugins/walle/ico.png and /dev/null differ diff --git a/plugins/walle/index.html b/plugins/walle/index.html deleted file mode 100755 index 5a15f856a..000000000 --- a/plugins/walle/index.html +++ /dev/null @@ -1,22 +0,0 @@ -
-
-
-

服务

-

自启动

-

配置[Python]

-

命令

-

日志

-

说明

-
-
-
-
-
-
- - \ No newline at end of file diff --git a/plugins/walle/index.py b/plugins/walle/index.py deleted file mode 100755 index be5e524e4..000000000 --- a/plugins/walle/index.py +++ /dev/null @@ -1,211 +0,0 @@ -# coding: utf-8 - -import time -import random -import os -import json -import re -import sys -import subprocess - -sys.path.append(os.getcwd() + "/class/core") -import mw - -app_debug = False -if mw.isAppleSystem(): - app_debug = True - - -def getPluginName(): - return 'walle' - - -def getPluginDir(): - return mw.getPluginDir() + '/' + getPluginName() - - -def getServerDir(): - return mw.getServerDir() + '/' + getPluginName() - - -def getInitDFile(): - if app_debug: - return '/tmp/' + getPluginName() - return '/etc/init.d/' + getPluginName() - - -def getInitDTpl(): - return getPluginDir() + "/init.d/" + getPluginName() + ".tpl" - - -def getLog(): - return getServerDir() + "/code/logs/error.log" - - -def getArgs(): - args = sys.argv[2:] - tmp = {} - args_len = len(args) - - if args_len == 1: - t = args[0].strip('{').strip('}') - t = t.split(':') - tmp[t[0]] = t[1] - elif args_len > 1: - for i in range(len(args)): - t = args[i].split(':') - tmp[t[0]] = t[1] - - 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 status(): - pn = getPluginName() - cmd = "ps -ef|grep 'waller.py' | grep -v grep | awk '{print $2}'" - data = mw.execShell(cmd) - if data[0] == '': - return 'stop' - return 'start' - - -def initDreplace(): - - file_tpl = getInitDTpl() - service_path = os.path.dirname(os.getcwd()) - - initD_path = getServerDir() + '/init.d' - if not os.path.exists(initD_path): - os.mkdir(initD_path) - - file_bin = initD_path + '/' + getPluginName() - if not os.path.exists(file_bin): - content = mw.readFile(file_tpl) - content = content.replace('{$SERVER_PATH}', service_path) - mw.writeFile(file_bin, content) - mw.execShell('chmod +x ' + file_bin) - - return file_bin - - -def runShell(shell): - data = mw.execShell(shell) - return data - - -def start(): - file = initDreplace() - cmd = file + ' start' - data = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - return 'ok' - - -def stop(): - file = initDreplace() - data = runShell(file + ' stop') - if data[1] == '': - return 'ok' - return 'fail' - - -def restart(): - file = initDreplace() - cmd = file + ' restart' - data = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - return 'ok' - - -def reload(): - file = initDreplace() - data = runShell(file + ' reload') - - solr_log = getServerDir() + "/code/logs/walle.log" - mw.writeFile(solr_log, "") - - if data[1] == '': - return 'ok' - return 'fail' - - -def initdStatus(): - initd_bin = getInitDFile() - if os.path.exists(initd_bin): - return 'ok' - return 'fail' - - -def initdInstall(): - import shutil - - source_bin = initDreplace() - initd_bin = getInitDFile() - shutil.copyfile(source_bin, initd_bin) - mw.execShell('chmod +x ' + initd_bin) - - if not app_debug: - mw.execShell('chkconfig --add ' + getPluginName()) - return 'ok' - - -def initdUinstall(): - if not app_debug: - mw.execShell('chkconfig --del ' + getPluginName()) - - initd_bin = getInitDFile() - - if os.path.exists(initd_bin): - os.remove(initd_bin) - return 'ok' - - -def prodConf(): - return getServerDir() + "/code/walle/config/settings_prod.py" - - -def initEnv(): - cmd = "cd " + getServerDir() + "/code" + " && sh admin.sh init" - data = mw.execShell(cmd) - return "shell:
" + data[0] + "
" + " error:
" + data[1] - - -def initData(): - cmd = "cd " + getServerDir() + "/code" + " && sh admin.sh migration" - data = mw.execShell(cmd) - return "shell:
" + data[0] + "
" + " error:
" + data[1] -# rsyncdReceive -if __name__ == "__main__": - func = sys.argv[1] - if func == 'status': - print(status()) - elif func == 'start': - print(start()) - elif func == 'stop': - print(stop()) - elif func == 'restart': - print(restart()) - elif func == 'reload': - print(reload()) - elif func == 'initd_status': - print(initdStatus()) - elif func == 'initd_install': - print(initdInstall()) - elif func == 'initd_uninstall': - print(initdUinstall()) - elif func == 'run_log': - print(getLog()) - elif func == 'prod_conf': - print(prodConf()) - elif func == 'init_env': - print(initEnv()) - elif func == 'init_data': - print(initData()) - else: - print('error') diff --git a/plugins/walle/info.json b/plugins/walle/info.json deleted file mode 100644 index b3eb2643d..000000000 --- a/plugins/walle/info.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "id":12, - "title":"walle", - "tip":"soft", - "name":"walle", - "type":"扩展", - "ps":"一款开源的代码部署管理工具", - "versions":"1.0", - "shell":"install.sh", - "checks":"server/walle", - "path": "server/walle", - "author":"midoks", - "home":"", - "date":"2019-12-05", - "pid":"3" -} \ No newline at end of file diff --git a/plugins/walle/init.d/walle.tpl b/plugins/walle/init.d/walle.tpl deleted file mode 100644 index 4e6523266..000000000 --- a/plugins/walle/init.d/walle.tpl +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# chkconfig: 2345 55 25 -# description: Walle Service - -### BEGIN INIT INFO -# Provides: bt -# Required-Start: $all -# Required-Stop: $all -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: starts walle -# Description: starts the walle -### END INIT INFO - - -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin - -app_path={$SERVER_PATH}/walle/code - - -walle_start(){ - isStart=`ps aux | grep 'waller.py'| grep -v grep | awk '{print $2}'` - if [ "$isStart" == '' ];then - echo -e "Starting walle... \c" - cd $app_path && python waller.py >> $app_path/logs/walle.log 2>&1 & - sleep 0.3 - isStart=`ps aux | grep 'waller.py' | grep -v grep | awk '{print $2}'` - sleep 0.2 - if [ "$isStart" == '' ];then - echo -e "\033[31mfailed\033[0m" - echo '------------------------------------------------------' - tail -n 20 $app_path/logs/walle.log - echo '------------------------------------------------------' - echo -e "\033[31mError: walle service startup failed.\033[0m" - return - fi - echo -e "\033[32mdone\033[0m" - else - echo "Starting ... walle (pid $isStart) already running" - fi -} - - -walle_stop() -{ - echo -e "Stopping walle... \c"; - pids=$(ps aux | grep 'waller.py'|grep -v grep|awk '{print $2}') - arr=($pids) - - for p in ${arr[@]} - do - kill -9 $p - done - echo -e "\033[32mdone\033[0m" - - echo -e "Stopping walle... \c"; - arr=`ps aux | grep 'waller.py' | grep -v grep | awk '{print $2}'` - for p in ${arr[@]} - do - kill -9 $p &>/dev/null - done - - if [ -f $pidfile ];then - rm -f $pidfile - fi - echo -e "\033[32mdone\033[0m" -} - - - -walle_reload() -{ - isStart=$(ps aux | grep 'waller.py' | grep -v grep | awk '{print $2}') - - if [ "$isStart" != '' ];then - echo -e "Reload walle... \c"; - arr=`ps aux|grep 'waller.py' |grep -v grep|awk '{print $2}'` - for p in ${arr[@]} - do - kill -9 $p - done - cd $app_path && nohup python waller.py >> $app_path/logs/walle.log 2>&1 & - isStart=`ps aux | grep 'waller.py' | grep -v grep | awk '{print $2}'` - if [ "$isStart" == '' ];then - echo -e "\033[31mfailed\033[0m" - echo '------------------------------------------------------' - tail -n 20 $app_path/logs/walle.log - echo '------------------------------------------------------' - echo -e "\033[31mError: walle service startup failed.\033[0m" - return - fi - echo -e "\033[32mdone\033[0m" - else - echo -e "\033[31m walle not running\033[0m" - mw_start - fi -} - - -error_logs() -{ - tail -n 100 ${app_path}/logs/walle.log -} - -case "$1" in - 'start') walle_start;; - 'stop') walle_stop;; - 'reload') walle_reload;; - 'restart') - walle_stop - walle_start;; - 'logs') error_logs;; -esac - diff --git a/plugins/walle/install.sh b/plugins/walle/install.sh deleted file mode 100644 index 1f1522f98..000000000 --- a/plugins/walle/install.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - - -curPath=`pwd` -rootPath=$(dirname "$curPath") -rootPath=$(dirname "$rootPath") -serverPath=$(dirname "$rootPath") - - -install_tmp=${rootPath}/tmp/mw_install.pl - - -Install_walle() -{ - echo '正在安装脚本文件...' > $install_tmp - mkdir -p $serverPath/walle - echo '1.0' > $serverPath/walle/version.pl - - if [ ! -f $serverPath/source/v2.0.1.tar.gz ];then - wget -O $serverPath/source/v2.0.1.tar.gz https://github.com/meolu/walle-web/archive/v2.0.1.tar.gz - fi - - if [ ! -d $serverPath/source/walle-web-2.0.1 ];then - cd $serverPath/source && tar -zxvf v2.0.1.tar.gz - fi - - if [ ! -d $serverPath/walle/code ];then - mkdir -p $serverPath/walle/code - cp -rf $serverPath/source/walle-web-2.0.1/* $serverPath/walle/code/ - fi - - cd $serverPath/walle/code && pip install -r $serverPath/walle/code/requirements/prod.txt - - echo '安装完成' > $install_tmp - -} - -Uninstall_walle() -{ - rm -rf $serverPath/walle - echo "卸载完成" > $install_tmp -} - -action=$1 -if [ "${1}" == 'install' ];then - Install_walle -else - Uninstall_walle -fi \ No newline at end of file diff --git a/plugins/walle/js/walle.js b/plugins/walle/js/walle.js deleted file mode 100755 index c0bf3cd75..000000000 --- a/plugins/walle/js/walle.js +++ /dev/null @@ -1,99 +0,0 @@ -function str2Obj(str){ - var data = {}; - kv = str.split('&'); - for(i in kv){ - v = kv[i].split('='); - data[v[0]] = v[1]; - } - return data; -} - -function pPost(method,args,callback, title){ - var _args = null; - if (typeof(args) == 'string'){ - _args = JSON.stringify(str2Obj(args)); - } else { - _args = JSON.stringify(args); - } - - var _title = '正在获取...'; - if (typeof(title) != 'undefined'){ - _title = title; - } - - var loadT = layer.msg(_title, { icon: 16, time: 0, shade: 0.3 }); - $.post('/plugins/run', {name:'walle', func:method, args:_args}, function(data) { - layer.close(loadT); - if (!data.status){ - layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']}); - return; - } - if(typeof(callback) == 'function'){ - callback(data); - } - },'json'); -} - -function pPostCallbak(method, version, args,callback){ - var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); - - var req_data = {}; - req_data['name'] = 'walle'; - req_data['func'] = method; - args['version'] = version; - - if (typeof(args) == 'string'){ - req_data['args'] = JSON.stringify(str2Obj(args)); - } else { - req_data['args'] = JSON.stringify(args); - } - - $.post('/plugins/callback', req_data, function(data) { - layer.close(loadT); - if (!data.status){ - layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']}); - return; - } - - if(typeof(callback) == 'function'){ - callback(data); - } - },'json'); -} - -function initEnv(){ - pPost('init_env', {}, function(data){ - layer.msg(data.data,{icon:1,time:6000,shade: [0.3, '#000']}); - },'初始化环境'); -} - -function initData(){ - pPost('init_data', {}, function(data){ - layer.msg(data.data,{icon:1,time:6000,shade: [0.3, '#000']}); - },'初始化数据'); -} - - -function pluginCmd(){ - var serviceCon ='

当前可以运行的命令:

\ -
\ - \ - \ -
'; - $(".soft-man-con").html(serviceCon); -} - - - - -function pRead(){ - var readme = ''; - - $('.soft-man-con').html(readme); -} \ No newline at end of file