Files
vic-server-mongo/README.md
Luk Lu ef4a254dee u
2021-07-06 19:27:32 +08:00

55 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# vic.server.mongo | 个性价值.服务端.mongo
导航路径 [Organizations](https://git.faronear.org/explore/organizations)
- 应用链 [tac/\_tac](https://git.faronear.org/tac/_tac)
- 个性价值 [tac/vic](https://git.faronear.org/tac/vic)
- **<font size=5>服务端.mongo [tac/vic.server.mongo](https://git.faronear.org/tac/vic.server.mongo)</font>**
## 安装
参见 <https://www.mongodb.com/>,分别把 mongodb 和 vic.server.mongo 安装到 /mongodb 和 /tac/vic.server.mongo
## 配置
- 设置 ssl 证书
```
certbot certonly -d server.vic.yuanjin.net
```
- mongodb 设置数据库账号
- mongodb 配置文件已集成到 `vic.server.mongo/mongod.conf` 中
- bindIp: 127.0.0.1 (生产环境)
- bindIpAll: true (开发环境)
- 编写 `/tac/vic.server.mongo/configSec.js`,设置 HD 钱包的根密钥等等
- protocol: https (生产环境)
- protocol: http (开发环境)
- port: 6842 (不要用 80/443因为这要留给 certbot)
## 运行
1. 启动 mongodb
```
sudo /mongodb/bin/mongod -f /tac/vic.server.mongo/mongod.conf --logpath /data/log/mongo.log
```
以上命令已经被集成到 package.json 中,也可通过 npm 调用:
```
sudo npm run mongod
```
2. 启动 vic.server.mongo
```
cd /tac/vic.server.mongo
node index.js
```
或者
```
sudo npm run drive.pm2
```
## 部署
- 应用后台主机 `server.vic.yuanjin.net`,用户名 `tic`