Skip to content

Commit

Permalink
修改readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jly8866 committed Jun 19, 2017
1 parent cce51df commit 84d1f96
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 390 deletions.
39 changes: 36 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,37 @@ cd archer && python3 manage.py createsuperuser<br/>
8. 启动:<br/>
用django内置runserver启动服务,需要修改debug.sh里的ip和port<br/>
cd archer && bash debug.sh<br/>
如果要用gunicorn启动服务的话,可以使用pip3 install gunicorn安装并用startup.sh启动,但需要配合nginx处理静态资源.
如果要用gunicorn启动服务的话,可以使用pip3 install gunicorn安装并用startup.sh启动,但需要配合nginx处理静态资源.<br/>
8.1 gunicorn的安装配置示例:<br/>
pip3 install gunicorn<br/>
cat startup.sh #gunicorn启动脚本<br/>
#!/bin/bash<br/>
settings=${1:-"archer.settings"}<br/>
ip=${2:-"192.168.1.21"}<br/>
port=${3:-9124} #记住这个端口,配置nginx或apache代理时,指向的是这个端口<br/>
gunicorn -w 4 --env DJANGO_SETTINGS_MODULE=${settings} --error-logfile=/tmp/archer.err -b ${ip}:${port} archer.wsgi:application --timeout 1200 -D #timeout要根据实际情况来设置,单位为秒,如果要对大表进行操作,这个值要适当加大<br/>
<br/>
8.2 nginx配置示例<br/>
cat nginx.conf <br/>
#部分省略<br/>
server { <br/>
listen 9123; #监听端口<br/>
server_name archer; <br/>
client_header_timeout 1200; #超时时间与gunicorn超时时间设置一致 <br/>
client_body_timeout 1200;<br/>
proxy_read_timeout 1200;<br/>
location / { <br/>
proxy_set_header Host $http_host; #proxy_set_header 这3条配置必填 <br/>
proxy_set_header X-Real-IP $remote_addr; <br/>
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; <br/>
proxy_pass http://192.168.1.21:9124; <br/>
} <br/>
location /static { <br/>
alias /app/archer/archer/sql/static; #此处指向static目录的绝对路径,以便nginx收集静态资源 <br/>
} <br/>
} <br/>
#部分省略 <br/>
<br/>
9. 创建archer系统登录用户:<br/>
使用浏览器(推荐chrome或火狐)访问debug.sh里的地址:http://X.X.X.X:port/admin/sql/users/ ,如果未登录需要用到步骤7创建的admin系统用户来登录。<br/>
点击右侧Add users,用户名密码自定义,至少创建一个工程师和一个审核人(步骤7创建的用户也可以登录)后续新的工程师和审核人用户请用LDAP导入sql_users表或django admin增加<br/>
Expand All @@ -98,7 +128,9 @@ cd archer && bash debug.sh<br/>
6. 用户、集群、工单管理:<br/>
![image](https://github.com/jly8866/archer/raw/master/screenshots/adminsqlusers.png)<br/>
7. 工单统计图表:<br/>
![image](https://github.com/jly8866/archer/raw/master/screenshots/charts.png)<br/>
![image](https://github.com/jly8866/archer/raw/master/screenshots/charts.png)<br/><br/>
8.pt-OSC进度条,以及中止pt-OSC进程按钮:<br/>
![image](https://raw.githubusercontent.com/johnliu2008/archer/master/screenshots/osc_progress.png)<br/>

### 联系方式:
QQ群:524233225
Expand All @@ -109,4 +141,5 @@ QQ群:524233225
![image](https://github.com/jly8866/archer/raw/master/screenshots/bugs/bug2.png)<br/>
原因:python3的pymysql模块会向inception发送SHOW WARNINGS语句,导致inception返回一个"Must start as begin statement"错误被archer捕捉到报在日志里.<br/>
解决:如果实在忍受不了,请修改/path/to/python3/lib/python3.4/site-packages/pymysql/cursors.py:338行,将self._show_warnings()这一句注释掉,换成pass,如下:<br/>
![image](https://github.com/jly8866/archer/raw/master/screenshots/bugs/bug3.png)
![image](https://github.com/jly8866/archer/raw/master/screenshots/bugs/bug3.png)<br/>
但是此方法有副作用,会导致所有调用该pymysql模块的程序不能show warnings,因此强烈推荐使用virtualenv或venv环境!
3 changes: 1 addition & 2 deletions archer/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@
MAIL_REVIEW_FROM_ADDR='[email protected]' #发件人,也是登录SMTP server需要提供的用户名
MAIL_REVIEW_FROM_PASSWORD='' #发件人邮箱密码,如果为空则不需要login SMTP server
MAIL_REVIEW_DBA_ADDR=['[email protected]', '[email protected]'] #DBA地址,执行完毕会发邮件给DBA,以list形式保存

#是否过滤【DROP DATABASE】|【DROP TABLE】|【TRUNCATE PARTITION】|【TRUNCATE TABLE】等高危DDL操作:
#on是开,会首先用正则表达式匹配sqlContent,如果匹配到高危DDL操作,则判断为“自动审核不通过”;off是关,直接将所有的SQL语句提交给inception,对于上述高危DDL操作,只备份元数据
CRITICAL_DDL_ON_OFF='off'
CRITICAL_DDL_ON_OFF='off'
2 changes: 1 addition & 1 deletion debug.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

python3 manage.py runserver 172.16.5.10:9123
python3 manage.py runserver 0.0.0.0:9123
Loading

0 comments on commit 84d1f96

Please sign in to comment.