pm2 only for dev; production uses docker-compose auto-restart

stable
brian 4 years ago
parent 90f5466317
commit 27861adeb8

@ -15,6 +15,8 @@ services:
build: build:
context: ./node/ context: ./node/
dockerfile: Dockerfile dockerfile: Dockerfile
# production: no reason to use pm2 if docker offers auto-restart
# development: don't use docker auto-restart; rather pm2, which can watch for file changes
#restart: always #restart: always
user: "node" user: "node"
environment: environment:
@ -27,7 +29,7 @@ services:
- postgres - postgres
working_dir: /home/node/app working_dir: /home/node/app
# for production (no file watching): # for production (no file watching):
# command: sh -c "yarn install && yarn pm2-runtime server.js" # command: sh -c "yarn install && node server.js"
# for development (file watching/reloading): # for development (file watching/reloading):
command: sh -c "yarn install && yarn pm2-dev server.js" command: sh -c "yarn install && yarn pm2-dev server.js"
postgres: postgres:

@ -6,9 +6,11 @@
"repository": "https://git.sakal.us/brian/pastebin-server.git", "repository": "https://git.sakal.us/brian/pastebin-server.git",
"author": "Brian Sakal <brian@sakal.us>", "author": "Brian Sakal <brian@sakal.us>",
"license": "MIT", "license": "MIT",
"devDependencies": {
"pm2": "^4.5.5"
},
"dependencies": { "dependencies": {
"express": "^4.17.1", "express": "^4.17.1",
"pg": "^8.5.1", "pg": "^8.5.1"
"pm2": "^4.5.5"
} }
} }

Loading…
Cancel
Save