2
2
typora-copy-images-to : ./screenshots
3
3
---
4
4
5
- ####爱发布
5
+ #### 爱发布
6
6
7
7
demo地址: https://fabu.love
8
8
该平台是类似于fir.im/蒲公英类似的一个平台.可以自己部署.
@@ -15,13 +15,25 @@ demo地址: https://fabu.love
15
15
16
16
后端使用 nodejs + koa
17
17
18
- 截图 | 截图
19
- - | :-: |
20
- ![ 5657AAD0-7A7F-4CB5-9341-98679AD57C1D] ( ./screenshots/5657AAD0-7A7F-4CB5-9341-98679AD57C1D.png ) | ![ 05A6652A-8C99-40C5-B98B-6056DD932FCB] ( ./screenshots/05A6652A-8C99-40C5-B98B-6056DD932FCB.png ) |
21
- ![ 143CBD50-D020-4F01-A9F3-F5F070110F18] ( ./screenshots/143CBD50-D020-4F01-A9F3-F5F070110F18.png ) | ![ A7347718-F313-4A70-8314-7C83E275E652] ( ./screenshots/A7347718-F313-4A70-8314-7C83E275E652.png ) |
18
+ ![ Artboard] ( /Volumes/UserData/ProjectSource/NodeProject/AppFabu/screenshots/Artboard.png )
22
19
20
+ #### 项目结构
23
21
24
- #### 安装前准备
22
+ ```
23
+ .
24
+ ├── LICENSE
25
+ ├── README.md
26
+ ├── client //web端代码 vue + element UI
27
+ ├── docker //使用docker部署的配置文件
28
+ ├── fabu_nginx.conf //server端nginx配置文件
29
+ ├── screenshots //屏幕截图
30
+ ├── server //服务端代码node+koa
31
+ └── wiki //todo 还在编写中
32
+ ```
33
+
34
+
35
+
36
+ #### 运行前准备
25
37
26
38
* 安装 MongoDB
27
39
* 安装 Nodejs
@@ -37,56 +49,97 @@ npm install -g pm2 babel-cli
37
49
npm install -g cnpm --registry=https://registry.npm.taobao.org
38
50
```
39
51
40
- #### 安装步骤
52
+ #### 运行步骤
41
53
42
54
1.clone 下载代码 ` git clone https://github.com/HeadingMobile/LoveFabu.git `
43
55
44
- 2.安装依赖
56
+ 2.运行server端
45
57
46
58
``` bash
47
59
# 进入项目根目录
48
-
60
+ cd server
49
61
cnpm install # 安装依赖
62
+ npm start
63
+
64
+ =============>> out
65
+ ...
66
+ ...
67
+ App is listening on 9898.
68
+ 数据库连接成功
69
+ =============>> end
50
70
```
51
71
52
- 3.修改运行配置
72
+ 3.编译运行前端页面
53
73
54
- //修改根目录config.json的配置文件
74
+ ``` Bash
75
+ cd client
76
+ cnpm install
77
+ npm run dev
55
78
56
- ``` bash
57
- {
58
- " url" :" http://127.0.0.1:9898" , # 前端请求的地址,本地运行需要带上端口号,
59
- " port" :" 9898" , # 后端程序运行的端口
60
- " secret" :" XXXX-XXXX" , # 加密字符串
61
- " dir" :" /Volumes/UserData/ProjectSource/NodeProject/upload" , # 静态文件上传目录
62
- " dbuser" :" xxx" ,# 数据库用户名 如果mongodb有设置认证信息需要配置dbuser和dbpass
63
- " dbpass" :" xxx" ,# 数据库密码
64
- }
79
+ ============>> out
80
+ ...
81
+ ...
82
+ DONE Compiled successfully in 18546ms
83
+ I Your application is running here: http://0.0.0.0:3009
84
+ ============>> end
65
85
```
66
86
67
- //也可以使用 ` node app config --url xxx --port xxx --dbuser xxx --dbpass xxx ` 进行配置
87
+ 4.使用浏览器打开进入 http://localhost3009即可进入应用
68
88
69
- 4.安装项目client和server的依赖
70
89
71
- ``` python
72
- node app init # 相当于cd client/ && cnpm install 和 cd server/ && cnpm install
73
- ```
74
90
75
- ``` python
76
- node app build # 编译前端工程,相当于cd client/ && npm run build
77
- ```
91
+ ##### 项目配置说明
78
92
79
- ``` python
80
- node app start
81
- # 运行项目, 相当于 cd server && pm2 start process.json
82
- # 如果不用pm2运行,在本地运行可以使用cd server && npm start
83
- # 使用 node app start -i -b , 相当于使用node app init && node app build && node app start
84
- # 修改根目录config文件之后,必须执行node app build,重新编译前端文件
93
+ ** 前端配置**
94
+
95
+ 无需配置
96
+
97
+ ** 后端配置**
98
+
99
+ 参见 server/config.js
100
+
101
+ ``` javascript
102
+ // 需要修改配置可以修改config.js文件,也可以在部署的时候导出环境变量
103
+ // 比如 export FABU_BASE_URL=https://127.0.0.1:9898
104
+
105
+ const common = {
106
+ // baseUrl应用请求的url地址,比如https://fabu.love
107
+ baseUrl: process .env .FABU_BASE_URL || " https://127.0.0.1:9898" ,
108
+ port: process .env .FABU_PORT || " 9898" , // server运行的端口
109
+ apiPrefix: ' api' ,
110
+ fileDir: process .env .FABU_UPLOAD_DIR || path .join (__dirname , " .." ), // 上传文件的存放目录
111
+ secret: process .env .FABU_SECRET || " secretsecret" , // secret
112
+ // 数据库用户 (没有开启mongodb用户认证的可以不填写)
113
+ dbUser: process .env .FABU_DBUSER || undefined ,
114
+ // 数据库密码 (没有开启mongodb用户认证的可以不填写)
115
+ dbPass: process .env .FABU_DBPWD || undefined ,
116
+ dbName: process .env .FABU_DB_NAME || " fabulove" , // 数据库名称
117
+ dbHost: process .env .FABU_DB_HOST || " localhost" , // 数据库地址
118
+ dbPort: process .env .FABU_DB_PORT || " 27017" , // 数据库端口
119
+
120
+ // 邮件相关配置 用于找回密码和邀请团队成员发送邮件
121
+ emailService: process .env .FABU_EMAIL_SERVICE || " qq" ,
122
+ emailUser: process .env .FABU_EMAIL_USER || " " ,
123
+ emailPass: process .env .FABU_EMAIL_PASS || " " ,
124
+
125
+ // 是否允许用户注册,为否则后端注册接口不可用
126
+ allowRegister: process .env .FABU_ALLOW_REGISTER || true ,
127
+
128
+ // 是否开启ldap 默认是false 如果公司没有ldap服务可以不用理会
129
+ openLdap: process .env .FABU_ALLOW_LDAP || false ,
130
+ ldapServer: process .env .FABU_LDAP_URL || " " , // ldap server url
131
+ ldapUserDn: process .env .FABU_LDAP_USERDN || " " , // ldap管理员dn 管理员用户名
132
+ ldapBindCredentials: process .env .FABU_LDAP_CREDENTIALS || " " , // ldap管理员密码
133
+ ldapBase: process .env .FABU_LDAP_BASE || " " // ldap base
134
+
135
+ };
85
136
```
86
137
87
138
88
139
89
- #### 正式环境部署配置 nginx
140
+
141
+
142
+ #### 正式环境部署 nginx配置
90
143
91
144
可以按照项目根目录的 fabu_nginx.conf 文件进行配置
92
145
@@ -95,7 +148,7 @@ server{
95
148
listen 80;
96
149
server_name fabu.love;
97
150
98
- # root目录为项目根目录的client/dist目录下
151
+ # root目录为项目根目录的client/dist目录下,前端静态页面
99
152
root /home/ubuntu/fabulove/client/dist;
100
153
index index.html;
101
154
@@ -105,17 +158,17 @@ server{
105
158
}
106
159
107
160
location /upload/ {
108
- # 该root目录为根目录下config.json文件里dir目录
161
+ # 该root目录为根目录下config.json文件里dir目录 上传的apk和ipa文件当作静态文件处理
109
162
root /home/ubuntu/fabulove/upload
110
163
expires 30d;
111
164
}
112
165
113
- location @router {
166
+ location @router { # vue的router配置
114
167
rewrite ^.* $ /index.html last;
115
168
}
116
169
117
- location /api/ {
118
- proxy_pass http://127.0.0.1:8383 ; # 这里端口修改为 config.json文件中的port内容
170
+ location /api/ { # 把以api打头的接口转发给后端server
171
+ proxy_pass http://127.0.0.1:9898 ; # 这里端口修改为后端服务运行的端口
119
172
proxy_set_header Host $host ;
120
173
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
121
174
}
0 commit comments