Open TecKnow opened 3 years ago
Consider starting with this tutorial: How To Set Up a Node.js Application for Production on Ubuntu 20.04
Following the instructions in the link above, configured the firewall and a regular user account using the instructions here:
https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-20-04
Following the instructions in the second comment, next configure nginx using the instructions here:
https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-20-04
Then configure SSL following the instructions here:
Complete the tutorial linked in the second comment, here
This approach uses a tool called pm2 to manage production processes and keep the application running, so investigate its documentation.
The PM2 quick-start documentation includes a quick-reference that seems like it would be usefu:
Here is a guide on creating a command-line script through an NPM package. I don't know if this will be useful, but it may be a way to "public" through NPM without including an additional package that can depend on, import, and use the actual top level package.
https://medium.com/netscape/a-guide-to-create-a-nodejs-command-line-package-c2166ad0452e
Here is the expressjs web page on production deployment. It suggests setting environment variables for production applications in the systemctl unit file. Since PM2 has - as far as I know - only a single unit file, the method that it provides for setting environment variables for the processes that it manages may be the best alternative.
https://expressjs.com/en/advanced/best-practice-performance.html
The demonstration application will be deployed on DigitalOcean, and this will require configuring a virtual machine called a Droplet to host the application. Thankfully, DigitalOcean generally has good guides for configuring droplets for various purposes.
This process should be document on the project wiki so that it can be repeated easily.