Linux-安装-Walle


搭建walle前端页面
  1. 安装依赖
  • 更换阿里云源
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo 
yum clean all  
yum makecache
  • 安装EPEL源 RHEL/CentOS 7
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
  • 安装的系统自身的mariaDB(未验证)
yum install -y mariadb-devel gcc gcc-c++ python-devel
  1. 检取代码
# 方式一
git clone git clone https://github.com/meolu/walle-web.git

# 方式二
下载下来,上传至服务器
  1. 配置Nginx
# 新增一个server 并配置如下内容
upstream webservers {
    server 0.0.0.0:5000 weight=1; # 负载设置
}

server {
    listen       80;
    server_name  walle.poetchao.com; # 域名设置--自行修改
    # access_log   /usr/local/nginx/logs/walle.log main;
    index index.html index.htm;

    location / {
        try_files $uri $uri/ /index.html;
        add_header access-control-allow-origin *;
        root /home/app/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";
    }
}

阿里云切记需要放开5000的端口

如果初始化不成功,记得在下载一个包即可

  1. 项目初始化
  • 安装项目
cd /home/app/walle-web
sh admin.sh init

# 最后显示下列标示初始化成功
init walle success 
welcome to walle 2.0

报错

  • sh admin.sh init时报错
admin.sh: line 12: $'\r': command not found
admin.sh: line 16: $'\r': command not found
admin.sh: line 26: syntax error near unexpected token `$'{\r''

# 错误原因--Linux和windows下的回车换行符不兼容的问题
# 解决方法--将admin.sh文件用PHPstorm打开,改成LF即可

admin.sh: line 26: `function init() {}
# 此方法需要更改Python的执行路径
vi admin.sh +20
whereis python
virtualenv --no-site-packages -p /usr/bin/python2.7 venv
  • 修改配置
cd /home/app/walle-web/
vi walle/config/settings_prod.py

# 主要修改如下几处:
- HOST = 'walle.poetchao.com'

- SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://venki:1q2w3e4r5t@localhost:52014/walle?charset=utf8mb4'.format(SETTINGS["MYSQL_USER"], SETTINGS["MYSQL_PASSWORD"], SETTINGS["MYSQL_HOST"], SETTINGS["MYSQL_PORT"],SETTINGS["MYSQL_DATABASE"])

- SETTINGS = {
    "MYSQL_USER": "venki",
    "MYSQL_PASSWORD": "1q2w3e4r5t@!",
    "MYSQL_DATABASE": "walle",
    "MYSQL_ROOT_PASSWORD": "walle",
    "MYSQL_HOST": "127.0.0.1",
    "MYSQL_PORT": 52014,
}
  • 创建数据库walle
# 创建数据库
create database walle;

# 注意:需要walle数据库权限和配置文件的中登录数据库的关系
  • 数据迁移
# 一直出现问题
sh admin.sh migration
  • 启动服务
cd /home/app/walle-web

sh admin.sh start
错误

flask: command not found

解决方法:

pip install flask
打通walle与应用服务器
打通walle与gitlab
walle上线流程
问题
  • 后台服务未启动参考链接
2019/11/27 16:52:03 [error] 5644#0: *60 connect() failed (111: Connection refused) while connecting to upstream, client: 220.112.229.60, server: walle.poetchao.com, request: "GET /api/general/menu HTTP/1.1", upstream: "http://0.0.0.0:5000/api/general/menu", host: "walle.poetchao.com", referrer: "http://walle.poetchao.com/

# 解决方法:修改配置文件的下列配置
upstream webservers {
    server 20.79.98.120:5000 weight=1; # 负载设置
}

你可能感兴趣的:(Linux-安装-学习记录)