W5 SOAR 使用文档

vuePress-theme-reco W5er    2021
W5 SOAR 使用文档 W5 SOAR 使用文档

Choose mode

  • dark
  • auto
  • light
官网 (opens new window)
常见问题
交流群
建议反馈 (opens new window)
Github (opens new window)
下载 (opens new window)

W5er

0

Article

0

Tag

官网 (opens new window)
常见问题
交流群
建议反馈 (opens new window)
Github (opens new window)
下载 (opens new window)
  • 介绍

    • 什么是 W5 SOAR
    • 美图欣赏
  • 入门

    • Redis 配置
    • Mysql 配置
    • Linux 搭建环境
    • Linux 部署
    • Win 部署
    • Docker 部署
  • 使用

    • 创建剧本
    • 链路判断
    • 变量传递
    • 用户输入
    • WebHook
    • 定时器
  • APP 开发

    • Hello Word
    • app.json 配置
    • 其他配置
    • APP 类型
    • 使用 APP
    • 开发规范
  • 乱七八糟

    • W5 API
    • 更新说明
  • 其他

    • 常见问题
    • TODO
    • 更新日记
    • 联系我们

Linux 部署

vuePress-theme-reco W5er    2021

Linux 部署

W5er

# 拉取代码

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.1
port = 3306
database = w5_db
user = root
password = root

[redis]
host = 127.0.0.1
port = 6379
database = 0
password =

# 运行项目

[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 (登录后请及时修改密码)

login

# 生产环境部署

1.使用 Supervisor 守护进程

# 生成 supervisor 配置文件
echo_supervisord_conf3 > /etc/supervisord.conf

2.修改配置 vi /etc/supervisord.conf 最下面加入

[program:w5]
# 脚本执行命令
command = python3 run.py
# 项目目录路径,必须是绝对路径
directory = /root/w5
autostart = true
autorestart = true
redirect_stderr = true
# 项目日记路径
stdout_logfile=/opt/w5.log 
stdout_logfile_maxbytes = 20MB
stdout_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