Skip to content

Onboarding Guide (Windows)

RoepStoep edited this page Jun 2, 2021 · 8 revisions

Lidraughts Development Onboarding (Windows)

These are the dependencies and steps to getting a local lidraughts development environment set up on Windows.

!!! Steps are outdated, and need to be updated !!!

Dependencies

  • Git
  • sbt If 13.6 then open bin/sbt.bat and change set INIT_SBT_VERSION=_TO_BE_REPLACED to set INIT_SBT_VERSION=0.13.16 (around line 50)
  • MongoDB
  • npm from Node.js.
  • nginx
  • yarn
  • gulp-cli (yarn global add gulp-cli)
  • Powershell (likely already on your machine) - required version >= 4.0 (in order to have CopyTo method)

Steps

For reliable results, close any nginx.exe processes that may be running from task manager if you used nginx.exe for some other task or previous attempt to set up lidraughts. Optionally, delete any mongod.lock files if you used MongoDB for any previous task or attempt to set up lidraughts.

  1. Open a command prompt

    cmd.exe
    
  2. Navigate to the parent directory that the lidraughts project will be downloaded into, for example:

    cd C:\
    
  3. In the command prompt, make sure you will clone the repo correctly if it's coming from a linux source with:

    git config --global core.autocrlf false
    
  4. Clone the repo with:

    git clone --recursive https://github.com/RoepStoep/lidraughts.git
    
  5. Undo the git config we set up in step 3, it's not needed anymore:

    git config --global core.autocrlf true
    
  6. Navigate into the project root folder:

    cd lidraughts
    
  7. Download and copy the geoip.ps1 file from https://github.com/ornicar/lila/tree/master/bin/gen to lidraughts/bin/gen

  8. In the command prompt:

    powershell -executionpolicy bypass -File bin\gen\geoip.ps1
    
  9. From the lidraughts directory, create a new configuration file at conf/application.conf with the the following contents:

    include "base"
    
    #override base.conf members
    
    net {
      domain = "l.org"
    }
    
    http {
      port = 9663
    }
    
  10. In the command prompt in the C:\lidraughts root directory, do:

    yarn install
    .\ui\build.bat
    .\bin\dev.bat compile
    
  11. Modify your hosts file at C:\Windows\System32\drivers\etc\hosts to include:

    127.0.0.1 l.org socket.l.org en.l.org
    
  12. Modify your nginx.conf file to have the following contents:

    #user  nobody;
    worker_processes  1;
    
    
    events {
    	worker_connections  1024;
    }
    
    
    http {
    	include       mime.types;
    	default_type  application/octet-stream;
    
    	sendfile        on;
    
    	keepalive_timeout  65;
    
    	server {
    		listen       80;
    		server_name  localhost;
    
    		location / {
    			root   html;
    			index  index.html index.htm;
    		}
    
    		error_page   500 502 503 504  /50x.html;
    		location = /50x.html {
    			root   html;
    		}
    	}
    	
    	
       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 C:/lidraughts/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 C:/lidraughts/public;
    	 }
    	 location = /robots.txt {
    		root C:/lidraughts/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;
    	 }
       }
    }
    
  13. Restart (or start) nginx.exe:

    cd C:\nginx-1.15.2
    start nginx
    
  14. Start MongoDB:

    mongod
    
  15. Open a new command prompt instance as running mongod will consume the previous window. Leave the previous window running.

    cmd.exe
    
  16. Then do each of the following in the new command prompt:

    cd C:\lidraughts
    .\bin\dev.bat
    run 9663
    
  17. Finally, navigate to l.org in your browser. You should see the lidraughts app, be able to play games, register, and sign in. Puzzles may not work at the time of writing of this guide.

If the above steps don't succeed, check that your hosts file doesn't have unnecessary lidraughts/lichess related entries in it. Also check that your firewall allows nginx.exe. Finally, check all paths and configuration files you set up in the steps above for typos and that you followed the steps as closely as possible. Remember that nginx.exe processes must be terminated from the task manager on Windows as there is no stop nginx command. When you make changes to your nginx configuration file nginx.conf, close the nginx.exe processes and then restart nginx for the changes to take effect.

Clone this wiki locally