linux安装walle

应用场景

多服务器git代码一致部署

walle官网

http://www.walle-web.io/

拉取walle代码

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

设置Nginx config(5000端口记得开)

upstream webservers {
    server 0.0.0.0:5000 weight=1; # 负载设置
}

server {
    listen       80;
    server_name  admin.walle-web.io www.baidu.com(后面的换成你的域名); # 域名设置
    # access_log   /usr/local/nginx/logs/walle.log;
    index index.html index.htm; # 日志目录

    location / {
        try_files $uri $uri/ /index.html;
        add_header access-control-allow-origin *;
        root /www/wwwroot/walle-web/fe; # 前端代码已集成到walle-web,即walle-web/fe的绝对路径(请修改成自己的)
    }

    location ^~ /api/ {
        add_header access-control-allow-origin *;
        proxy_pass      http://webservers;
        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://webservers;
        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 Host $http_host;
        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";
    }
}

保证python与pip存在 如不存在请先安装

安装配置

sh admin.sh init

如提示./venv/bin/activate: No such file or directoy 或 virtualenv --no-site-packages venv
可执行virtualenv --system-site-packages venv

如提示扩展无 可pip install 对应扩展
如提示扩展已存在可尝试先pip uninstall 对应扩展
(如pip install flast)

如提示 that satisfies the requirement gitdb>=4.0.1
可能要修改
requirements/prod.txt
(GitPython==2.1.11)
或者pip install GitPython

如再不行可查看我下方写的错误解决方法

修改本地hosts 位置(/etc/hosts)(域名不用改 内网通信用的)

127.0.0.1  admin.walle-web.io

创建一个数据库 walle

修改数据库配置和HOST

打开 walle-web/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": "123456",
    "MYSQL_DATABASE": "walle",
    "MYSQL_ROOT_PASSWORD": "123456",
    "MYSQL_HOST": "127.0.0.1",
    "MYSQL_PORT": 3306,
}


class ProdConfig(Config):
    """Production configuration."""
    ENV = 'prod'
    DEBUG = True

    # 服务启动 @TODO
    # HOST 修改为与 nginx server_name 一致.
    # 后续在web hooks与通知中用到此域名.
    HOST = 'admin.walle-web.io'
    PORT = 5000
    # https True, http False
    SSL = False

    # 数据库设置 @TODO
    # SQLALCHEMY_DATABASE_URI = 'mysql://user:password@localhost: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 = '/tmp/walle/codebase/'

    # 日志存储路径 @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 = '[email protected]'
    MAIL_USERNAME = '[email protected]'
    MAIL_PASSWORD = 'Ki9y&3U82'

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

安装walle数据库

sh admin.sh migration

(宝塔可能要直接 sh admin.sh upgrade)

启动

sh admin.sh start

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

访问域名

超管:[email protected] \ Walle123
所有者:[email protected] \ Walle123
负责人:[email protected] \ Walle123
开发者:[email protected] \ Walle123
访客:[email protected] \ Walle123

中途报错

错误一般是pip的扩展无 或者配置没有对

扩展问题

如提示
在这里插入图片描述
pip install gunicorn==19.7.1

如不行尝试下面方法

因为有时候pip扩展他是安装在根目录的本机python下而不是在py venv虚拟环境内
要手动搬运过去
先pip此扩展 还是不行就去本机python安装目录找扩展

可将/usr/lib/python2.7/site-packages 中的扩展复制到
/www/wwwroot/walle-web/venv/lib/python2.7/site-packages中

完全可用的walle python2.7扩展包

链接:https://pan.baidu.com/s/1iZ5VdHBZa84YTfdwuYBoZA
提取码:imez

可将此丢进/walle-web/venv/lib/python2.7/中

配置问题

配置问题请与我上面一致 可看错误日志(walle-web/logs/runtime.log)
有问题可联系博主

发布了65 篇原创文章 · 获赞 20 · 访问量 2078

猜你喜欢

转载自blog.csdn.net/weixin_43993175/article/details/104570424