From bd5fb890d6970ad2f78d95b2413d8d3c780d091d Mon Sep 17 00:00:00 2001 From: zypo Date: Thu, 16 Jun 2022 19:55:55 +0800 Subject: [PATCH 01/14] update readme --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 51b04aa..848ffbf 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,16 @@ Spug是面向中小型企业设计的轻量级无Agent的自动化运维平台 - 使用文档:https://spug.cc/docs/about-spug/ - 更新日志:https://spug.cc/docs/change-log/ - 常见问题:https://spug.cc/docs/faq/ +- 推送助手:https://push.spug.cc ## 演示环境 演示地址:https://demo.spug.cc +## 推送助手 + +[推送助手是一个集成了电话、短信、邮件、飞书、钉钉、微信、企业微信等多通道的消息推送平台,用户只需要调用一个简单的URL,就可以完成多通道的消息推送,点击体验:https://push.spug.cc](https://push.spug.cc) + ## 特性 @@ -39,9 +44,10 @@ Spug是面向中小型企业设计的轻量级无Agent的自动化运维平台 ## 安装 -[官方文档](https://spug.cc/docs/install/) +[官方文档](https://spug.cc/docs/install-docker) + +更多使用帮助请参考: [使用文档](https://spug.cc/docs/host-manage/) -更多使用帮助请参考 [使用文档](https://spug.cc/docs/host-manage/)。 ## 推荐项目 [Yearning — MYSQL 开源SQL语句审核平台](https://github.com/cookieY/Yearning) From ff7d8d0fd0a644ffcb33bbee99bb59931b1ecbfe Mon Sep 17 00:00:00 2001 From: vapao Date: Fri, 17 Jun 2022 09:53:26 +0800 Subject: [PATCH 02/14] U update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 848ffbf..0fcbe04 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Spug是面向中小型企业设计的轻量级无Agent的自动化运维平台 ## 推送助手 -[推送助手是一个集成了电话、短信、邮件、飞书、钉钉、微信、企业微信等多通道的消息推送平台,用户只需要调用一个简单的URL,就可以完成多通道的消息推送,点击体验:https://push.spug.cc](https://push.spug.cc) +推送助手是一个集成了电话、短信、邮件、飞书、钉钉、微信、企业微信等多通道的消息推送平台,用户只需要调用一个简单的URL,就可以完成多通道的消息推送,点击体验:[https://push.spug.cc](https://push.spug.cc) ## 特性 From 860048796dce62e983e156a565f647f0fb48a6ee Mon Sep 17 00:00:00 2001 From: vapao Date: Fri, 17 Jun 2022 11:35:09 +0800 Subject: [PATCH 03/14] U update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0fcbe04..24c512e 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Spug是面向中小型企业设计的轻量级无Agent的自动化运维平台 演示地址:https://demo.spug.cc -## 推送助手 +## 🔥推送助手 推送助手是一个集成了电话、短信、邮件、飞书、钉钉、微信、企业微信等多通道的消息推送平台,用户只需要调用一个简单的URL,就可以完成多通道的消息推送,点击体验:[https://push.spug.cc](https://push.spug.cc) From c0f8aeb405f01f508cea8e04c4a7bc628ca31c00 Mon Sep 17 00:00:00 2001 From: vapao Date: Fri, 17 Jun 2022 14:46:59 +0800 Subject: [PATCH 04/14] =?UTF-8?q?U=20=E4=BC=98=E5=8C=96=E5=90=AF=E7=94=A8?= =?UTF-8?q?=E8=A2=AB=E7=A6=81=E8=B4=A6=E6=88=B7=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/account/management/commands/user.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spug_api/apps/account/management/commands/user.py b/spug_api/apps/account/management/commands/user.py index 063794f..0d1be0f 100644 --- a/spug_api/apps/account/management/commands/user.py +++ b/spug_api/apps/account/management/commands/user.py @@ -52,10 +52,9 @@ class Command(BaseCommand): self.echo_error('缺少参数') self.print_help() user = User.objects.filter(username=options['u'], deleted_by_id__isnull=True).first() - if not user: - return self.echo_error(f'未找到登录名为【{options["u"]}】的账户') - user.is_active = True - user.save() + if user: + user.is_active = True + user.save() cache.delete(user.username) self.echo_success('账户已启用') elif action == 'reset': From b342822fa6596a29af8208524b7a8429e4563b61 Mon Sep 17 00:00:00 2001 From: vapao Date: Sat, 18 Jun 2022 22:39:47 +0800 Subject: [PATCH 05/14] =?UTF-8?q?U=20=E4=BC=98=E5=8C=96=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E4=B8=8E=E5=8F=91=E5=B8=83=E9=85=8D=E7=BD=AE=E7=9A=84=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=95=B0=E9=87=8F=E7=9B=B8=E5=90=8C=E7=9A=84=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E7=BA=AA=E5=BD=95=E4=BB=A5=E6=94=B9=E5=96=84=E7=A3=81?= =?UTF-8?q?=E7=9B=98=E7=A9=BA=E9=97=B4=E5=8D=A0=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/deploy/views.py | 4 ++++ spug_api/apps/schedule/builtin.py | 7 +++++++ spug_web/src/pages/deploy/app/Ext1Setup3.js | 2 +- spug_web/src/pages/deploy/request/Rollback.js | 4 ++-- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/spug_api/apps/deploy/views.py b/spug_api/apps/deploy/views.py index 3665b85..e505eb7 100644 --- a/spug_api/apps/deploy/views.py +++ b/spug_api/apps/deploy/views.py @@ -130,6 +130,10 @@ class RequestDetailView(View): outputs[item['key']]['status'] = item['status'] data = rds.lrange(key, counter, counter + 9) response['index'] = counter + if counter == 0: + for item in outputs: + outputs[item]['data'] += '\r\n\r\n未读取到数据,Spug 仅保存最近2周的日志信息。' + if req.is_quick_deploy: if outputs['local']['data']: outputs['local']['data'] = f'{human_time()} 读取数据... ' + outputs['local']['data'] diff --git a/spug_api/apps/schedule/builtin.py b/spug_api/apps/schedule/builtin.py index 54effa2..a4bd8d3 100644 --- a/spug_api/apps/schedule/builtin.py +++ b/spug_api/apps/schedule/builtin.py @@ -6,6 +6,7 @@ from apps.account.models import History from apps.alarm.models import Alarm from apps.schedule.models import Task, History as TaskHistory from apps.deploy.models import DeployRequest +from apps.app.models import DeployExtend1 from apps.exec.models import ExecHistory from apps.notify.models import Notify from apps.deploy.utils import dispatch @@ -21,6 +22,12 @@ def auto_run_by_day(): History.objects.filter(created_at__lt=date_30).delete() Notify.objects.filter(created_at__lt=date_7, unread=False).delete() Alarm.objects.filter(created_at__lt=date_30).delete() + for item in DeployExtend1.objects.all(): + index = 0 + for req in DeployRequest.objects.filter(deploy_id=item.deploy_id, repository_id__isnull=False): + if index > item.versions and req.repository_id: + req.repository.delete() + index += 1 try: record = ExecHistory.objects.all()[50] ExecHistory.objects.filter(id__lt=record.id).delete() diff --git a/spug_web/src/pages/deploy/app/Ext1Setup3.js b/spug_web/src/pages/deploy/app/Ext1Setup3.js index 7a96caa..cead84c 100644 --- a/spug_web/src/pages/deploy/app/Ext1Setup3.js +++ b/spug_web/src/pages/deploy/app/Ext1Setup3.js @@ -46,7 +46,7 @@ export default observer(function () { - + info['versions'] = e.target.value} placeholder="请输入保存的版本数量"/> diff --git a/spug_web/src/pages/deploy/request/Rollback.js b/spug_web/src/pages/deploy/request/Rollback.js index 4e9003f..795c3d7 100644 --- a/spug_web/src/pages/deploy/request/Rollback.js +++ b/spug_web/src/pages/deploy/request/Rollback.js @@ -55,12 +55,12 @@ export default observer(function () { - + this.input = ref}/>
- - this.handleChdir('', '0')}> - - - {this.state.pwd.map(item => ( - this.handleChdir(item, '2')}> - {item} + {this.state.inputPath !== null ? ( + this.input2 = ref} size="small" className={styles.input} + suffix={
回车确认
} + value={this.state.inputPath} onChange={e => this.setState({inputPath: e.target.value})} + onPressEnter={this.handleInputEnter}/> + ) : ( + + this.handleChdir('', '0')}> + - ))} - + {this.state.pwd.map(item => ( + this.handleChdir(item, '2')}> + {item} + + ))} + + + +
+ )} +
显示隐藏文件: Date: Sun, 19 Jun 2022 11:01:28 +0800 Subject: [PATCH 09/14] =?UTF-8?q?F=20=E4=BF=AE=E5=A4=8D=E4=B8=8E=E4=B8=BB?= =?UTF-8?q?=E6=9C=BA=E7=9B=B8=E5=85=B3=E7=9A=84=E7=9B=91=E6=8E=A7=E9=A1=B9?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=B1=95=E7=A4=BA=E7=8A=B6=E6=80=81=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20#I5AIL1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/monitor/views.py | 1 + 1 file changed, 1 insertion(+) diff --git a/spug_api/apps/monitor/views.py b/spug_api/apps/monitor/views.py index 59f0705..bf5b11e 100644 --- a/spug_api/apps/monitor/views.py +++ b/spug_api/apps/monitor/views.py @@ -114,6 +114,7 @@ def get_overview(request): for item in Detection.objects.all(): data = {} for key in json.loads(item.targets): + key = str(key) data[key] = { 'id': f'{item.id}_{key}', 'group': item.group, From ac7d78240c6784beb9b60417ee84119481bd266a Mon Sep 17 00:00:00 2001 From: vapao Date: Sun, 19 Jun 2022 11:08:50 +0800 Subject: [PATCH 10/14] =?UTF-8?q?U=20=E5=8F=91=E5=B8=83=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E9=97=B4=E5=B1=95=E7=A4=BA=E4=B8=BA=E7=9B=B8?= =?UTF-8?q?=E5=AF=B9=E6=97=B6=E9=97=B4=20#I57T37?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_web/src/pages/deploy/request/Table.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spug_web/src/pages/deploy/request/Table.js b/spug_web/src/pages/deploy/request/Table.js index 2e58b71..dfc8b54 100644 --- a/spug_web/src/pages/deploy/request/Table.js +++ b/spug_web/src/pages/deploy/request/Table.js @@ -11,6 +11,7 @@ import { http, hasPermission } from 'libs'; import { Action, AuthButton, TableCard } from 'components'; import S from './index.module.less'; import store from './store'; +import moment from 'moment'; function DeployConfirm() { return ( @@ -72,7 +73,7 @@ function ComTable() { className: S.min120, dataIndex: 'created_at', sorter: (a, b) => a['created_at'].localeCompare(b['created_at']), - render: v => {v ? v.substring(0, 10) : null}, + render: v => {v ? moment(v).fromNow() : null}, hide: true }, { title: '审核人', @@ -83,7 +84,7 @@ function ComTable() { title: '审核时间', className: S.min120, dataIndex: 'approve_at', - render: v => {v ? v.substring(0, 10) : null}, + render: v => {v ? moment(v).fromNow() : null}, }, { title: '发布人', className: S.min120, @@ -93,7 +94,7 @@ function ComTable() { title: '发布时间', className: S.min120, dataIndex: 'do_at', - render: v => {v ? v.substring(0, 10) : null}, + render: v => {v ? moment(v).fromNow() : null}, hide: true }, { title: '备注', From 365d48400757fd9045347fc8ce8404e85662e16c Mon Sep 17 00:00:00 2001 From: vapao Date: Mon, 20 Jun 2022 16:40:49 +0800 Subject: [PATCH 11/14] =?UTF-8?q?U=20=E6=94=B9=E8=BF=9B=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E4=B8=BB=E6=9C=BA=E6=89=A9=E5=B1=95=E4=BF=A1=E6=81=AF=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/host/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spug_api/apps/host/utils.py b/spug_api/apps/host/utils.py index 097f201..feab7d5 100644 --- a/spug_api/apps/host/utils.py +++ b/spug_api/apps/host/utils.py @@ -202,6 +202,8 @@ def fetch_host_extend(ssh): code, out = ssh.exec_command_raw('hostname -I') if code == 0: for ip in out.strip().split(): + if len(ip) > 15: # ignore ipv6 + continue if ipaddress.ip_address(ip).is_global: if len(public_ip_address) < 10: public_ip_address.add(ip) From 1871ee717fe55f2b21b2c902a75a48307a17cf30 Mon Sep 17 00:00:00 2001 From: vapao Date: Mon, 20 Jun 2022 16:41:39 +0800 Subject: [PATCH 12/14] U Release v3.1.6 --- spug_api/spug/settings.py | 2 +- spug_web/src/libs/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spug_api/spug/settings.py b/spug_api/spug/settings.py index a22d364..4e59b3c 100644 --- a/spug_api/spug/settings.py +++ b/spug_api/spug/settings.py @@ -131,7 +131,7 @@ AUTHENTICATION_EXCLUDES = ( re.compile('/apis/.*'), ) -SPUG_VERSION = 'v3.1.5' +SPUG_VERSION = 'v3.1.6' # override default config try: diff --git a/spug_web/src/libs/index.js b/spug_web/src/libs/index.js index 77c8bba..1c47e2e 100644 --- a/spug_web/src/libs/index.js +++ b/spug_web/src/libs/index.js @@ -10,4 +10,4 @@ export * from './functools'; export * from './router'; export const http = _http; export const history = _history; -export const VERSION = 'v3.1.5'; +export const VERSION = 'v3.1.6'; From 6839eb408b0d10bd8ea359bfaa2b76c01639c80c Mon Sep 17 00:00:00 2001 From: vapao Date: Mon, 20 Jun 2022 23:24:21 +0800 Subject: [PATCH 13/14] =?UTF-8?q?F=20=E4=BF=AE=E5=A4=8D=E8=B4=A6=E6=88=B7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=BC=96=E8=BE=91=E6=97=A0=E6=B3=95=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/account/views.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spug_api/apps/account/views.py b/spug_api/apps/account/views.py index b5542bc..085ed73 100644 --- a/spug_api/apps/account/views.py +++ b/spug_api/apps/account/views.py @@ -41,13 +41,12 @@ class UserView(AdminView): return json_response(error=f'已存在登录名为【{form.username}】的用户') role_ids, password = form.pop('role_ids'), form.pop('password') - if not verify_password(password): - return json_response(error='请设置至少8位包含数字、小写和大写字母的新密码') - if form.id: user = User.objects.get(pk=form.id) user.update_by_dict(form) else: + if not verify_password(password): + return json_response(error='请设置至少8位包含数字、小写和大写字母的新密码') user = User.objects.create( password_hash=User.make_password(password), created_by=request.user, From 0676b21dc0bfed31bbe0aa877c986aa0c5b6f501 Mon Sep 17 00:00:00 2001 From: vapao Date: Mon, 20 Jun 2022 23:26:12 +0800 Subject: [PATCH 14/14] U Release v3.1.7 --- spug_api/spug/settings.py | 2 +- spug_web/src/libs/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spug_api/spug/settings.py b/spug_api/spug/settings.py index 4e59b3c..1830955 100644 --- a/spug_api/spug/settings.py +++ b/spug_api/spug/settings.py @@ -131,7 +131,7 @@ AUTHENTICATION_EXCLUDES = ( re.compile('/apis/.*'), ) -SPUG_VERSION = 'v3.1.6' +SPUG_VERSION = 'v3.1.7' # override default config try: diff --git a/spug_web/src/libs/index.js b/spug_web/src/libs/index.js index 1c47e2e..e360462 100644 --- a/spug_web/src/libs/index.js +++ b/spug_web/src/libs/index.js @@ -10,4 +10,4 @@ export * from './functools'; export * from './router'; export const http = _http; export const history = _history; -export const VERSION = 'v3.1.6'; +export const VERSION = 'v3.1.7';