summaryrefslogtreecommitdiff
path: root/INSTALL.md
blob: dadc815b773c40f21e23226d5b6ce922daa782e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
## 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 framework.

Check out the game submodules:

```
git clone https://git.rally-the-troops.com/modules/julius-caesar public/julius-caesar
```

Initialize the database:

```
sqlite3 db < schema.sql
sqlite3 db < public/julius-caesar/title.sql
```

Configure the server using the .env file:

```
NODE_ENV=production

SITE_NAME=Example
SITE_URL=https://example.com

HTTP_HOST=localhost
HTTP_PORT=8080

MAIL_FROM=Example <notifications@example.com>
MAIL_HOST=localhost
MAIL_PORT=25
```

If MAIL_HOST/PORT/FROM are not present, the server will not send notification emails.

Start the server:

```
node server.js
```

To use SSL you should run the site behind a reverse proxy server, such as Nginx.
Here is an example Nginx configuration:

```
server {
	listen 80;
	server_name example.com www.example.com;
	return 301 https://$host$request_uri;
}

server {
	listen 443 ssl;
	server_name example.com www.example.com;
	ssl_certificate /path/to/ssl/certificate/fullchain.cer;
	ssl_certificate_key /path/to/ssl/certificate/example.com.key;
	root /path/to/server/public;
	location / {
		try_files $uri @rally;
	}
	location @rally {
                proxy_pass http://127.0.0.1:8080;
                proxy_http_version 1.1;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_read_timeout 3600s;
                proxy_send_timeout 3600s;
        }
}
```