Comments (3)
I just deployed on DigitalOcean droplet and this worked.
I reckon it should work for EC2 as well.
start:prod
script under packages.json
gave me some clues
"start:prod" : "cross-env NODE_ENV=production node index.js"
According to this we need to set environment as production and then run index.js
pm2 config and setup
Step 1:
cd
to project folder
Step 2: Create ecosystem.config.js
file for pm2
with the following config
module.exports = {
apps : [{
name : 'MERN',
script : 'index.js',
env: {
NODE_ENV: 'development'
},
env_production : {
NODE_ENV: 'production'
}
}],
};
Replace 'MERN' with your app's name so it will show in pm2 list.
Step 3: Start app's process using pm2
For production -
pm2 start --env production
For development -
pm2 start --env development
You should see following output
App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼──────┼───────────┼──────┼──────────┤
│ MERN │ 0 │ fork │ 29305 │ online │ 0 │ 3m │ 0.1% │ 93.4 MB │ root │ disabled │
Thats it! 👍 Your app is now up and running.
Hope this helps!
Please let me know how it goes.
Some basic pm2 operations / [ replace MERN with your app name]
Stop App
pm2 stop MERN
Start App
pm2 start MERN
Monitor App
pm2 monit MERN
Delete App
pm2 delete MERN
Show list of running pm2 processes
pm2 list
from mern-starter.
Hi,
Thanks for the response. Let me spin up an instance with all these changes and I will update if it worked. Once again, thanks.
from mern-starter.
Will close for the time being, feel free to reopen if there is still an issue related to the repo itself.
from mern-starter.
Related Issues (20)
- Problem with production mode in server HOT 2
- TypeError: Cannot read property 'table' of undefined HOT 1
- postcss-cssnext is technically deprecated HOT 1
- Upgrading to webpack 4 breaks the mern-starter HOT 1
- Error importing header / footer background image HOT 4
- this.props.history is undefined Trying to access history object HOT 2
- Website is lacking pictures HOT 1
- Upgrade to React Router (MERN 2.6) HOT 6
- Add provision for code-splitting as required
- Can't resolve DNS host HOT 2
- The images on mern.io requested from res.cloudinary.com are resulting in 401 errors (and thus aren't successfully loading)
- Error comment in scss file HOT 1
- How to integrate Reactstrap into mern-starter HOT 4
- Code execution continues when it should stop in POST action HOT 1
- 3.0啥时候好呢,我们等的黄瓜菜都凉了! HOT 2
- RESTful MERN in Typescript - A new project other than this one
- MSBuild.exe` failed with exit code: 1
- Grammatical error on Twitter redirecting text 📝
- Alternative to this repo : Mern Starter Project
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mern-starter.