2012-04-01 11:48:13 -06:00
|
|
|
lichess.org
|
|
|
|
===========
|
2012-02-19 04:55:30 -07:00
|
|
|
|
2013-04-05 06:35:29 -06:00
|
|
|
Complete source code of http://lichess.org,
|
2013-05-04 14:14:12 -06:00
|
|
|
using Scala 2.10.1, Play 2.1, Akka 2, ReactiveMongo and Scalaz
|
2012-04-25 14:15:35 -06:00
|
|
|
|
2012-06-18 06:36:49 -06:00
|
|
|
Installation
|
|
|
|
============
|
2012-04-25 14:15:35 -06:00
|
|
|
|
2012-06-18 06:36:49 -06:00
|
|
|
This is full-stack application, not a library, and it may not
|
|
|
|
be straightforward to get it fully running.
|
|
|
|
I assume you run a Unix with mongodb.
|
|
|
|
|
2012-08-01 02:44:04 -06:00
|
|
|
> Some steps of the installation will trigger a download of the galaxy. It will take ages.
|
2012-06-18 06:36:49 -06:00
|
|
|
|
|
|
|
```sh
|
|
|
|
git clone git://github.com/ornicar/lila
|
|
|
|
cd lila
|
2013-05-06 03:26:15 -06:00
|
|
|
git submodule update --init
|
2012-08-01 02:44:04 -06:00
|
|
|
bin/play compile
|
2012-06-18 06:36:49 -06:00
|
|
|
```
|
|
|
|
|
2012-08-01 02:44:04 -06:00
|
|
|
Configuration
|
|
|
|
-------------
|
2012-06-18 06:36:49 -06:00
|
|
|
|
2012-08-01 02:44:04 -06:00
|
|
|
```sh
|
2013-05-06 03:26:15 -06:00
|
|
|
cp conf/application.conf.dist conf/application.conf
|
2012-06-18 06:36:49 -06:00
|
|
|
```
|
|
|
|
|
2013-05-10 08:07:47 -06:00
|
|
|
`application.conf` extends `base.conf` and can override any value.
|
|
|
|
Note that `application.conf` is excluded from git index.
|
2012-06-18 06:36:49 -06:00
|
|
|
|
2013-06-05 02:34:24 -06:00
|
|
|
Language subdomains
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
When accessed from the root domaing (e.g. lichess.org),
|
|
|
|
the application will redirect to a language specific subdomaing (e.g. en.lichess.org).
|
|
|
|
Additionally, lichess will open websockets on the `socket.` subdomain (e.g. socket.en.lichess.org).
|
|
|
|
Here is my local nginx configuration for `l.org`, assuming lila is installed in `/home/thib/lila` and runs on port 9000.
|
|
|
|
|
|
|
|
```conf
|
|
|
|
# Websockets
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
server_name ~^socket\.\w\w\.l\.org$;
|
|
|
|
|
|
|
|
location / {
|
|
|
|
include lila-proxy.conf;
|
|
|
|
proxy_read_timeout 5s;
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
proxy_pass http://127.0.0.1:9000/;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Application
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
server_name l.org ~^\w\w\.l\.org$;
|
|
|
|
|
|
|
|
location /assets {
|
|
|
|
alias /home/thib/lila/public;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /serve {
|
|
|
|
alias /home/thib/lila/serve;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /import {
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_read_timeout 60s;
|
|
|
|
proxy_pass http://127.0.0.1:9000/import;
|
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
|
|
|
add_header "X-UA-Compatible" "IE=Edge,chrome=1";
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_read_timeout 90s;
|
|
|
|
proxy_pass http://127.0.0.1:9000/;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
And the `/etc/hosts` file looks like:
|
|
|
|
|
|
|
|
```
|
|
|
|
127.0.0.1 l.org
|
|
|
|
127.0.0.1 en.l.org
|
|
|
|
127.0.0.1 fr.l.org
|
|
|
|
127.0.0.1 socket.en.l.org
|
|
|
|
127.0.0.1 socket.fr.l.org
|
|
|
|
```
|
|
|
|
|
2012-06-18 06:36:49 -06:00
|
|
|
Run it
|
|
|
|
------
|
|
|
|
|
2013-05-10 08:07:47 -06:00
|
|
|
Launch the play console:
|
2012-06-25 05:56:13 -06:00
|
|
|
|
2012-08-01 02:44:04 -06:00
|
|
|
```sh
|
|
|
|
bin/play
|
2012-06-18 06:36:49 -06:00
|
|
|
```
|
2012-08-01 02:44:04 -06:00
|
|
|
|
|
|
|
From here you can now run the application (`run`).
|