Sawtaytoes / Tabletop-Helper

WebApp to help out with tabletop game calculations

Home Page:https://tabletophelper.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tabletop Helper

Prerequisites

Required

Optional

  • MailDev Local Mail Server for Testing Email

Setup

Config Settings

Default configs are config-settings.js. Here's an example of what defaults might look like

env: 'production',                            // Can be 'development' or 'production'.

//- Server
protocol: 'http',                             // Using `https` requires valid certificates.
hostname: '0.0.0.0',                          // Can be 0.0.0.0 for binding to all ports.
port: 3000,                                   // Port of webserver.
// proxyPort: 3001,                           // Optional. Will be `port + 1` if not defined.

//- Testing
testsPath: '/tests',                          // Path used when performing unit-tests

//- Email Submission
mailSendPath: '/contact/send',                // Path that's used when doing a POST to send mail.
mailOptions: {                                // Options for Nodemailer.
	from: 'Fake User <fake.user@example.com>', // When sending mail, this appears in the `FROM` field
},
smtpCredentials: {                            // Configuration for a local maildev server.
	host: 'localhost',
	port: 1025,
	tls: {
		rejectUnauthorized: false,
	}
}

To override these configs, either setup Node env vars such as: NODE_ENV, PROTOCOL, HOSTNAME, PORT, etc or create a ./includes/config.coffee file and have it return an object with overrides like so:

module.exports = {
	env: 'development',
	protocol: 'https',
	port: 443,
}

SMTP Configuration

Example using maildev (npm i -g maildev):

smtpCredentials: {
	host: 'localhost',
	port: 1025,
	tls: { rejectUnauthorized: false },
}

Example gmail.com string:

smtpCredentials: 'smtps://user%40gmail.com:pass@smtp.gmail.com'

Start the local catch-all SMTP server using the command maildev.

Web Server Setup

Development: Local

yarn start

OR

bash local.sh

OR

node index.js

Production: Hosted VPS

Using PM2

Start the Server

Start a single server for testing:

bash server.sh

Start a cluster of 3 servers for load balancing in production:

bash server.sh 3

The number 3 can be replaced with any number. The default is 0: equal to the number of CPU cores.

Update from Git and Restart

bash update.sh

If you update the update.sh file, make sure to run git pull prior to running the update script.

Stop the Server

bash stop-server.sh

Create SSL Cert

Make sure to run this command to upgrade pip before starting:

pip install --upgrade pip

Optionally, you can upgrade Let's Encrypt:

cd /usr/share/letsencrypt/
git pull

Replace SERVER_NAME with the website address.

service nginx stop

/usr/share/letsencrypt/letsencrypt-auto certonly \
-a standalone \
-d www.SERVER_NAME \
-d SERVER_NAME \
--server https://acme-v01.api.letsencrypt.org/directory

service nginx start

Or try this experimental approach:

/usr/share/letsencrypt/letsencrypt-auto certonly \
-a nginx \
-d www.SERVER_NAME \
-d SERVER_NAME \
--server https://acme-v01.api.letsencrypt.org/directory

When running the Let's Encrypt with, it requires installing the NGINX plugin:

cd /usr/share/letsencrypt/
~/.local/share/letsencrypt/bin/pip install -U letsencrypt-nginx

Let's Encrypt allows renewing using:

/usr/share/letsencrypt/letsencrypt-auto renew

Create & Update Dev SSL Certs

For ServiceWorker compatibility, update or use these certs along with https in network-protocol.

Using ZeroSSL:

  • Account ID is 2400598
  • Files are located in conf/

Linting

Install packages globally for Sublime Text's SublimeLinter-contrib-eslint plugin.

npm i -g babel-eslint eslint-plugin-react

About

WebApp to help out with tabletop game calculations

https://tabletophelper.com

License:MIT License


Languages

Language:JavaScript 88.1%Language:Stylus 11.5%Language:Shell 0.4%