10/23/2017 - 4:32 PM

Start a new node.js droplet

How to get a site up and running on a fresh droplet build.

ssh root@IP/host

npm install -g n // installs node
n latest // sets to latest node version

bash // opens fresh tab within current tab

node -v // check version

cd /opt
clone git repo using https
cd into repo
npm install --production // must faster, leaves out dev tools
touch variables.env // create variables.env
vim variables // copy and paste dev variables.env into
[esc] + :wq to write or :quit to quit w/o writing

npm install - g forever // package that forever restarts your server script on failures/crashes
forever start start.js // start our server script

forever list // shows running processes
forever reset 0 // restarts app
forever logs 0 // lists console msgs, errors, etc.