waterloo3122 / open-source-docs

Apache License 2.0
0 stars 0 forks source link

walle related代码发布系统 #106

Open waterloo3122 opened 5 years ago

waterloo3122 commented 5 years ago

on Centos7

upate system (Using root)

su - root
yum update -y
reboot

install mysql server OR use existing server (using root)

mysql server 使用的Percona Server 5.6.x
centos7的mariadb 在migrate的时候可能会报错

创建walle使用的数据库和用户(using root)

mysql -uroot  -e "create database walle"
mysql -uroot -e " grant all privileges on walle.* to walle@'127.0.0.1' identified by 'walle' "

编辑hosts

在/etc/hosts文件的最后添加如下内容

192.168.88.125   walle.ceph-in.tk

创建walle的运行用户

adduser bae
passwd bae
visudo

root ALL=(ALL) ALL 下面添加(安装成功后去除) bae ALL=(ALL) ALL

克隆代码(usin root)

cd /opt git clone https://github.com/meolu/walle-web.git mkdir -p /opt/walle-codebase chown -R bae.bae /opt/

编辑walle配置文件 (using bae)

su - bae
cd /opt/walle-web
vim walle/config/settings_prod.py

需要修改的部分-1

SETTINGS = {
   "MYSQL_USER": "walle",
    "MYSQL_PASSWORD": "walle",
    "MYSQL_DATABASE": "walle",
    "MYSQL_ROOT_PASSWORD": "walle",
    "MYSQL_HOST": "wallet.ca.c",
    "MYSQL_PORT": 3306,
}

需要修改的部分-2

    HOST = '192.168.88.125' # 这里设置成ip地址
    PORT = 5000
    SSL = False

需要修改的部分-3

     CODE_BASE = '/opt/walle-codebase/'

需要修改的部分-4

    MAIL_SERVER = 'smtp.ym.163.com'
    MAIL_PORT = 994
    MAIL_USE_SSL = True
    MAIL_USE_TLS = False
    MAIL_DEFAULT_SENDER = 'op@xx.com'
    MAIL_USERNAME = 'op@xx.com'
    MAIL_PASSWORD = 'your password'

需要修改的部分-5

   COOKIE_ENABLE = True 

接下来

vim /opt/walle-web/requirements/prod.txt comment lines below gunicorn>=19.1.1

cd /opt/walle-web
sh admin.sh init
sh admin.sh migration
sh admin.sh start

去除bae的sudo权限

visudoroot ALL=(ALL) ALL 下面删除 bae ALL=(ALL) ALL

waterloo3122 commented 5 years ago

继续配置nginx

yum install nginx -y vim /etc/nginx/conf.d/walle.conf 内容如下

upstream webservers {
    server 192.168.88.125:5000 weight=1; # 负载设置 这块一定要些服务器的ip地址,不能使用默认的0.0.0.0
}

server {
    listen       80;
    server_name  walle.licaimofang.com; # 域名设置
    access_log   /var/log/nginx/access.walle.log main;
    error_log   /var/log/nginx/error.walle.log;
    index index.html index.htm; # 日志目录

    location / {
        try_files $uri $uri/ /index.html;
        add_header access-control-allow-origin *;
        root /opt/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";
    }
}
nginx -t
systemctl enable nginx
systemctl start nginx
waterloo3122 commented 5 years ago

使用

浏览器打开http://walle.ceph-in.tk 初始账号如下:

超管: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

测试成功后,不要忘了修改默认的密码

waterloo3122 commented 5 years ago

相关配置

创建用户

用户管理-》新建 新建一个用户,为空间所有者 新建一个用户,为空间的开发者

创建空间

空间管理-》添加,空间所属人为上一步创建的用户

使用新建的空间所有者用户登录

需要使用邮箱登录