美文网首页
walle2.0 搭建

walle2.0 搭建

作者: 草帽路飞S | 来源:发表于2020-07-21 17:13 被阅读0次

    ① git clone 下载walle-web

    ~]# mkdir -pv /data && cd /data/

    ~]# git clone https://github.com/meolu/walle-web.git

    ② 安装 python 2。7+ pip

    ~]# cd /data/walle-web/

    ~]# sh admin.sh init

    注:如果安装失败,修改admin.sh文件 添加python参数,如下:

    virtualenv --no-site-packages -p /usr/local/bin/python2.7 venv

    如果初始化报错,根据提示修改prod.txt

    配置文件如下:

    ----------------------------------------------------------------------------

    ~]# vi /data/walle-web/requirements/prod.txt

    # Everything needed in production

    fabric2==2.3.1

    eventlet==0.23.0

    gevent==1.3.7

    gevent-websocket==0.10.1

    # Flask

    Flask==1.0.2

    MarkupSafe==1.0

    Werkzeug==0.14

    Jinja2==2.10

    Flask-RESTful==0.3.5

    Flask-Babel==0.11.2

    Flask-Mail==0.9.0

    flask-socketio==3.0.2

    # Database

    Flask-SQLAlchemy==2.3.2

    psycopg2==2.7.5

    SQLAlchemy==1.2.14

    mysqlclient==1.3.13

    marshmallow==2.15.1

    # Migrations

    Flask-Migrate==2.3.1

    # Forms

    Flask-WTF==0.14.2

    WTForms==2.1

    # Deployment

    gunicorn==19.1.1

    # Auth

    Flask-Login==0.4.0

    Flask-Bcrypt==0.7.1

    anyjson==0.3.3

    celery==3.1.18

    pycrypto==2.6.1

    #pytz==2015.6

    #python-ldap>=3.0.0b1

    dnspython>=1.15

    pytz

    requests==2.20.0

    GitPython

    cryptography>=2.5

    pymysql

    ----------------------------------------------------------------------------

    ③ 修改配置文件(标红地方做修改)

    ~]# vi /data/walle-web/walle/config/settings_prod.py

    ----------------------------------------------------------------------------

    # -*- coding: utf-8 -*-

    """

    walle-web

    Application configuration.

    注意: 带了 @TODO 的地方可能需要你的调整

    :copyright: © 2015-2019 walle-web.io

    :created time: 2018-11-24 07:05:35

    :author: wushuiyong@walle-web.io

    """

    import os

    from walle.config.settings import Config

    SETTINGS = {

    "MYSQL_USER": "root",

    "MYSQL_PASSWORD": "root1234",

    "MYSQL_DATABASE": "walle",

    "MYSQL_ROOT_PASSWORD": "root1234",

    "MYSQL_HOST": "127.0.0.1",

    "MYSQL_PORT": 3306,

    }

    class ProdConfig(Config):

    """Production configuration."""

    ENV = 'prod'

    DEBUG = False

    SQLALCHEMY_ECHO = False

    # 服务启动 @TODO

    # HOST 修改为与 nginx server_name 一致.

    # 后续在web hooks与通知中用到此域名.

    HOST = '0.0.0.0'

    PORT = 5000

    # https True, http False

    SSL = False

    # 数据库设置 @TODO

    # SQLALCHEMY_DATABASE_URI = 'mysql://root:'root1234'@127.0.0.1:3306/walle?charset=utf8'

    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://{}:{}@{}:{}/{}?charset=utf8mb4'.format(

    SETTINGS["MYSQL_USER"], SETTINGS["MYSQL_PASSWORD"], SETTINGS["MYSQL_HOST"], SETTINGS["MYSQL_PORT"],

    SETTINGS["MYSQL_DATABASE"])

    # 阿里云RDS强制释放空闲连接导致经常报错 mysql server has gone way

    # 适当修改该参数即可 单位为秒

    # N秒不用的连接自动释放

    # SQLALCHEMY_POOL_RECYCLE = 30

    # 本地代码检出路径(用户查询分支, 编译, 打包) #TODO

    CODE_BASE = '/data/codebase-walle/'

    # 日志存储路径 @TODO

    # 默认为walle-web项目下logs, 可自定义路径, 需以 / 结尾

    # LOG_PATH = '/var/logs/walle/'

    LOG_PATH = os.path.join(Config.PROJECT_ROOT, 'logs')

    LOG_PATH_ERROR = os.path.join(LOG_PATH, 'error.log')

    LOG_PATH_INFO = os.path.join(LOG_PATH, 'info.log')

    LOG_FILE_MAX_BYTES = 100 * 1024 * 1024

    # 邮箱配置 @TODO

    MAIL_SERVER = 'smtp.exmail.qq.com'

    MAIL_PORT = 465

    MAIL_USE_SSL = True

    MAIL_USE_TLS = False

    MAIL_DEFAULT_SENDER = 'service@walle-web.io'

    MAIL_USERNAME = 'service@walle-web.io'

    MAIL_PASSWORD = 'Ki9y&3U82'

    # 登录cookie 防止退出浏览器重新登录

    COOKIE_ENABLE = False

    ----------------------------------------------------------------------------

    ④ 创建数据库并重置数据

    ~]# mysql -h127.0.0.1 -P3306 -uroot -p -e 'CREATE SCHEMA walle'

    ~]# sh admin.sh migration

    ⑤ 启动walle

    ~]# sh admin.sh start

    ⑥ 如果需要重启升级(稳定版建议不升级)

    ~]# sh admin.sh restart # 重启

    ~]# sh admin.sh upgrade # 升级walle,升级完需要重启walle服务。升级前最好 git stash 暂存本地修改,升级后git stash pop弹出暂存,然后重启服务。

    ~]# sh admin.sh migration # Migration

    ⑦ 备份数据库导入

    备份路径:/data/back/mysql/日期命名

    备份文件:20200721_walle.sql (日期前缀)

    例:导入2020年7月21日备份的walle数据

    ~]# mysql -h127.0.0.1 -P3306 -uroot -p < /data/back/mysql/20200721/20200721_walle.sql

    ⑧ nginx配置

    ~]# vi /data/usr/nginx/conf/nginx.conf

    server {

    listen 1024;

    server_name 127.0.0.1;

    charset utf-8;

    access_log /data/usr/nginx/logs/1024walle_a.log main;

    error_log logs/1024walle_e.log;

    index index.html index.htm; 

    #walle

    location / {

    try_files $uri $uri/ /index.html;

    add_header access-control-allow-origin *;

    root /data/walle-web-master/fe;

    }

    location ^~ /api/ {

    add_header access-control-allow-origin *;

    proxy_pass http://127.0.0.1:5000;

    proxy_set_header X-Forwarded-Host $host:$server_port;

    proxy_set_header X-Real-IP $remote_addr;

    proxy_set_header Origin $host:$server_port;

    proxy_set_header Referer $host:$server_port;

    }

    location ^~ /socket.io/ {

    add_header access-control-allow-origin *;

    proxy_pass http://127.0.0.1:5000;

    proxy_set_header X-Forwarded-Host $host:$server_port;

    proxy_set_header X-Real-IP $remote_addr;

    proxy_set_header Origin $host:$server_port;

    proxy_set_header Referer $host:$server_port;

    proxy_set_header X-NginX-Proxy true;

    # WebScoket Support

    proxy_http_version 1.1;

    proxy_set_header Upgrade $http_upgrade;

    proxy_set_header Connection "upgrade";

    }

    }

    重载nginx:

    ~]# /data/usr/nginx/sbin/nginx -t && /data/usr/nginx/sbin/nginx -s reload

    ⑨ 访问 http://127.0.0.1:1024

    附:初始用户

    超管:super@walle-web.io \ Walle123

    所有者:owner@walle-web.io \ Walle123

    负责人:master@walle-web.io \ Walle123

    开发者:developer@walle-web.io \ Walle123

    访客:reporter@walle-web.io \ Walle123

    附:日志查看

    walle运行过程,以及部署过程出错了,具体日志可以查看/data/walle-web/logs/runtime.log

    附:官网

    http://walle-web.io/docs/2/zh-cn/installation.html

    相关文章

      网友评论

          本文标题:walle2.0 搭建

          本文链接:https://www.haomeiwen.com/subject/gthwkktx.html