Deploying to Digital Ocean
Prerequisites
Step 1: Build and Transfer files to Digital Ocean Droplet
- Build the Application for the production environment
$ npm run build
- Zip the dist folder
$ tar cvfz dist.tar.gz dist
- Copy the Zip file to the Digital Ocean Droplet
$ sftp root@IP-of-droplet <<< $'put -r ./dist.tar.gz /path-on-server/'
Step 2: Deploy the code
- Connect to your Digital Ocean Droplet using SSH.
- Unzip the tar file and move it to desired dirtectory using the following command:
$ tar xvzf dist.tar.gz && mv dist /path/
- Start the server using:
$ node server.js
- (Optional) Start the process using any of the process managers(pm2 here):
$ cd /path && pm2 start server.js --name="my-site" -i 3 --watch