]> git.cworth.org Git - lmno-server/blob - README
Add some autofocus attributes to several forms
[lmno-server] / README
1 Server-side implementation for LMNO games.
2
3 This repository contains the server-side implementation for a number
4 of games that are hosted at the https://lmno.games/ website.
5
6 Dependencies
7 ------------
8
9 This implementation requires nodejs which can be installed (on a
10 Debian system at least) with:
11
12         sudo apt-get install nodejs
13
14 Additionally, you'll need to make available a number of third part
15 node libraries. This is most convenient to by using npm which can be
16 done as follows:
17
18         sudo apt-get install npm # To install npm install
19         npm install # To install dependencies into node_modules
20
21 Deployment
22 ----------
23
24 The initial deployment of the LMNO server requires configuring a web
25 server. Instructions are provided below for any web server, along with
26 specific configuration examples for Apache. If you are using a
27 non-Apache server (such as nginx) the general concepts will still
28 apply, but the syntax of the configuration will be different.
29
30 First, you need to configure your web server to serve the static
31 content of the LMNO implementation. This static content is actually in
32 a separate git repository (lmno.games) which you should be able to
33 find near where you found the current repository (lmno-server).
34
35 So, first, copy the static files from the lmno.games repository to
36 your server (there's a "make deploy" target in the lmno.games
37 repository's Makefile that can help with this).
38
39 Then, configure your web server to serve the content that you have
40 deployed. Specifically, you want the server to match the path from the
41 request to the local filesystem and serve the local file whenever
42 there is a match. The syntax for this with Apache is as follows
43 (substitute the path you chose if anything other than
44 "/srv/lmno.games/www"):
45
46         DocumentRoot /srv/lmno.games/www
47         <Directory /srv/lmno.games/www>
48                 Options Indexes
49         </Directory>
50
51         <Location />
52                 Require all granted
53         </Location>
54
55         RewriteEngine on
56
57         # Any static files (or directories) that exist within the
58         # DocumentRoot are served directly by Apache as a first priority.
59         RewriteCond %{DOCUMENT_ROOT}/$1 -f [OR]
60         RewriteCond %{DOCUMENT_ROOT}/$1 -d
61         RewriteRule (.*) - [L]
62
63 Note: The above configuration requires both the "rewrite" and "proxy"
64 and "proxy_http" Apache modules to be installed and enabled. On some
65 operating systems this can be achieved with the following commands:
66
67         sudo a2enmod rewrite
68         sudo a2enmod proxy
69         sudo a2enmod proxy_http
70
71 Also, you will need to configure Apache to proxy to the node server
72 any requests that _don't_ match a static file. Assuming you're running
73 the LMNO node server on port 4000 (which the code currently defaults
74 to) you would add the following Apache configuration just after the
75 block above:
76
77         # Otherwise, for any path that does not exist in the filesystem
78         # we proxy to the dynamic web app to let it serve the resource.
79         RewriteRule ^/(.*)$ http://localhost:4000/$1 [P]
80         ProxyPassReverse / http://localhost:4000
81
82 And, of course, after changing Apache configuration, you'll need to
83 restart the Apache service.
84
85 Finally, you'll need to arrange to start the node process on port 4000
86 that will serve the dynamic LMNO content. This is as simple as
87 running:
88
89         node lmno
90
91 Which must be run from the directory containing the lmno.js file. And
92 of course, this could be wired into an lmno service to enable this to
93 be started each time the machine boots.
94
95 Once this configuration is complete and working, any updates to the
96 code will simply requiring terminating the node process and then
97 starting it up again.
98
99 Development
100 -----------
101
102 For testing changes to the implementation locally, we recommend doing
103 the exact same deployment described above on a local machine, (that
104 is, configure a web server to serve static content from the lmno.games
105 repository and to proxy dynamic content to the node process). You
106 might simply configure and access this at http://localhost/ if you're
107 not already using a local web server for any other purpose. Otherwise,
108 configure your webserver with whatever hostname and top-level path you
109 prefer.