拉取代码
git clone https://github.com/w5teams/w5.git
安装依赖库
# 默认国外源,国外服务器使用pip3 install -r requirements.txt# 使用国内源,国内服务器使用pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
修改配置文件
执行 vi config.ini,redis 没有密码无需填写
[mysql]host = 127.0.0.1port = 3306database = w5_dbuser = rootpassword = root[redis]host = 127.0.0.1port = 6379database = 0password =
运行项目
[root@VM-8-9-centos w5]# python3 run.py##@&$||;..!||||||||||;;||||||||%$@##@#@$%||||!` .;|||||;. `:!||||||$@@@@$%||||||||!` `!||||$@&&$||||||||||!. :|||||%$$$%||||||||||` `!||||||$$$%|||||||||;. :|||||$$$%||||||||!. .;|||$$&$||||||||; .!|:. `!%$$@$%||||||||;. .:|||!' .!&&#@$|||||||||||||||!` '%@@##@$%|||||||||||!` :%@#@###@&$||||||||!` !&###@#####@&&%||||:. `%&#####@########&&&%: W5 SOAR '$&@#######@ v0.1=============================================* Web : https://w5.io* Github : https://github.com/w5hub/w5=============================================[2020-12-07 12:07:45 +0800] [4072781] [INFO] Starting gunicorn 20.0.4[2020-12-07 12:07:45 +0800] [4072781] [INFO] Listening at: http://0.0.0.0:8888 (4072781)[2020-12-07 12:07:45 +0800] [4072781] [INFO] Using worker: flask_sockets.Worker[2020-12-07 12:07:45 +0800] [4072798] [INFO] Booting worker with pid: 4072798[2020-12-07 12:07:45 +0800] [4072800] [INFO] Booting worker with pid: 4072800[2020-12-07 12:07:45 +0800] [4072802] [INFO] Booting worker with pid: 4072802
访问 W5 SOAR
- 访问地址:
ip:8888, (访问不了请检查服务器防火墙) - 账号密码: 账号:
admin,密码:12345678(登录后请及时修改密码)

生产环境部署
1.使用 Supervisor 守护进程
# 生成 supervisor 配置文件echo_supervisord_conf3 > /etc/supervisord.conf
2.修改配置 vi /etc/supervisord.conf 最下面加入
[program:w5]# 脚本执行命令command = python3 run.py# 项目目录路径,必须是绝对路径directory = /root/w5autostart = trueautorestart = trueredirect_stderr = true# 项目日记路径stdout_logfile=/opt/w5.logstdout_logfile_maxbytes = 20MBstdout_logfile_backups = 20
3.开启守护进程
# 启动supervisord3 -c /etc/supervisord.conf# 如遇到以下错误:Error: Another program is already listening on a port that one of our HTTP servers is configured to use. Shut this program down first before starting supervisord.# 因为已经启动,所以直接更新配置即可supervisorctl3 -c /etc/supervisord.conf update
4.管理命令:
# 启动项目supervisorctl3 start w5# 停止项目supervisorctl3 stop w5# 重启项目supervisorctl3 restart w5
Nginx 绑定域名
不配置域名访问,无需看此项
server {listen 80;server_name demo.w5.io;location / {proxy_pass http://localhost:8888/;proxy_set_header Host $http_host;proxy_set_header X-real-ip $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;}# Websockt 设置项location /echo {proxy_pass http://localhost:8888/echo;proxy_http_version 1.1;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection "upgrade";}access_log off;}
重启 Nginx
nginx -s reload
访问 W5 SOAR
浏览器访问:http://demo.w5.io
