Skip to content

Commit 545b350

Browse files
committed
update readme
1 parent 47075b0 commit 545b350

File tree

3 files changed

+108
-55
lines changed

3 files changed

+108
-55
lines changed

README.md

+93-40
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
typora-copy-images-to: ./screenshots
33
---
44

5-
####爱发布
5+
#### 爱发布
66

77
demo地址: https://fabu.love
88
该平台是类似于fir.im/蒲公英类似的一个平台.可以自己部署.
@@ -15,13 +15,25 @@ demo地址: https://fabu.love
1515

1616
后端使用 nodejs + koa
1717

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)
2219

20+
#### 项目结构
2321

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+
#### 运行前准备
2537

2638
* 安装 MongoDB
2739
* 安装 Nodejs
@@ -37,56 +49,97 @@ npm install -g pm2 babel-cli
3749
npm install -g cnpm --registry=https://registry.npm.taobao.org
3850
```
3951

40-
#### 安装步骤
52+
#### 运行步骤
4153

4254
1.clone 下载代码 `git clone https://github.com/HeadingMobile/LoveFabu.git`
4355

44-
2.安装依赖
56+
2.运行server端
4557

4658
```bash
4759
#进入项目根目录
48-
60+
cd server
4961
cnpm install #安装依赖
62+
npm start
63+
64+
=============>>out
65+
...
66+
...
67+
App is listening on 9898.
68+
数据库连接成功
69+
=============>>end
5070
```
5171

52-
3.修改运行配置
72+
3.编译运行前端页面
5373

54-
//修改根目录config.json的配置文件
74+
```Bash
75+
cd client
76+
cnpm install
77+
npm run dev
5578

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
6585
```
6686

67-
//也可以使用`node app config --url xxx --port xxx --dbuser xxx --dbpass xxx`进行配置
87+
4.使用浏览器打开进入http://localhost3009即可进入应用
6888

69-
4.安装项目client和server的依赖
7089

71-
```python
72-
node app init #相当于cd client/ && cnpm install 和 cd server/ && cnpm install
73-
```
7490

75-
```python
76-
node app build #编译前端工程,相当于cd client/ && npm run build
77-
```
91+
##### 项目配置说明
7892

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+
};
85136
```
86137

87138

88139

89-
#### 正式环境部署配置 nginx
140+
141+
142+
#### 正式环境部署 nginx配置
90143

91144
可以按照项目根目录的 fabu_nginx.conf 文件进行配置
92145

@@ -95,7 +148,7 @@ server{
95148
listen 80;
96149
server_name fabu.love;
97150

98-
#root目录为项目根目录的client/dist目录下
151+
#root目录为项目根目录的client/dist目录下,前端静态页面
99152
root /home/ubuntu/fabulove/client/dist;
100153
index index.html;
101154

@@ -105,17 +158,17 @@ server{
105158
}
106159

107160
location /upload/ {
108-
#该root目录为根目录下config.json文件里dir目录
161+
#该root目录为根目录下config.json文件里dir目录 上传的apk和ipa文件当作静态文件处理
109162
root /home/ubuntu/fabulove/upload
110163
expires 30d;
111164
}
112165

113-
location @router {
166+
location @router { # vue的router配置
114167
rewrite ^.*$ /index.html last;
115168
}
116169

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; #这里端口修改为后端服务运行的端口
119172
proxy_set_header Host $host;
120173
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
121174
}

screenshots/Artboard.png

291 KB
Loading

server/config.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@ var fs = require("fs")
22
var path = require("path")
33

44
const common = {
5-
baseUrl: process.env.FABU_BASE_URL || "https://127.0.0.1:9898",
6-
port: process.env.FABU_PORT || "9898",
5+
baseUrl: process.env.FABU_BASE_URL || "https://127.0.0.1:9898", //baseUrl应用请求的url地址,比如https://fabu.love
6+
port: process.env.FABU_PORT || "9898", //server运行的端口
77
apiPrefix: 'api',
88
fileDir: process.env.FABU_UPLOAD_DIR || path.join(__dirname, ".."), //上传文件的存放目录
9-
secret: process.env.FABU_SECRET || "secretsecret",
10-
dbUser: process.env.FABU_DBUSER || undefined,
11-
dbPass: process.env.FABU_DBPWD || undefined,
12-
dbName: process.env.FABU_DB_NAME || "fabulove",
13-
dbHost: process.env.FABU_DB_HOST || "localhost",
14-
dbPort: process.env.FABU_DB_PORT || "27017",
9+
secret: process.env.FABU_SECRET || "secretsecret", //secret
10+
dbUser: process.env.FABU_DBUSER || undefined, //数据库用户 (没有开启mongodb用户认证的可以不填写)
11+
dbPass: process.env.FABU_DBPWD || undefined, //数据库密码 (没有开启mongodb用户认证的可以不填写)
12+
dbName: process.env.FABU_DB_NAME || "fabulove", //数据库名称
13+
dbHost: process.env.FABU_DB_HOST || "localhost", //数据库地址
14+
dbPort: process.env.FABU_DB_PORT || "27017", //数据库端口
1515

16-
emailService: process.env.FABU_EMAIL_SERVICE || "qq", //邮件相关配置
17-
emailUser: process.env.FABU_EMAIL_USER || "",
16+
emailService: process.env.FABU_EMAIL_SERVICE || "qq", //邮件相关配置 用于找回密码和邀请团队成员发送邮件
17+
emailUser: process.env.FABU_EMAIL_USER || "",
1818
emailPass: process.env.FABU_EMAIL_PASS || "",
1919

2020
allowRegister: process.env.FABU_ALLOW_REGISTER || true, //是否允许用户注册,为否则后端注册接口不可用
2121

22-
openLdap: process.env.FABU_ALLOW_LDAP || false,
23-
ldapServer: process.env.FABU_LDAP_URL || "",
24-
ldapUserDn: process.env.FABU_LDAP_USERDN || "",
25-
ldapBindCredentials: process.env.FABU_LDAP_CREDENTIALS || "",
26-
ldapBase: process.env.FABU_LDAP_BASE || ""
22+
openLdap: process.env.FABU_ALLOW_LDAP || false, //是否开启ldap 默认是false 如果公司没有ldap服务可以不用理会
23+
ldapServer: process.env.FABU_LDAP_URL || "", //ldap server url
24+
ldapUserDn: process.env.FABU_LDAP_USERDN || "", //ldap管理员dn 也就是管理员用户名
25+
ldapBindCredentials: process.env.FABU_LDAP_CREDENTIALS || "", //ldap管理员密码
26+
ldapBase: process.env.FABU_LDAP_BASE || "" //ldap base
2727

2828
};
2929

0 commit comments

Comments
 (0)