mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
update
This commit is contained in:
+22
-17
@@ -53,7 +53,7 @@ def checkArgs(data, ck=[]):
|
||||
|
||||
|
||||
def getConf():
|
||||
return mw.getServerDir() + '/web_conf/nginx/vhost/phpmyadmin.conf'
|
||||
return mw.getServerDir() + '/web_conf/nginx/vhost/pgadmin.conf'
|
||||
|
||||
|
||||
def getConfInc():
|
||||
@@ -225,19 +225,17 @@ def delPort():
|
||||
return True
|
||||
|
||||
|
||||
def start():
|
||||
initCfg()
|
||||
openPort()
|
||||
def initReplace():
|
||||
|
||||
pma_dir = getServerDir() + "/phpmyadmin"
|
||||
pma_dir = getServerDir() + "/pgadmin"
|
||||
if os.path.exists(pma_dir):
|
||||
rand_str = mw.getRandomString(6)
|
||||
rand_str = rand_str.lower()
|
||||
pma_dir_dst = pma_dir + "_" + rand_str
|
||||
mw.execShell("mv " + pma_dir + " " + pma_dir_dst)
|
||||
setCfg('path', 'phpmyadmin_' + rand_str)
|
||||
setCfg('path', 'pgadmin_' + rand_str)
|
||||
|
||||
file_tpl = getPluginDir() + '/conf/phpmyadmin.conf'
|
||||
file_tpl = getPluginDir() + '/conf/pgadmin.conf'
|
||||
file_run = getConf()
|
||||
if not os.path.exists(file_run):
|
||||
centent = mw.readFile(file_tpl)
|
||||
@@ -253,17 +251,24 @@ def start():
|
||||
setCfg('password', password)
|
||||
mw.writeFile(pma_path, pass_cmd)
|
||||
|
||||
tmp = getServerDir() + "/" + getCfg()["path"] + '/tmp'
|
||||
if not os.path.exists(tmp):
|
||||
os.mkdir(tmp)
|
||||
mw.execShell("chown -R www:www " + tmp)
|
||||
# systemd
|
||||
systemDir = mw.systemdCfgDir()
|
||||
systemService = systemDir + '/pgadmin.service'
|
||||
|
||||
conf_run = getServerDir() + "/" + getCfg()["path"] + '/config.inc.php'
|
||||
if not os.path.exists(conf_run):
|
||||
conf_tpl = getPluginDir() + '/conf/config.inc.php'
|
||||
centent = mw.readFile(conf_tpl)
|
||||
centent = contentReplace(centent)
|
||||
mw.writeFile(conf_run, centent)
|
||||
if os.path.exists(systemDir) and not os.path.exists(systemService):
|
||||
systemServiceTpl = getPluginDir() + '/init.d/pgadmin.service.tpl'
|
||||
service_path = mw.getServerDir()
|
||||
content = mw.readFile(systemServiceTpl)
|
||||
content = content.replace('{$VERSION}', version)
|
||||
content = content.replace('{$SERVER_PATH}', service_path)
|
||||
mw.writeFile(systemService, se_content)
|
||||
mw.execShell('systemctl daemon-reload')
|
||||
|
||||
def start():
|
||||
initCfg()
|
||||
openPort()
|
||||
|
||||
initReplace()
|
||||
|
||||
log_a = accessLog()
|
||||
log_e = errorLog()
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# It's not recommended to modify this file in-place, because it
|
||||
# will be overwritten during upgrades. If you want to customize,
|
||||
# the best way is to use the "systemctl edit" command.
|
||||
# systemctl daemon-reload
|
||||
|
||||
[Unit]
|
||||
Description=pgadmin service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=gunicorn --bind unix:/tmp/pgadmin4.sock --workers=1 --threads=25 --chdir {$SERVER_PATH}/lib/python3.10/dist-packages/pgadmin4 pgAdmin4:app
|
||||
ExecReload=/bin/kill -USR2 $MAINPID
|
||||
PrivateTmp=false
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -18,6 +18,9 @@ echo "python:$P_VER"
|
||||
# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/pgadmin && bash install.sh install 4
|
||||
# cd /www/server/mdserver-web/plugins/pgadmin && bash install.sh install 4
|
||||
|
||||
# source /www/server/pgadmin/bin/activate
|
||||
# python /www/server/pgadmin/lib/python3.10/site-packages/pgadmin4/setup.py
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
if [ "$sys_os" == "Darwin" ];then
|
||||
@@ -77,7 +80,9 @@ Install_pgadmin()
|
||||
source ${PG_DIR}/bin/activate
|
||||
fi
|
||||
|
||||
pip install pgadmin
|
||||
pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v8.10/pip/pgadmin4-8.10-py3-none-any.whl
|
||||
|
||||
|
||||
|
||||
VER=$1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user