TecKnow / muster-tools

A package for assigning players to tables at multi-table, walk-in gaming events.
GNU General Public License v3.0
0 stars 0 forks source link

Document creating a deployment droplet #23

Open TecKnow opened 3 years ago

TecKnow commented 3 years ago

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.

TecKnow commented 3 years ago

Consider starting with this tutorial: How To Set Up a Node.js Application for Production on Ubuntu 20.04

TecKnow commented 3 years ago

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

TecKnow commented 3 years ago

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

TecKnow commented 3 years ago

Then configure SSL following the instructions here:

https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-20-04

TecKnow commented 3 years ago

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.

TecKnow commented 3 years ago

The PM2 quick-start documentation includes a quick-reference that seems like it would be usefu:

https://pm2.keymetrics.io/docs/usage/quick-start/

TecKnow commented 3 years ago

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

TecKnow commented 3 years ago

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