Skip to content

Commit f94e1a1

Browse files
thonatosJacksonTian
authored andcommitted
chore: update deploy docs & enable alinode (#71)
* chore: enable egg-alinode while env === prod * chore: config alinode with env * chore: add env for alinode * docs: deploy with docker
1 parent 2ad70ee commit f94e1a1

File tree

4 files changed

+69
-8
lines changed

4 files changed

+69
-8
lines changed

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,59 @@ $ npm start
7373
$ npm stop
7474
```
7575

76+
#### Deploy with docker
77+
Setup redis / mongodb / egg-cnode, requirements:
78+
79+
- docker
80+
- docker-compose
81+
82+
**Modify Github Id/Secret**
83+
84+
```yml
85+
version: '3'
86+
services:
87+
cnode:
88+
environment:
89+
- EGG_PASSPORT_GITHUB_CLIENT_ID=test
90+
- EGG_PASSPORT_GITHUB_CLIENT_SECRET=test
91+
```
92+
93+
**Modify Alinode AppId/Secret**
94+
95+
```yml
96+
version: '3'
97+
services:
98+
cnode:
99+
environment:
100+
- EGG_ALINODE_APPID=appid
101+
- EGG_ALINODE_SECRET=secret
102+
```
103+
104+
> to disable alinode, modify config/plugin.prod.js
105+
106+
**Change Port**
107+
108+
```yml
109+
version: '3'
110+
services:
111+
cnode:
112+
ports:
113+
- ${PORT}:7001
114+
```
115+
116+
**Run / Stop**
117+
118+
```bash
119+
# start
120+
docker-compose up -d
121+
122+
# stop
123+
docker-compose down
124+
125+
# remove volume/cache
126+
docker-compose down -v
127+
```
128+
76129
### npm scripts
77130

78131
- Use `npm run lint` to check code style.

config/config.default.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ module.exports = appInfo => {
131131
ignoreTLS: true,
132132
};
133133

134-
exports.alinode = {
135-
enable: true,
136-
appid: '',
137-
secret: '',
134+
config.alinode = {
135+
// 从 `Node.js 性能平台` 获取对应的接入参数
136+
appid: process.env.EGG_ALINODE_APPID || '',
137+
secret: process.env.EGG_ALINODE_SECRET || '',
138138
};
139139

140140
return config;

config/plugin.prod.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
'use strict';
2+
3+
exports.alinode = {
4+
enable: true,
5+
package: 'egg-alinode',
6+
};

docker-compose.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ services:
1616
- EGG_MONGODB_URL=mongodb://egg_cnode:egg_cnode@mongodb:27017/egg_cnode
1717
- EGG_PASSPORT_GITHUB_CLIENT_ID=test
1818
- EGG_PASSPORT_GITHUB_CLIENT_SECRET=test
19+
- EGG_ALINODE_APPID=appid
20+
- EGG_ALINODE_SECRET=secret
1921
depends_on:
2022
- redis
2123
- mongodb
@@ -31,8 +33,8 @@ services:
3133
- egg-redis:/data
3234
networks:
3335
- docker_cnode
34-
ports:
35-
- 6379:6379
36+
# ports:
37+
# - 6379:6379
3638

3739
mongodb:
3840
image: mongo:3.2
@@ -46,8 +48,8 @@ services:
4648
- ./init.d/mongo:/docker-entrypoint-initdb.d
4749
networks:
4850
- docker_cnode
49-
ports:
50-
- 27017:27017
51+
# ports:
52+
# - 27017:27017
5153

5254
volumes:
5355
egg-mongo:

0 commit comments

Comments
 (0)