When getting this app ready, please do the following:
These commands are specific to Ubuntu but the instructions are not
Anything in all CAPS or within {}
should be replaced accordingly.
- Clone this Repository into a sub directory. Logs will be saved 2 levels above the server.js file within var directory.
- Install node (
sudo apt install nodejs
) - Install n globally (
sudo npm install -g n
) through npm - Install the latest stable verion of node using n (
sudo n stable
) - Create a symlink for this version of node that links to the command
node
:sudo ln -sf /usr/local/n/versions/node/{VERSION}/bin/node /usr/bin/node
- Install pm2 globally (
sudo npm install -g pm2
) - Go to the root directory of this app and run
npm update
and thennpm install
- (Optional)Execute
sudo env PATH=$PATH:/usr/local/bin /usr/local/lib/node_modules/pm2/bin/pm2 startup systemd -u {$USER} --hp /home/{$USER}
in order to setup pm2 to run as a service on boot. This will initialize pm2 with whatever was stored from a pm2 dump or pm2 save. - To get running locally follow these directions, otherwise go to step 10.
pm2 install pm2-githook
cp module_conf.json ~/.pm2/
; that hidden pm2 directory is the default locationpm2 restart pm2-githook
pm2 startOrRestart ecosystem.config.js --env production
- (Optional)
pm2 save
. This is to allow the app to be brought back with pm2 resurrect or to start on boot.
- If running locally go to step 11. Follow these directions to launch this on a remote server.
- ssh into the remote server as the User intended to be used.
- Within ~ directory create a directory to store the resulting source directory after deploying.
- Do steps 2-6 on the remote server.
- Setup password-less ssh between local and remote.
- Setup ssh access to github on the remote.
- Close the ssh session and return to the root directory of the app on the local machine.
- Modify the ecosystem.config.js file with the correct user, path, host, etc. within the Deployment section. pre-deploy and post-deploy should be left alone.
- Execute
pm2 deploy ecosystem.config.js production setup && pm2 deploy ecosystem.config.js production
- That's it!!! The app should be running on port 3000 as that is the default Node port. This can be modified in either server.babel.js or by setting a PORT environment variable.