add new
This commit is contained in:
parent
f7b6082dbd
commit
8a08d405c9
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
*.pyc
|
*.pyc
|
||||||
*.log
|
*.log
|
||||||
|
.idea\*
|
23
README.md
Normal file
23
README.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
### 目标
|
||||||
|
运维日常功能包括项目管理、变更、监控、接口管理等功能
|
||||||
|
### 实现
|
||||||
|
基于tornado&bootstrap实现,后台DB选用mysql,远程管理使用ansible,服务使用接口方式调用
|
||||||
|
### 目录
|
||||||
|
template
|
||||||
|
setting
|
||||||
|
apps
|
||||||
|
admin
|
||||||
|
deploy
|
||||||
|
monitor
|
||||||
|
report
|
||||||
|
interface
|
||||||
|
|
||||||
|
### 功能分割
|
||||||
|
后台管理功能 账号认证,权限
|
||||||
|
资源管理 服务器,数据库,CDN。。
|
||||||
|
来源分从腾讯/阿里云导入,手动控制等类别,分别对应接口自动维护和手动维护操作
|
||||||
|
项目管理
|
||||||
|
项目变更 服务变更,数据库变更
|
||||||
|
监控管理 服务可用性监控,服务性能监控,日志监控,服务自拉起
|
||||||
|
报表管理 OPS系统统计,数据汇总
|
||||||
|
接口管理 应用接口配置及管理
|
9
project_src/__init__.py
Normal file
9
project_src/__init__.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
9
project_src/handlers/__init__.py
Normal file
9
project_src/handlers/__init__.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
9
project_src/models/__init__.py
Normal file
9
project_src/models/__init__.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
43
project_src/server.py
Normal file
43
project_src/server.py
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from logging.config import dictConfig
|
||||||
|
from importlib import import_module
|
||||||
|
|
||||||
|
import click
|
||||||
|
import tornado.ioloop
|
||||||
|
import tornado.web
|
||||||
|
#from raven.contrib.tornado import AsyncSentryClient
|
||||||
|
|
||||||
|
|
||||||
|
def make_app(debug=None):
|
||||||
|
from project_src.url import urls
|
||||||
|
assert isinstance(urls, (list, tuple)), 'urls must be list or tuple'
|
||||||
|
return tornado.web.Application(urls, debug=debug)
|
||||||
|
|
||||||
|
|
||||||
|
def init_log():
|
||||||
|
dictConfig(tornado.settings.LOGGING)
|
||||||
|
|
||||||
|
|
||||||
|
@click.command()
|
||||||
|
@click.option('--port', default=9090)
|
||||||
|
@click.option('--profile', default='develop')
|
||||||
|
def serve(port, profile):
|
||||||
|
settings = import_module(f'project_src.settings.{profile}')
|
||||||
|
tornado.settings = settings
|
||||||
|
init_log()
|
||||||
|
|
||||||
|
app = make_app(settings.DEBUG)
|
||||||
|
app.listen(port)
|
||||||
|
# app.sentry_client = AsyncSentryClient(
|
||||||
|
# '<sentry>'
|
||||||
|
# )
|
||||||
|
sys.stdout.write(f"Start server at:http://0.0.0.0:{port} \nProfile: {profile}\n")
|
||||||
|
tornado.ioloop.IOLoop.current().start()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
current_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
sys.path.insert(0, current_path)
|
||||||
|
serve()
|
9
project_src/settings/__init__.py
Normal file
9
project_src/settings/__init__.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
9
project_src/settings/base.py
Normal file
9
project_src/settings/base.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
9
project_src/settings/develop.py
Normal file
9
project_src/settings/develop.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
10
project_src/templates/base.html
Normal file
10
project_src/templates/base.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
12
project_src/url.py
Normal file
12
project_src/url.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
class urls:
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
4
requirements.txt
Normal file
4
requirements.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
raven==6.10.0
|
||||||
|
redis==3.2.1
|
||||||
|
requests==2.21.0
|
||||||
|
tornado==6.0.2
|
Loading…
x
Reference in New Issue
Block a user