├── .gitignore ├── run.sh ├── Dockerfile └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /lila 2 | /lila-ws 3 | /project 4 | /target 5 | -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source /home/lichess/.zshrc 3 | 4 | # Run Redis in the background. 5 | redis-server --daemonize yes 6 | 7 | cd /home/lichess/projects/lila-ws 8 | 9 | # Run lila-ws in the background. 10 | setsid nohup sbt run & 11 | 12 | # Run MongoDB in the background. 13 | sudo mongod --fork --logpath /var/log/mongod.log 14 | 15 | cd /home/lichess/projects/lila 16 | 17 | # Update the client side modules. 18 | ./ui/build 19 | 20 | # Run the Scala application 21 | ./lila run 22 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:bionic-20191202 2 | 3 | SHELL ["/bin/bash", "-c"] 4 | 5 | RUN useradd -ms /bin/bash lichess \ 6 | && apt-get update \ 7 | && apt update \ 8 | && apt-get install sudo \ 9 | # Disable sudo login for the new lichess user. 10 | && echo "lichess ALL = NOPASSWD : ALL" >> /etc/sudoers 11 | 12 | ENV TZ=Etc/GMT 13 | RUN sudo ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && sudo echo $TZ > /etc/timezone 14 | 15 | # Run as a non-privileged user. 16 | USER lichess 17 | 18 | ADD build /home/lichess/build 19 | 20 | #node 21 | RUN export HOME=/home/lichess \ 22 | && sudo /home/lichess/build/node-init.sh 23 | 24 | #yarn 25 | RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - \ 26 | && sudo apt-key add /home/lichess/build/signatures/yarn.asc \ 27 | && echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 28 | 29 | #mongodb 30 | RUN sudo apt-key add /home/lichess/build/signatures/mongodb-org.asc \ 31 | && echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list 32 | 33 | RUN sudo apt-get update && sudo apt update \ 34 | && sudo apt-get install -y \ 35 | unzip \ 36 | zip \ 37 | nodejs \ 38 | mongodb-org \ 39 | parallel \ 40 | && sudo apt install -y \ 41 | yarn \ 42 | redis-server \ 43 | git-all 44 | 45 | #Java 46 | RUN /home/lichess/build/sdkman-init.sh \ 47 | && source "$HOME/.sdkman/bin/sdkman-init.sh" \ 48 | && sdk install java 13.0.2.hs-adpt && sdk install sbt 49 | 50 | RUN sudo yarn global add gulp-cli \ 51 | # Silence the parallel citation warning. 52 | && sudo mkdir -p ~/.parallel && sudo touch ~/.parallel/will-cite \ 53 | # Make directories for mongodb 54 | && sudo mkdir -p /data/db && sudo chmod 666 /data/db \ 55 | && sudo apt-get autoremove -y \ 56 | && sudo apt-get clean \ 57 | && sudo rm -rf /home/lichess/build 58 | 59 | ADD run.sh /home/lichess/run.sh 60 | 61 | # Use UTF-8 encoding. 62 | ENV LANG "en_US.UTF-8" 63 | ENV LC_CTYPE "en_US.UTF-8" 64 | 65 | WORKDIR /home/lichess 66 | 67 | ENTRYPOINT ./run.sh 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deprecation notice! 2 | 3 | Please check out [a newer attempt at using Docker for Lichess](https://github.com/benediktwerner/lichess-docker), or consult the [Lichess Developer Onboarding Wiki](https://github.com/lichess-org/lila/wiki/Lichess-Development-Onboarding). 4 | 5 | # lichocker - [lichess.org](https://lichess.org) run in a [Docker](https://www.docker.com/) container 6 | 7 | ## Prerequisites 8 | 9 | * [Install Git](https://git-scm.com/downloads). 10 | * [Install Docker](https://docs.docker.com/install/). 11 | * *Recommended*: Increase your Docker runtime memory to 4GB and your CPUs to 4 ([Mac](https://docs.docker.com/docker-for-mac/#advanced), [Windows](https://docs.docker.com/docker-for-windows/#advanced), and configure the `docker-machine` assigned memory and CPUs for VirtualBox). 12 | * Check out lichocker (`git clone https://github.com/BrandonE/lichocker`) and open the directory in your terminal: `cd /YOUR/PATH/TO/lichocker` 13 | * Check out [lila](https://github.com/ornicar/lila), the main project behind Lichess: `git clone --recursive https://github.com/ornicar/lila.git` 14 | * Check out [lila-ws](https://github.com/ornicar/lila-ws), which manages Websockets. `git clone https://github.com/ornicar/lila-ws.git` 15 | * Add the following line to your `/etc/hosts` file: `127.0.0.1 lichess-assets.local` 16 | 17 | ## Obtaining the Docker image 18 | 19 | To obtain the image you can build it yourself or retrieve it from docker hub 20 | 21 | ### Building the image 22 | 23 | Run the following while in the lichocker directory: `docker build --tag brandone211/lichess .` 24 | 25 | ### Retrieving from Docker Hub 26 | 27 | ``` 28 | docker login 29 | docker pull brandone211/lichess 30 | ``` 31 | 32 | The Docker Hub repository can be found [here](https://hub.docker.com/r/brandone211/lichess/). 33 | 34 | ## Running 35 | 36 | * Run lila in a Docker container using the image obtained above, replacing the path to your local lila repository in the following command: 37 | 38 | ``` 39 | docker run \ 40 | --mount type=bind,source=/YOUR/ABSOLUTE/PATH/TO/lila,target=/home/lichess/projects/lila \ 41 | --mount type=bind,source=/YOUR/ABSOLUTE/PATH/TO/lila-ws,target=/home/lichess/projects/lila-ws \ 42 | --publish 9663:9663 \ 43 | --publish 9664:9664 \ 44 | --name lichess \ 45 | --interactive \ 46 | --tty \ 47 | brandone211/lichess 48 | ``` 49 | 50 | * Wait until you see the following message: 51 | 52 | ``` 53 | --- (Running the application, auto-reloading is enabled) --- 54 | 55 | [info] p.c.s.AkkaHttpServer - Listening for HTTP on /0.0.0.0:9663 56 | 57 | (Server started, use Enter to stop and go back to the console...) 58 | ``` 59 | 60 | * Navigate to http://localhost:9663 in your host machine's browser. 61 | 62 | ### Optional: Setup fishnet for server side analysis and play 63 | 64 | You can run fishnet (in another Docker container if desired) by following [these instructions](https://github.com/niklasf/fishnet). 65 | 66 | ## Rebuilding Lichess 67 | 68 | Because your lila directory exists on your host machine and is mounted onto the container, you can modify the code and rebuild on the host machine and it will take effect on the container. Run `/YOUR/ABSOLUTE/PATH/TO/lila/ui/build` to update the client side modules. Auto-reloading is enabled for the server side Scala code via sbt. 69 | 70 | For more information, including the guide used to create lichocker, please see the [Lichess Development Onboarding](https://github.com/ornicar/lila/wiki/Lichess-Development-Onboarding) instructions. 71 | 72 | ## Other Commands 73 | 74 | * Exiting the Docker container: Ctrl+C 75 | * Stopping the Docker container: `docker stop lichess` 76 | * Restarting the Docker container: `docker start lichess --attach --interactive` 77 | * View the output of the running Docker container that you previously exited: `docker attach lichess` 78 | * Remove the Docker container to mount a different volume: `docker rm lichess` 79 | --------------------------------------------------------------------------------