- Log into (Connect) the EC2 Instance
- Go into project folder and Git pull
- Restart pm2 using
pm2 restart 0
- OR: Setup new pm2 instance, if server path or name was changed (See chapter pm2)
After installing everything on an AWS EC2 instance for example, use the following to autostart the server, everytime the instance is started: https://levelup.gitconnected.com/deploying-a-node-app-on-amazon-ec2-d2fb9a6757eb
- Install pm2 by running the following command
npm install -g pm2
- Set up pm2 to start the server automatically on server restart.
pm2 start server.js
pm2 save
pm2 startup
- Note that after running the pm2 startup command we get a command starting with “sudo”.
- Copy that command from sudo till the end of the next line and paste it in the terminal and press enter. Now your node server is running and is set to start automatically whenever you restart the EC2 instance.
Commands: ➡️ pm2 website
More usefull commands:
pm2 list
pm2 describe 0
pm2 monit 0
pm2 delete <id>
#14908E
##039996
#B7AA67
#B2735B
#CB524F