Skip to content

Commit

Permalink
pm2 runtime을 통한 서비스 설정 (10.05)
Browse files Browse the repository at this point in the history
pm2 runtime을 통한 서비스 설정 (10.05)
  • Loading branch information
seoko97 committed Oct 4, 2023
2 parents b3eb779 + 9368f77 commit ea32194
Show file tree
Hide file tree
Showing 94 changed files with 1,896 additions and 39 deletions.
1,006 changes: 987 additions & 19 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ COPY --from=builder /app/.pnp.cjs ./.pnp.cjs
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/yarn.lock ./yarn.lock
COPY --from=builder /app/.yarnrc.yml ./.yarnrc.yml
COPY --from=builder /app/pm2.yml ./pm2.yml

ENV NODE_ENV production
ENV PORT 4000
ENV HOSTNAME 0.0.0.0

EXPOSE 4000

CMD ["node", "-r", "./.pnp.cjs", "dist/main.js"]
CMD ["yarn", "start:prod"]
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"start:prod": "pm2-runtime pm2.yml",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest --runInBand",
Expand Down Expand Up @@ -39,6 +39,7 @@
"multer": "^1.4.5-lts.1",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
"pm2": "^5.3.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1"
},
Expand Down
12 changes: 12 additions & 0 deletions pm2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apps:
- script: dist/main.js
name: back
kill_timeout: 8000
error_file: /dev/null
out_file: /dev/null
instances: 2
exec_mode: cluster
listen_timeout: 50000
env_production:
NODE_ENV: production
node_args: --max_old_space_size=4096 -r=./.pnp.js
3 changes: 2 additions & 1 deletion src/routes/post/post.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export class PostService {
const post = await this.postRepository.create(rest);

if (seriesName) {
post.series = await this.seriesService.pushPostIdInSeries(seriesName, post._id);
const series = await this.seriesService.pushPostIdInSeries(seriesName, post._id);
post.series = series._id;
}

if (tagNames?.length) {
Expand Down
Loading

0 comments on commit ea32194

Please sign in to comment.