Skip to content

Commit

Permalink
1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
starsliao committed Oct 9, 2023
1 parent 109cbe5 commit 0841218
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 8 deletions.
16 changes: 9 additions & 7 deletions flask-consul/manager.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
#!/usr/bin/env python3
from flask import Flask
from units import consul_kv
import uuid
from units import consul_kv,consul_manager
import uuid,sys
from units.config_log import *

if consul_manager.get_consul_ver() == False:
sys.exit("请求consul异常, 程序退出.")


skey_path = 'ConsulManager/assets/secret/skey'
if consul_kv.get_kv_dict(skey_path) == {}:
skey_path = 'ConsulManager/assets/secret/'
if consul_kv.get_kv_dict(skey_path + 'skey') == {}:
from datetime import datetime
now = datetime.strftime(datetime.now(), '%Y-%m-%d_%H-%M-%S')
skeyuid = ''.join(str(uuid.uuid4()).split('-'))
consul_kv.put_kv(skey_path,{'sk':skeyuid})
consul_kv.put_kv(skey_path + now,{'sk':skeyuid})
consul_kv.put_kv(skey_path + 'skey',{'sk':skeyuid})
consul_kv.put_kv(f'{skey_path}bak-skey{now}',{'sk':skeyuid})
logger.warning(f"【初始化SKey完成】")

from views import login, blackbox, consul, jobs, nodes, selfnode, selfrds, selfredis, avd, exp, jms, edit_cloud, ldap, rds, redis
from views.prom import cloud_metrics
Expand Down
14 changes: 14 additions & 0 deletions flask-consul/units/consul_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@

headers = {'X-Consul-Token': consul_token}

def get_consul_ver():
url = f'{consul_url}/operator/autopilot/state'
response = requests.get(url, headers=headers, timeout=2)
response.encoding='utf-8'
if response.status_code == 200:
logger.info(f'【consul】请求成功, 认证成功: {consul_url} ')
return True
elif response.status_code == 403:
logger.error(f'【consul】连接正常: {consul_url}【认证失败】请检查consul token!')
return False
else:
logger.error(f'【consul】连接失败 {response.status_code}: {consul_url}, 请检查consul状态以及网络是否正常!')
return False

def get_hosts():
url = f'{consul_url}/agent/host'
response = requests.get(url, headers=headers)
Expand Down
2 changes: 1 addition & 1 deletion vue-consul/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Object.keys(filters).forEach(key => {
})

Vue.config.productionTip = false
Vue.prototype.VER = 'v1.0.1'
Vue.prototype.VER = 'v1.0.2'

new Vue({
el: '#app',
Expand Down
9 changes: 9 additions & 0 deletions vue-consul/src/views/dashboard/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
<el-link :underline="false" type="primary" href="https://github.com/starsliao/TenSunS" target="_blank" class="dashboard-text">🚀StarsL.cn</el-link>
</el-badge>
<el-timeline>
<el-timeline-item timestamp="2023/10/10" placement="top">
<el-card>
<h4>v1.0.2</h4>
<p>修复K8S部署consul无法持久化KV信息的bug<el-link :underline="false" type="primary" href="https://github.com/starsliao/TenSunS/tree/main/install/k8s" target="_blank">【查看明细】</el-link></p>
<p>修复同步阿里云Redis实例报错"失败:'EndTime'"的bug</p>
<p>修复采集RDS会采集到非MySql数据库的bug</p>
<p>优化启动后端检查consul状态和初始化skey的逻辑</p>
</el-card>
</el-timeline-item>
<el-timeline-item timestamp="2023/08/01" placement="top">
<el-card>
<h4>v1.0.1</h4>
Expand Down

0 comments on commit 0841218

Please sign in to comment.