<?xml version="1.0" encoding="utf-8"?><feedxmlns="http://www.w3.org/2005/Atom"><generatoruri="https://jekyllrb.com/"version="4.1.1">Jekyll</generator><linkhref="/feed.xml"rel="self"type="application/atom+xml"/><linkhref="/"rel="alternate"type="text/html"/><updated>2020-12-21T10:02:48-07:00</updated><id>/feed.xml</id><entry><titletype="html">How to Deploy Lichess’s Lila With Nginx</title><linkhref="/2020/12/20/deploy-lichess/"rel="alternate"type="text/html"title="How to Deploy Lichess’s Lila With Nginx"/><published>2020-12-20T00:00:00-07:00</published><updated>2020-12-20T00:00:00-07:00</updated><id>/2020/12/20/deploy-lichess</id><contenttype="html"xml:base="/2020/12/20/deploy-lichess/"><p>I was getting ready to have a public test of some changes I made to <a href="https://lichess.org">lichess.org</a>’s <a href="https://lichess.org/source">open source chess platform</a>. In preperation, I got my Let’s Encrypt certificates and nginx configurations setup… and it wouldn’t work. Here are some tips for myself and future Lichess developers.</p><h2 id="reasoning">Reasoning</h2><p>My pull request involves accessibility. It will extend Lichess’s NVUI (Non-Visual User Interface) to be more accessible to beginner level chess players. At the time of writing this, Lichess’s NVUI only supports searching pieces by type, rank and file. It does not support any kind of interactive board.</p><p>I wanted to play chess with a friend of mine who uses a screen reader. Even though Lichess does indeed have a separate rendering of the page for visually impaired users, I have heard from a few people that it is not the best.</p><p>I don’t use a screen reader myself, so I thought having a public latest changes deployed server would work better for testing. It would certainly work better than getting some of my less computer literate friends to connect to me via VSCode/VPN and view my local repository.</p><p>So here is how to deploy it:</p><h2 id="setup-a-development-environment">Setup a development environment</h2><p>This is described <a href="https://github.com/ornicar/lila/wiki/Lichess-Development-Onboarding">in Lichess’s documentation itself</a>. I will not elaborate further as it is not necessary.</p><h2 id="setup-nginx">Setup nginx</h2><p>This is the part that stumps most people. Getting a local development server usually works alright, but once you want to reverse proxy it for security and professionalism purposes, it get more interesting.</p><p>Here is the relevant portion of my nginx configuration:</p><pre class="file"> server_name chess.tait.tech; location / { proxy_pass http://127.0.0.1:9663; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; proxy_set_header X-Real-IP $remote_addr; } </pre><pre class="file"> server_name ws.chess.tait.tech; location / { proxy_pass http://127.0.0.1:9664; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } </pre><p>You will need to deploy these on two virtual hosts.</p><h2 id="lila">Lila</h2><p><a href="https://github.com/ornicar/lila/">Lila</a> is the name for the main chess server, we need to change a few settings. Here is my git diff for the <code class="language-plaintext highlighter-rouge">conf/base.conf</code> file:</p><pre class="file"> - domain = "localhost:9663" - socket.domains = [ "localhost:9664" ] + domain = "chess.tait.tech" + socket.domains = [ "ws.chess.tait.tech" ] asset.domain = ${net.domain} - asset.base_url = "http://"${net.asset.domain} + asset.base_url = "https://"${net.