This is the way I do it, not all steps are necessary.
- Create a Linode Or DigitalOcean Droplet. They are both good.
- Initial server setup
3. Install Node
5. Create database:
mysql
CREATE DATABASE name;
6. If you want emoji's in your database too, set database to support full Unicode using this guide.
7. Link the domain to CloudFlare's name servers "dana.ns.cloudflare.com" and "paul.ns.cloudflare.com".
8. On CloudFlare, set DNS to link the server domain to the IP of the server you just set up.
9. Add deploy key to your repo in GitHub. To do this, run the following command on the server
ssh-keygen
Then run:
cat /home/[USER]/.ssh/id_rsa.pub
The printed string should be pasted into GitHub->settings->deploy keys->add deploy key
Running the express app
- Clone your repo into the server.
git clone [SSH URL to be found on your repo]
2. try to run it
npm run dev
Does it work? PM2 is a good tool to run it for a longer term. If the server reboots, PM2 makes sure the app is rebooted too.