Skip to content

Pm2 apply for production server #1307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ npm run build
npm run start
```

## Management Production Server

```bash
npm run restart
npm run stop
```

## Demo

A demonstration of this app can be seen [running on heroku](https://react-redux.herokuapp.com), which is a deployment of the [heroku branch](https://github.com/erikras/react-redux-universal-hot-example/tree/heroku).
Expand Down
24 changes: 4 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
],
"main": "bin/server.js",
"scripts": {
"start": "concurrent --kill-others \"npm run start-prod\" \"npm run start-prod-api\"",
"start-prod": "better-npm-run start-prod",
"start-prod-api": "better-npm-run start-prod-api",
"start": "pm2 start ./pm2.json",
"restart": "pm2 restart ./pm2.json",
"stop": "pm2 stop ./pm2.json",
"build": "better-npm-run build",
"postinstall": "npm run build",
"lint": "eslint -c .eslintrc src api",
Expand All @@ -39,23 +39,6 @@
"test-node-watch": "./node_modules/mocha/bin/mocha $(find api -name '*-test.js') --compilers js:babel-core/register --watch"
},
"betterScripts": {
"start-prod": {
"command": "node ./bin/server.js",
"env": {
"NODE_PATH": "./src",
"NODE_ENV": "production",
"PORT": 8080,
"APIPORT": 3030
}
},
"start-prod-api": {
"command": "node ./bin/api.js",
"env": {
"NODE_PATH": "./api",
"NODE_ENV": "production",
"APIPORT": 3030
}
},
"start-dev": {
"command": "node ./bin/server.js",
"env": {
Expand Down Expand Up @@ -116,6 +99,7 @@
"map-props": "^1.0.0",
"multireducer": "^2.0.0",
"piping": "^0.3.0",
"pm2": "^2.0.18",
"pretty-error": "^1.2.0",
"react": "^0.14.2",
"react-bootstrap": "^0.28.1",
Expand Down
25 changes: 25 additions & 0 deletions pm2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"apps" : [
{
"name": "react-redux-universal-hot-example",
"script": "./bin/server.js",
"exec_mode" : "fork",
"env": {
"NODE_PATH": "./src",
"NODE_ENV": "production",
"PORT": 8080,
"APIPORT": 3030
}
},
{
"name": "react-redux-universal-hot-example_api",
"script": "./bin/api.js",
"exec_mode" : "fork",
"env": {
"NODE_PATH": "./api",
"NODE_ENV": "production",
"APIPORT": 3030
}
}
]
}