This a test repo that we deployed on our workshop (https://www.meetup.com/jsheroes/events/268349025/). I has a frontend application and an api.
What did we do:
-
Createad out Digital Ocean account
-
Created our VM / Droplet with Ubuntu 18, standard plan and 5$ per month (enough for our testing porpouse ). Use this link https://m.do.co/c/34f48445bac1 to get 100$ credit for 60 days.
-
added our SSH key to Digital Ocean
-
Some of us used launch console to login in the droplet (remember user is root, you can get your password by reseting it)
-
Cloned this repo
-
Installed node with a specific version:
bash curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
andbash apt install nodejs
-
We blocked all the incomming network request using ufw (Uncomplicated Firewall), remember by default its inactive:
ufw status
(checks the status)ufw default deny incoming
ufw default allow outgoing
ufw allow ssh
// do this before enabling the firewallufw enable
ufw allow 8080
// how to open ports to accept incoming requestsufw allow 3000
// don't forget to open the port for the api
-
Changed the api link in the frontend repo to use the ip of the server(use your custom domain name if you will have one attached to droplet) and rebuild the project
-
Installed pm2 to help us manage processed
npm install pm2 -g
pm2 start node index.js --name frontend
// starting the small express server that servers the frontend build distpm2 start npm -- start
// the other option to start with an npm script, we used this for starting the api and our test database (json-server)pm2 stop frontend
pm2 status
pm2 logs
-
Reminder... don't forget to delete your droplets if you don't use them. Else you will have to pay for them.