-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Lichess Development Onboarding (IntelliJ on Linux)
This page shows you how to set up lila
on an Ubuntu Linux machine with IntelliJ IDEA.
With this setup as a newcomer to Scala and SBT, you will greatly benefit from powerful features like autocompletion, library dependency management, code formatting, debugging functionalities and many more things.
Optionally (for an easy redis
and mongodb
setup): docker-compose
Install the official Scala plugin
git clone --recursive https://github.com/lichess-org/lila.git
git clone https://github.com/lichess-org/lila-ws.git
Thanks to the build.sbt file in the root folder, IntelliJ is smart enough to automatically detect the project as an SBT Scala project. The import should set up your project correctly:
Dependencies should be installed automatically:
Folder and project structure should be detected automatically:
You will be asked to use the default code formatter. Please choose scalafmt
:
Repeat for the lila-ws
project.
Working with the IDE and all its SBT features directly instead of the pure command line requires us to skip the ./lila SBT wrapper functionalities. We have to manually create our configurations once:
cp .sbtopts.default .sbtopts
cp conf/application.conf.default conf/application.conf
There are two integrated SBT tools you would want to use:
- SBT Tool window
- SBT Shell
Instead of directly installing redis and MongoDB as services on your machine, you could spin up a dockerized version instead:
Write a docker-compose.yml
file with those basic contents:
version: "3.3"
services:
redis:
image: "redis:alpine"
ports:
- 6379:6379
mongo:
image: mongo
restart: always
ports:
- 27017:27017
Spin up the containers with:
docker-compose up
And after use shut them down with:
docker-compose down
-
docker-compose up
to start the infrastructure -
./ui/build
to build CSS and JS - Open up the
lila
andlila-ws
projects in IntelliJ. - Go to the sbt shells in your IntelliJ projects and type
run
- Visit http://localhost:9663/
In the IntelliJ settings find the sbt build tools options and check Enable debugging
:
After reloading your project you should see a new button in your sbt shell:
Click it and a debugger will be attached to your SBT shell. You can now set breakpoints and debug through your code!