From 1f060bf2ef8b3d475b0d37d32bab73e1a601ea11 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 31 Dec 2021 22:05:18 +0100 Subject: Parameterize site name and domain. --- INSTALL.md | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 INSTALL.md (limited to 'INSTALL.md') diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..1d1ecba --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,62 @@ +## Setting up the server + +All data is stored in an SQLite3 database. + +The server and game rules are implemented in Javascript. +The game state is stored in the database as a JSON blob. +The server runs on Node with the Express.js and Socket.io frameworks. + +Check out the game submodules: + +``` +git clone https://github.com/rally-the-troops/julius-caesar.git public/julius-caesar +``` + +Initialize the database: + +``` +sqlite3 db < schema.sql +sqlite3 db < public/julius-caesar/title.sql +``` + +Redirect port 80 and 443 to 8080 and 8443: + +``` +sudo iptables -A PREROUTING -t nat -p tcp --dport 80 -j REDIRECT --to-ports 8080 +sudo iptables -A PREROUTING -t nat -p tcp --dport 443 -j REDIRECT --to-ports 8443 +``` + +Create SSL certificate with Let's Encrypt certbot, or self-signed with OpenSSL: + +``` +openssl req -nodes -new -x509 -keyout key.pem -out cert.pem +``` + +Configure the server using the .env file: + +``` +NODE_ENV=production + +SITE_NAME=YOUR_SITE_NAME +SITE_URL=https://YOUR_DOMAIN + +HTTP_PORT=8080 + +HTTPS_PORT=8443 +SSL_KEY=/etc/letsencrypt/live/YOUR_DOMAIN/privkey.com +SSL_CERT=/etc/letsencrypt/live/YOUR_DOMAIN/fullchain.pem + +MAIL_FROM=YOUR_SITE_NAME +MAIL_HOST=localhost +MAIL_PORT=25 +``` + +If the HTTPS_PORT is missing, the server will only serve HTTP. + +If MAIL_HOST/PORT/FROM are not present, the server will not send notification emails. + +Start the server: + +``` +node server.js +``` -- cgit v1.2.3