6.0 KiB
HOWTO Set up Your Own Chess Server
This document shows how to install a chess server. The free software application Lila, written by the fine developers at https://lichess.org, will be used.
Overview
System will be built from these main parts listed below. You don't need to know all of these, but knowing some system administration will help.
-
OVH ISP.
-
Debian Debian stable (Bullseye/11).
-
Lila.
-
Lila-ws.
-
Apache.
-
MongoDB.
-
Redis.
-
Scala.
-
Java.
-
SBT.
-
Yarn.
-
Python.
-
Git.
-
Node.
-
Certbot.
-
DNS.
-
All the way down to GRUB and below...
Upstream
The best current upstream document describing the process is here:
https://github.com/ornicar/lila/wiki/Lichess-Development-Onboarding
Main upstream repos:
Pre-Installation Setup
First, you need to have a location to host the server. You will want a server with a minimum of 4 gigs of RAM. When the server is running, usage is low, but it takes awhile to compile, so more CPU/RAM will speed that up.
For this example, we'll set up at OVH, which is the same Internet company that lichess.org uses.
You will also need a domain and someone providing domain name service (DNS). OVH provides this service (presumably?) or I recommend Njalla.
Register DNS
Since it takes awhile to spread across the Internet, it is best to first register your domain so that process can happen in the background while you are setting up the server.
For this example, we'll use the domain mychestserver.org
.
Go to your registrar, and register your domain, such as:
Register at ISP
Go to OVH (or ISP of your choice) and create an account to host your server. OVH may have regional websites as well:
Set up Workstation SSH Keys
To connect to the server, you will need SSH keys. They'll be needed at time
of server creation, so we'll make them now. This is an example how to create
keys on a Debian stable workstation, where the username is "debian" and
the workstation name is "workstation". For OVH, we're creating ecdsa
keys,
which is inferior to ed25519
keys. Last I tested, OVH doesn't accept the
latter.
# Run command to create keys.
# Note the location where you saved the key.
# Just hit "enter" for a passphrase.
debian@workstation:~$ ssh-keygen -t ecdsa
Generating public/private ecdsa key pair.
Enter file in which to save the key (/home/debian/.ssh/id_ecdsa): /home/debian/.ssh/id_ecdsa-chess
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/debian/.ssh/id_ecdsa-chess
Your public key has been saved in /home/debian/.ssh/id_ecdsa-chess.pub
The key fingerprint is:
SHA256:M2qUpyl31CCUcn3t2+vM6Cn4JaZIVvnFJICtTQiTQmY debian@workstation
The key's randomart image is:
+---[ECDSA 256]---+
| .E oo.*. . |
| o. oo= +.. . |
| . o.+..... |
| .o.+ +. |
| o S . oo |
| . B + .. . |
| . O ..+ . . |
| * o.o.o =. |
| . ...o+.+ |
+----[SHA256]-----+
Upload SSH key to ISP
Take SSH the key you just created above and upload it to OVH.
Go to Public Cloud
, then near the bottom left column, under
Project Management
click SSH Keys
.
Under the new SSH Keys
window, click Add and SSH Key
button.
Paste the PUBLIC key created above into the Key
section of the
Add an SSH key
popup window.
Take this output and paste into that form in the browser:
cat /home/debian/.ssh/id_ecdsa-chess.pub
It should look like a tangled mess like this (note, the debian@workstation
field
at the end is informational and can be something depending on your user/workstaion):
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC16EdTLECoLqSnmM/aSKrskLYN5ygu2dVvSAfiu4SAHPElrY6wqgUq6kzzsbbnko+VqyGzZ4tTWMml/AlBrQaw= debian@workstation
In the Name
field, enter mychestkey
.
Click Add
to save the key at OVH. You should now see it in the list.
Create Virtual Machine at ISP
OVH sells dedicated "bare metal" servers called the Bare Metal Cloud
.
They also sell virtual machine instances under the Public Cloud
.
The bare metal servers can be better, but they are generally more expensive,
a bit more complex to set up and maintain. So for this example, we
will set up a virtual machine in the Public Cloud
.
In OVH Dashboard
click on Public Cloud
, then in left column near the top
under Compute
, click Instances". Then under the new
Instanceswindow, click
Create an Instance`.
-
Select a Model
:Discovery
tab, then select D2-8. There are some options with 4 gigs of RAM and fewer CPUs, which could be used, but kind of slow. This option is ~$20USD/month. -
Select a Region
: The https://lichess.org server is in various data centers around Norther France, such as Gravelines (GRA). If you want to be close to that for some reason, you can select that. Or you could select a server that is regionally close to you and your users in another part of the world. For this example, we'll select Gravelines GRA3. ClickNext
. -
Select an Image
: UnderUnix Distributions
tab, selectDebian 11
. -
Select an Image
: UnderSSH key
at the bottom of the section, select themychestkey
you created and uploaded above. ClickNext
-
Configure your instance
: Just one instance. We'll usemychestserver
for the name, use yours as appropriate. We won't do any ofPost-installation script
,Private Networks
, orBackups
, although they could be used. ClickNext
. -
Billing Period
: As you like. This is just a test, so here just usingHourly
at $0.03886/hour. ClickCreate an instance
to create the virtual computer, which also starts billing.
Installation
Configuration
DNS Configuration
Set up forward & reverse DNS.
Usage
Lila
lila-ws
vim ./src/main/resources/application.conf
# set
csrf.origin = "https://deepcrayon.fish"
Misc
Potentially include items such as:
-
Local firewall.
-
Securing ssh.
-
Locking down system overall.