-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Lichess Development Onboarding (Windows)
The following instructions explain how to set up your development environment for Lichess on Windows.
GNU/Linux instructions: https://github.com/ornicar/lila/wiki/Lichess-Development-Onboarding
-
Clone the lila project to your computer:
git clone https://github.com/ornicar/lila.git
-
Using the command prompt, navigate to the directory where you cloned it into:
cd lila
-
Set up the submodules:
git submodule update --init --recursive
-
The dependencies have to be built now. You can use this
build-deps.bat
script, based onbin/build-deps.sh
: https://gist.github.com/ProgramFOX/e4d03e7f11e27814a044b52982234b8c -
This script does not include one necessary dependency,
scala-kit
, because that one has to be installed manually: the auto-install only seems to work on Linux because sbt for Windows doesn't like the-D<name>=<value>
syntax to specify an option, which we need for this dependency.-
Clone scala-kit:
git clone https://github.com/ornicar/scala-kit.git
and navigate to its directory:cd scala-kit
-
Run
git checkout b019b3a2522d3f1697c39ec0c79e88c18ea49a91
-
Go to
project\Build.scala
, where you see the lineval buildVersion = Option(System.getProperty("version")).map(_.trim).getOrElse("1.0-SNAPSHOT")
and change it into:val buildVersion = "1.2.11-THIB"
-
Run
sbt publish-local
-
Delete the
scala-kit
directory.
-
-
Before we compile, we have to change some options related to the memory management of Java, otherwise you'll get an OutOfMemoryException.
set JAVA_OPTS=-Xms64M -Xmx2048M -Xss4M -XX:ReservedCodeCacheSize=64m -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC
-
If you want to compile now, you'll run into an
UnmappableCharacterException
from the i18n module. It looks like it's related to something with the encoding, but I couldn't figure out the root cause of the issue. There is a workaround though: inmodules\i18n\messages\
, delete everything except themessages
file (the one without file extension). This works unless you want to do something specific to the i18n module, so it's still very ugly. If you find a better way to make the compilation work - without deleting the messages files - please edit this section. Also note that if you want to make a Git commit to submit a pull request to lila, make sure that you do not accidentally commit the deletion of these messages files. -
Compile the application using
sbt compile
. -
Run
npm install -g gulp-cli
to be able to build the lichess UI. -
Run this
build-ui.bat
script to build the UI (based onui/build
): https://gist.github.com/ProgramFOX/5608e07f81daa6a4aa5b9501c684bdf4 -
Download http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz and unpack it. Then create a
data
folder in your lila application root and put GeoLite2-City.mmdb in there.
-
Add the following line to your hosts file (
C:\Windows\System32\drivers\etc\hosts
):127.0.0.1 l.org socket.l.org en.l.org
-
Open your
nginx.conf
file, and add this 'Server' block to thehttp
block:server { server_name l.org ~^\w\w\.l\.org$; listen 80; error_log logs\lila.access.log; access_log logs\lila.error.log; charset utf-8; location /assets { add_header "Access-Control-Allow-Origin" "*"; alias <path\to\>\lila\public; } location / { proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 90s; proxy_http_version 1.1; proxy_pass http://127.0.0.1:9663/; } error_page 500 501 502 503 /oops/servererror.html; error_page 504 /oops/timeout.html; error_page 429 /oops/toomanyrequests.html; location /oops/ { root <path\to\>\lila\public; } location = /robots.txt { root <path\to\>\lila\public; } } server { server_name socket.l.org; listen 80; charset utf-8; location / { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://127.0.0.1:9663/; } }
Don't forget to change <path\to\>
into an actual path.
-
Navigate into the
conf
directory of your lila application root. Create a fileapplication.conf
with these contents:include "base" net { domain = "l.org" asset.domain = "en.l.org" extra_ports = [] } geoip { file = "data/GeoLite2-City.mmdb" } http { port = 9663 }
-
Make sure nginx is running.
-
Make sure a MongoDB server instance is running.
-
Run
sbt
. -
When you can input a command, type
run 9663
and press enter. -
In your browser, navigate to
l.org