From 817c99f1370252a487f48455bcc423058a473e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=89=91=E5=AD=90=E4=BB=99=E6=9C=BA?= Date: Thu, 6 Jan 2022 17:23:58 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E9=83=A8=E7=BD=B2=E4=B8=BAasgi;=202.=20?= =?UTF-8?q?=E8=A7=A3=E5=86=B3panic=E8=A1=A8=EF=BC=8C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=8F=82=E6=95=B0=E8=BF=94=E5=9B=9E=E9=94=99?= =?UTF-8?q?=E8=AF=AF=203.=20=E4=BF=AE=E5=A4=8D=E5=AE=95=E6=9C=BA=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5dmesg=E6=98=BE=E7=A4=BA=E6=B7=B7=E4=B9=B1?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=204.=20=E5=88=A0=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E7=9A=84django=E5=8E=9F=E7=94=9Fapp=205.=20=E6=B8=85?= =?UTF-8?q?=E7=90=86=E6=97=A0=E7=94=A8=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 +-- package.sh | 2 +- script/node/monitor/node_exporter_deploy.sh | 2 + sysom_api/apps/__init__.py | 1 - sysom_api/apps/accounts/authentication.py | 1 - sysom_api/apps/accounts/permissions.py | 1 - sysom_api/apps/monitor/urls.py | 1 - sysom_api/apps/task/seriaizer.py | 1 - sysom_api/apps/task/urls.py | 1 - sysom_api/apps/vmcore/views.py | 11 +++-- sysom_api/conf/dev_constant.py | 1 - sysom_api/conf/pro_constant.py | 1 - sysom_api/conf/test_constant.py | 1 - sysom_api/consumer/consumers.py | 27 ---------- sysom_api/lib/paginations.py | 1 - sysom_api/lib/ssh.py | 41 +--------------- sysom_api/lib/utils.py | 1 - sysom_api/service_scripts/pingtrace | 49 +++++++++++++++++++ sysom_api/sysom/asgi.py | 8 ++- sysom_api/sysom/settings.py | 37 +------------- sysom_api/sysom/urls.py | 2 - sysom_api/uwsgi.ini | 36 +++----------- sysom_web/src/pages/vmcore/Detail/index.jsx | 26 +++++----- .../vmcore/components/VmcoreTableList.jsx | 16 ++---- sysom_web/src/pages/vmcore/list/index.jsx | 3 +- tools/deploy/deploy.sh | 1 + tools/deploy/sysom-uwsgi.ini | 9 ++++ tools/deploy/sysom.ini | 9 ++-- 28 files changed, 111 insertions(+), 186 deletions(-) create mode 100755 sysom_api/service_scripts/pingtrace create mode 100644 tools/deploy/sysom-uwsgi.ini diff --git a/README.md b/README.md index 2557143a..deb9efbb 100644 --- a/README.md +++ b/README.md @@ -29,10 +29,7 @@ ``` tar xf sysomRelease-20211207022031.tar.gz cd sysomRelease-20211207022031 - # 使用deploy.sh脚本部署项目,需要带三个参数, - # arg1 : 部署目录, - # arg2 : 内网IP(主要是方便内网通讯,用户需要保证内网能通) - # arg3 : 外网IP(浏览器可以访问到的IP地址) - bash deploy.sh /usr/local/sysom 192.168.100.100 100.100.22.22 + # 默认部署在 /home/sysom 目录,可以接参数自定义安装目录, + bash deploy.sh /usr/local/sysom ``` diff --git a/package.sh b/package.sh index 15ea3860..25ed686c 100644 --- a/package.sh +++ b/package.sh @@ -8,7 +8,7 @@ SCRIPTDIR=script TOOLSDIR=tools # build web pushd sysom_web -yarn add umi +yarn yarn build popd diff --git a/script/node/monitor/node_exporter_deploy.sh b/script/node/monitor/node_exporter_deploy.sh index 4838acc7..f5660b85 100755 --- a/script/node/monitor/node_exporter_deploy.sh +++ b/script/node/monitor/node_exporter_deploy.sh @@ -6,6 +6,8 @@ NODE_EXPORTER_ARCH=linux-amd64 NODE_EXPORTER_PKG=node_exporter-${NODE_EXPORTER_VER}.${NODE_EXPORTER_ARCH} NODE_EXPORTER_TAR=${NODE_EXPORTER_PKG}.tar.gz + +exit 0 ##设置node_exporter开机自动启动 cat << EOF > node_exporter.service [Unit] diff --git a/sysom_api/apps/__init__.py b/sysom_api/apps/__init__.py index 1a6daa80..94acac9e 100644 --- a/sysom_api/apps/__init__.py +++ b/sysom_api/apps/__init__.py @@ -3,6 +3,5 @@ @File : __init__.py.py @Time : 2021/11/22 10:36 @Author : DM -@Email : smmic@isoftstone.com @Software: PyCharm """ diff --git a/sysom_api/apps/accounts/authentication.py b/sysom_api/apps/accounts/authentication.py index 81044df9..f6aca38a 100644 --- a/sysom_api/apps/accounts/authentication.py +++ b/sysom_api/apps/accounts/authentication.py @@ -3,7 +3,6 @@ @File : authentication.py @Time : 2021/10/29 11:04 @Author : DM -@Email : smmic@isoftstone.com @Software: PyCharm """ import logging diff --git a/sysom_api/apps/accounts/permissions.py b/sysom_api/apps/accounts/permissions.py index 26aaa966..f64953d8 100644 --- a/sysom_api/apps/accounts/permissions.py +++ b/sysom_api/apps/accounts/permissions.py @@ -3,7 +3,6 @@ @File : permissions.py @Time : 2021/11/9 13:53 @Author : DM -@Email : smmic@isoftstone.com @Software: PyCharm """ import logging diff --git a/sysom_api/apps/monitor/urls.py b/sysom_api/apps/monitor/urls.py index 66d90633..55dcad6f 100644 --- a/sysom_api/apps/monitor/urls.py +++ b/sysom_api/apps/monitor/urls.py @@ -3,7 +3,6 @@ @File : urls.py @Time : 2021/11/2 11:07 @Author : DM -@Email : smmic@isoftstone.com @Software: PyCharm """ diff --git a/sysom_api/apps/task/seriaizer.py b/sysom_api/apps/task/seriaizer.py index cb6894d2..d91dcae3 100644 --- a/sysom_api/apps/task/seriaizer.py +++ b/sysom_api/apps/task/seriaizer.py @@ -3,7 +3,6 @@ @File : seriaizer.py @Time : 2021/11/22 17:41 @Author : DM -@Email : smmic@isoftstone.com @Software: PyCharm """ from rest_framework import serializers diff --git a/sysom_api/apps/task/urls.py b/sysom_api/apps/task/urls.py index ba7e0712..e3eda515 100644 --- a/sysom_api/apps/task/urls.py +++ b/sysom_api/apps/task/urls.py @@ -3,7 +3,6 @@ @File : urls.py @Time : 2021/11/22 10:38 @Author : DM -@Email : smmic@isoftstone.com @Software: PyCharm """ from django.urls import path, include diff --git a/sysom_api/apps/vmcore/views.py b/sysom_api/apps/vmcore/views.py index 0459cdfe..d29a458b 100644 --- a/sysom_api/apps/vmcore/views.py +++ b/sysom_api/apps/vmcore/views.py @@ -1,4 +1,5 @@ import logging +from typing import Dict from django.shortcuts import render from drf_yasg.utils import swagger_auto_schema from rest_framework.request import Request @@ -122,8 +123,12 @@ class VmcoreViewSet(GenericViewSet, start_time=end_time + datetime.timedelta(days=-30) host_sum = models.Panic.objects.values('hostname').distinct().count() + total = 0 + if isinstance(data, Dict): + data = data['data'] + total = data['total'] if host_sum == 0: - return success(result=data['data'], total=data['total'], success=True, vmcore_30days=0, vmcore_7days=0, rate_30days=0, rate_7days=0) + return success(result=data, total=total, success=True, vmcore_30days=0, vmcore_7days=0, rate_30days=0, rate_7days=0) vmcores_sum_30 = models.Panic.objects.filter(core_time__range=(start_time,end_time)).count() hosts_sum_30 = models.Panic.objects.filter(core_time__range=(start_time,end_time)).count() @@ -131,13 +136,11 @@ class VmcoreViewSet(GenericViewSet, vmcores_sum_7 = models.Panic.objects.filter(core_time__range=(start_time,end_time)).values('hostname').distinct().count() hosts_sum_7 = models.Panic.objects.filter(core_time__range=(start_time,end_time)).values('hostname').distinct().count() - rate_30 = hosts_sum_30 / host_sum - rate7 = hosts_sum_7 /host_sum data['vmcore_30days'] = vmcores_sum_30 data['vmcore_7days'] = vmcores_sum_7 data['rate_30days'] = hosts_sum_30/host_sum data['rate_7days'] = hosts_sum_7/host_sum - return success(result=data['data'], total=data['total'], success=True, vmcore_30days=vmcores_sum_30, vmcore_7days=vmcores_sum_7, rate_30days=hosts_sum_30/host_sum, rate_7days=hosts_sum_7/host_sum) + return success(result=data, total=total, success=True, vmcore_30days=vmcores_sum_30, vmcore_7days=vmcores_sum_7, rate_30days=hosts_sum_30/host_sum, rate_7days=hosts_sum_7/host_sum) return success(result=data['data'], success=True) def update(self, request, *args, **kwargs): diff --git a/sysom_api/conf/dev_constant.py b/sysom_api/conf/dev_constant.py index 0e64d3da..8ff9b64f 100644 --- a/sysom_api/conf/dev_constant.py +++ b/sysom_api/conf/dev_constant.py @@ -3,7 +3,6 @@ @File : dev_constant.py @Time : 2021/11/3 14:18 @Author : DM -@Email : smmic@isoftstone.com @Software: PyCharm """ from . import BaseConstant diff --git a/sysom_api/conf/pro_constant.py b/sysom_api/conf/pro_constant.py index 8c74a969..d59f18b3 100644 --- a/sysom_api/conf/pro_constant.py +++ b/sysom_api/conf/pro_constant.py @@ -3,7 +3,6 @@ @File : pro_constant.py @Time : 2021/11/3 14:17 @Author : DM -@Email : smmic@isoftstone.com @Software: PyCharm """ from . import BaseConstant diff --git a/sysom_api/conf/test_constant.py b/sysom_api/conf/test_constant.py index e96114ff..28b9f34a 100644 --- a/sysom_api/conf/test_constant.py +++ b/sysom_api/conf/test_constant.py @@ -3,7 +3,6 @@ @File : test_constant.py @Time : 2021/11/3 14:22 @Author : DM -@Email : smmic@isoftstone.com @Software: PyCharm """ from . import BaseConstant diff --git a/sysom_api/consumer/consumers.py b/sysom_api/consumer/consumers.py index 9e7694a9..791a046e 100644 --- a/sysom_api/consumer/consumers.py +++ b/sysom_api/consumer/consumers.py @@ -18,33 +18,6 @@ def get_host_instance(model, **kwargs): return model.objects.filter(**kwargs).first() -class ExecConsumer(WebsocketConsumer): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.rds = get_redis_connection() - - def connect(self): - self.accept() - - def disconnect(self, code): - self.send(text_data="disconnect") - self.rds.close() - self.close() - - def get_response(self): - token = self.scope['url_route']['kwargs']['token'] - response = self.rds.brpop(token, timeout=5) # 移除并获取最后一个元素 - return response[1] if response else None - - def receive(self, **kwargs): - response = self.get_response() - while response: - data = response.decode() - self.send(text_data=data) - response = self.get_response() - self.send(text_data='pong') - - class SshConsumer(WebsocketConsumer): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/sysom_api/lib/paginations.py b/sysom_api/lib/paginations.py index 203dbb0b..b14639bb 100644 --- a/sysom_api/lib/paginations.py +++ b/sysom_api/lib/paginations.py @@ -2,7 +2,6 @@ @File: paginations.py @Time: 2021-12-14 13:46:02 @Author: DM -@Email: wb-msm261421@alibaba-inc.com @Desc: Local Paginations Class ''' diff --git a/sysom_api/lib/ssh.py b/sysom_api/lib/ssh.py index aea2f3b1..671e74a5 100644 --- a/sysom_api/lib/ssh.py +++ b/sysom_api/lib/ssh.py @@ -14,11 +14,9 @@ class SSH: username='root', pkey=None, password=None, - default_env=None, connect_timeout=10 ): self.client = None - self.default_env = self.make_env_command(default_env) self.arguments = { 'hostname': hostname, 'port': port, @@ -55,47 +53,12 @@ class SSH: if exit_code != 0: raise Exception(f'add public key error: {out}') - def exec_command(self, command, environment=None): + def exec_command(self, command): ssh_session = self.client.get_transport().open_session() - if environment: - ssh_session.update_environment(environment) ssh_session.set_combine_stderr(True) ssh_session.exec_command(command) stdout = ssh_session.makefile("rb", -1) - return ssh_session.recv_exit_status(), self.decode(stdout.read()) - - def put_file(self, local_path, remote_path): - with self as cli: - sftp = cli.client.open_sftp() - sftp.put(local_path, remote_path) - - def get_file(self, local_path, remote_path): - with self as cli: - sftp = cli.client.open_sftp() - sftp.get(remote_path, local_path) - - def remove_file(self, path): - sftp = self.client.open_sftp() - sftp.remove(path) - - def make_env_command(self, environment): - if not environment: - return None - str_envs = [] - for k, v in environment.items(): - k = k.replace('-', '_') - if isinstance(v, str): - v = v.replace("'", "'\"'\"'") - str_envs.append(f"{k}='{v}'") - str_envs = ' '.join(str_envs) - return f'export {str_envs}' - - def decode(self, content): - try: - content = content.decode() - except UnicodeDecodeError: - content = content.decode(encoding='GBK', errors='ignore') - return content + return ssh_session.recv_exit_status(), stdout.read().decode() def __enter__(self): self.get_client() diff --git a/sysom_api/lib/utils.py b/sysom_api/lib/utils.py index 9e0ea8bc..dcd3baad 100644 --- a/sysom_api/lib/utils.py +++ b/sysom_api/lib/utils.py @@ -4,7 +4,6 @@ @File : utils.py @Time : 2021/10/28 11:09 @Author : DM -@Email : smmic@isoftstone.com @Software: PyCharm """ import uuid as UUID diff --git a/sysom_api/service_scripts/pingtrace b/sysom_api/service_scripts/pingtrace new file mode 100755 index 00000000..c63d392c --- /dev/null +++ b/sysom_api/service_scripts/pingtrace @@ -0,0 +1,49 @@ +#!/usr/bin/python3 +# coding=utf-8 +import json +import sys + +############################################################################### +## 如前端入参是这个: +## { +## "源虚拟机私网IP":"192.168.1.101", +## "目标虚拟机私网IP":"192.168.1.102", +## "追踪包数":"100", +## "间隔毫秒数":"10", +## "报文协议":"ICMP" +## } +## 解析参数方法: +## sysak pingtrace -s -t 6 +## -t 6 来自 “追踪包数” * "间隔毫秒数” / 1000 + 5 +## 本命令运行在“目标虚拟机私网ip” +## +## sysak pingtrace_raw -c 192.168.1.102 -t 2 -i 10000 -C 100 -o log +## -c 192.168.1.102 来自 “目标虚拟机私网ip” +## -t 2 来自 “追踪包数” * "间隔毫秒数” / 1000 + 1 +## -i 10000 来自 “间隔毫秒数”* 1000 +## -C 100 来自 “追踪包数” +## 本命令运行在“源虚拟机私网ip” +############################################################################### + +args = json.loads(sys.argv[1]) +result = {} +result['commands'] = [] + +cmd0_arg = int(int(args["追踪包数"]) * int(args["间隔毫秒数"]) / 1000) + 5 +cmd0 = {} +cmd0['instance'] = args["源虚拟机私网IP"] +cmd0['cmd'] = "sysak pingtrace -s -t "+str(cmd0_arg) + +cmd1 = {} +cmd1['instance'] = args["目标虚拟机私网IP"] +cmd1_arg_c = args["目标虚拟机私网IP"] +cmd1_arg_t = str(cmd0_arg - 4) +cmd1_arg_i = str(int(args["间隔毫秒数"]) * 1000) +cmd1_arg_C = args["追踪包数"] +cmd1['cmd'] = "sysak pingtrace_raw -c "+cmd1_arg_c+" -t "+cmd1_arg_t+" -i "+cmd1_arg_i+" -C "+cmd1_arg_C+" -o log" + +result['commands'].append(cmd0) +result['commands'].append(cmd1) + +data = json.dumps(result) +print(data) diff --git a/sysom_api/sysom/asgi.py b/sysom_api/sysom/asgi.py index 03e5ba85..7c029ddd 100644 --- a/sysom_api/sysom/asgi.py +++ b/sysom_api/sysom/asgi.py @@ -6,13 +6,11 @@ It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ """ + import os -from channels.routing import ProtocolTypeRouter -from consumer import routing +from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sysom.settings') -application = ProtocolTypeRouter({ - "websocket": routing.ws_router, -}) +application = get_asgi_application() diff --git a/sysom_api/sysom/settings.py b/sysom_api/sysom/settings.py index 8efefa3b..5c8b5f4a 100644 --- a/sysom_api/sysom/settings.py +++ b/sysom_api/sysom/settings.py @@ -20,13 +20,6 @@ SECRET_KEY = 'django-insecure-^d8b9di9w&-mmsbpt@)o#e+2^z+^m4nhf+z8304%9@8y#ko46l ALLOWED_HOSTS = ['*'] INSTALLED_APPS = [ - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.staticfiles', - 'django.contrib.sessions', - 'django.contrib.messages', - 'apps.accounts', 'apps.host', 'apps.monitor', @@ -44,12 +37,7 @@ INSTALLED_APPS = [ MIDDLEWARE = [ 'corsheaders.middleware.CorsMiddleware', 'django.middleware.security.SecurityMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', - # 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] from conf import Constant as constant @@ -81,14 +69,6 @@ TEMPLATES = [ 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, - 'OPTIONS': { - 'context_processors': [ - 'django.template.context_processors.debug', - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', - ], - }, }, ] @@ -105,22 +85,6 @@ CHANNEL_LAYERS = { } } - -AUTH_PASSWORD_VALIDATORS = [ - { - 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', - }, -] - DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' LANGUAGE_CODE = constant.LANGUAGE_CODE @@ -139,6 +103,7 @@ REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': [ 'apps.accounts.authentication.Authentication' ], + 'UNAUTHENTICATED_USER': None, 'DEFAULT_VERSIONING_CLASS': "rest_framework.versioning.URLPathVersioning", 'DEFAULT_VERSION': 'v1', # 默认版本 'ALLOWED_VERSIONS': ['v1', 'v2'], # 允许的版本 diff --git a/sysom_api/sysom/urls.py b/sysom_api/sysom/urls.py index 75061f1a..e267cc7b 100644 --- a/sysom_api/sysom/urls.py +++ b/sysom_api/sysom/urls.py @@ -13,14 +13,12 @@ Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ -from django.contrib import admin from django.urls import path, re_path from django.urls.conf import include from django.conf import settings urlpatterns = [ - path('admin/', admin.site.urls), path('', include("apps.host.urls")), path('', include("apps.accounts.urls")), path('', include("apps.monitor.urls")), diff --git a/sysom_api/uwsgi.ini b/sysom_api/uwsgi.ini index c15b516f..9cfa0387 100644 --- a/sysom_api/uwsgi.ini +++ b/sysom_api/uwsgi.ini @@ -1,30 +1,10 @@ [uwsgi] - -# 配置和nginx链接的socket链接 -# socket=0.0.0.0:8080 -# 也可以使用http -http=0.0.0.0:8080 - -# 配置项目路径,项目的所在目录 -chdir=/home - -# 配置wsgi接口模块文件路劲 -wsgi-file=/home/sysom/wsgi.py - -# 配置启动的进程数 -processes=4 - -# 配置每个进程的线程数 -threads=20 - -# 配置启动管理主进程 +socket=0.0.0.0:7001 +chdir=/home/sysom/target/sysom_api +module=sysom.wsgi:application +processes=10 master=True - -# 配置存放主进程的进程号文件 -pidfile=uwsgi.pid - -# 配置dump日志记录 -daemonize=/home/logs/uwsgi.log - -# 配置静态资源 -static-map=/static=/home/index/static +vacuum=True +pidfile=/var/run/uwsgi.pid +enable-threads=true +daemonize=/home/sysom/logs/uwsgi.log diff --git a/sysom_web/src/pages/vmcore/Detail/index.jsx b/sysom_web/src/pages/vmcore/Detail/index.jsx index d0b36ba0..923dbbbb 100644 --- a/sysom_web/src/pages/vmcore/Detail/index.jsx +++ b/sysom_web/src/pages/vmcore/Detail/index.jsx @@ -1,6 +1,6 @@ import React, { useState, useRef } from "react"; -import { Button, message } from "antd"; -import { useIntl } from "umi"; +import { Button, message, Descriptions } from "antd"; +import { useIntl, useRequest } from "umi"; import moment from "moment"; import ProCard from "@ant-design/pro-card"; import ProDescriptions from "@ant-design/pro-descriptions"; @@ -30,6 +30,10 @@ const VmcoreDetail = (props) => { const [createModalIssue, handleModalIssue] = useState(false); const actionRef = useRef(); const intl = useIntl(); + const { data, error, loading } = useRequest(() => { + return getVmcoreDetail({vmcore_id: props.match.params.id}) + }) + return ( @@ -119,15 +123,15 @@ const VmcoreDetail = (props) => { /> - - - - - - - {moment().valueOf()} - - + + {data?.hostname} + {data?.ip} + {data?.func_name} + {data?.comm} + {data?.ver} + {data?.core_time} +
{data?.dmesg}
+
); diff --git a/sysom_web/src/pages/vmcore/components/VmcoreTableList.jsx b/sysom_web/src/pages/vmcore/components/VmcoreTableList.jsx index 7f39c87c..5cde464a 100644 --- a/sysom_web/src/pages/vmcore/components/VmcoreTableList.jsx +++ b/sysom_web/src/pages/vmcore/components/VmcoreTableList.jsx @@ -1,6 +1,5 @@ import { useRef } from "react"; import ProTable from "@ant-design/pro-table"; -import { getVmcore } from "../service"; const VmcoreTableList = (props) => { const actionRef = useRef(); @@ -84,26 +83,17 @@ const VmcoreTableList = (props) => { ], }, ]; - let config = { - request: getVmcore, - params: props.params, - }; - if (props.request) { - config = { - request: props.request, - params: props.params, - postData: props.postData, - }; - } return ( ); }; diff --git a/sysom_web/src/pages/vmcore/list/index.jsx b/sysom_web/src/pages/vmcore/list/index.jsx index a82e4845..03b7d307 100644 --- a/sysom_web/src/pages/vmcore/list/index.jsx +++ b/sysom_web/src/pages/vmcore/list/index.jsx @@ -2,6 +2,7 @@ import { PageContainer } from '@ant-design/pro-layout'; import ProCard from '@ant-design/pro-card'; import VmcoreTableList from '../components/VmcoreTableList'; import VmcoreCard from '../components/VmcoreCard'; +import { getVmcore } from "../service"; const { Divider } = ProCard; @@ -10,7 +11,7 @@ const VmcoreList = () => { - + ); }; diff --git a/tools/deploy/deploy.sh b/tools/deploy/deploy.sh index 88d6a230..ede22e14 100755 --- a/tools/deploy/deploy.sh +++ b/tools/deploy/deploy.sh @@ -115,6 +115,7 @@ setup_database() { } init_conf() { + mkdir -p /run/daphne sed -i 's;"env", "testing";"env", "develop";g' ${TARGET_PATH}/${API_DIR}/conf/__init__.py cp tools/deploy/nginx.conf /etc/nginx/ cp tools/deploy/sysom.conf /etc/nginx/conf.d/ diff --git a/tools/deploy/sysom-uwsgi.ini b/tools/deploy/sysom-uwsgi.ini new file mode 100644 index 00000000..c1597281 --- /dev/null +++ b/tools/deploy/sysom-uwsgi.ini @@ -0,0 +1,9 @@ +[program:sysom] +directory = /home/sysom/target/sysom_api +command=/home/sysom/virtualenv/bin/uwsgi --ini /home/sysom/target/sysom_api/uwsgi.ini --catch-exceptions --protocol=http +autostart=true +autorestart=true +redirect_stderr=true +stopasgroup=true +stdout_logfile=/home/sysom/logs/supervisor.log +environment=PATH="/home/sysom/virtualenv/bin" diff --git a/tools/deploy/sysom.ini b/tools/deploy/sysom.ini index c1597281..58e6d5cd 100644 --- a/tools/deploy/sysom.ini +++ b/tools/deploy/sysom.ini @@ -1,6 +1,9 @@ -[program:sysom] -directory = /home/sysom/target/sysom_api -command=/home/sysom/virtualenv/bin/uwsgi --ini /home/sysom/target/sysom_api/uwsgi.ini --catch-exceptions --protocol=http +[fcgi-program:sysom] +socket=tcp://localhost:7001 +directory=/home/sysom/target/sysom_api +command=/home/sysom/virtualenv/bin/daphne -u /run/daphne/daphne%(process_num)d.sock --fd 0 --access-log - --proxy-headers sysom.asgi:application +numprocs=4 +process_name=asgi%(process_num)d autostart=true autorestart=true redirect_stderr=true -- Gitee