### Install and Run Berserk Example Script Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Install the development version of the Berserk Python library and run an example script against the local Lichess site. This is done within a temporary Docker container. ```bash docker compose run --rm -w /berserk python sh -c "pip install -e . && python /scripts/berserk-example.py" ``` -------------------------------- ### Start PGN-Viewer Build Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Install dependencies and build the PGN-Viewer for local development. ```bash docker compose run --rm -w /pgn-viewer ui bash -c "pnpm install && pnpm run dist" ``` -------------------------------- ### Start Chessground Compiler in Watch Mode Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Install dependencies, bundle, and start the Chessground compiler in watch mode to automatically rebuild on changes. ```bash docker compose run --rm -w /chessground ui bash -c "pnpm install && pnpm run bundle && pnpm run compile --watch" ``` -------------------------------- ### Start Lichess Docker Services Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Navigate into the cloned directory and start the Docker Compose services. This command initiates the Lichess development environment. ```bash cd lila-docker ./lila-docker start ``` -------------------------------- ### Install and Run Berserk Connect Bots Script Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Install the development version of the Berserk Python library and run a script to connect bots to the local Lichess site. This is executed in a temporary Docker container. ```bash docker compose run --rm -w /berserk python sh -c "pip install -e . && python /scripts/berserk-connect-bots.py" ``` -------------------------------- ### Start Lila UI Build in Watch Mode Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Start the lila UI build process in watch mode to automatically rebuild the UI when changes are detected. ```bash ./lila-docker ui ``` -------------------------------- ### Test Lichess API Endpoint Source: https://github.com/lichess-org/lila-docker/blob/main/docs/mono-image-testing.md Send a GET request to the /api/user/lichess endpoint to test the running container. ```bash curl localhost:8080/api/user/lichess ``` -------------------------------- ### Add New Services to Lichess Docker Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Add new optional services to an existing Lichess Docker setup. This command prompts you to select services to add. ```bash ./lila-docker add-services ``` -------------------------------- ### Get Shell in Running Container Source: https://github.com/lichess-org/lila-docker/blob/main/docs/mono-image-testing.md Access a bash shell inside the running Lichess container for debugging purposes. ```bash docker exec -it lichess bash ``` -------------------------------- ### Stop Lichess Docker Containers Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Stop the running Docker containers for the Lichess development environment. This allows for later resuming via the start command. ```bash ./lila-docker stop ``` -------------------------------- ### Link Local Chessground to Lila Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Link the local chessground development copy to the lila UI for immediate reflection of changes. ```bash docker compose run --rm -w /lila ui bash -c "pnpm link /chessground" ``` -------------------------------- ### Run Scalachess Formatting Preparation Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Execute the sbt prepare command within the Scalachess directory to automatically format code. ```bash docker compose run --rm -w /scalachess --entrypoint="sbt prepare" lila ``` -------------------------------- ### Inspect Multi-Arch Docker Image Source: https://github.com/lichess-org/lila-docker/blob/main/docs/mono-image-testing.md Inspect the details of a multi-architecture Docker image. ```bash docker buildx imagetools inspect lila-mono ``` -------------------------------- ### Build Lichess Mono Docker Image Source: https://github.com/lichess-org/lila-docker/blob/main/docs/mono-image-testing.md Build the Lichess mono Docker image. Use --no-cache to disable build cache or --platform for multi-arch builds. ```bash docker build -t lila-mono -f docker/mono.Dockerfile . docker build -t lila-mono --no-cache -f docker/mono.Dockerfile . ``` ```bash docker buildx build -t lila-mono -f docker/mono.Dockerfile --platform linux/amd64,linux/arm64 . ``` -------------------------------- ### Tag and Push Docker Image to GHCR Source: https://github.com/lichess-org/lila-docker/blob/main/docs/mono-image-testing.md Tag the local lila-mono image for GHCR and push it to the repository. ```bash docker tag lila-mono ghcr.io/lichess-org/lila-docker:testing docker push ghcr.io/lichess-org/lila-docker:testing ``` -------------------------------- ### Run Scalachess Test Kit Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Execute the test suite for the Scalachess testKit using the sbt testKit/test command. ```bash docker compose run --rm -w /scalachess --entrypoint="sbt testKit/test" lila ``` -------------------------------- ### Clone the Lichess Docker Repository Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Clone the lila-docker repository to your local machine. This is the first step to setting up the development environment. ```bash git clone https://github.com/lichess-org/lila-docker ``` -------------------------------- ### Compile Scalachess Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Compile the Scalachess library using the sbt compile command. ```bash docker compose run --rm -w /scalachess --entrypoint="sbt compile" lila ``` -------------------------------- ### Watch for UI Changes and Recompile Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Enable automatic recompilation of UI assets (Typescript/SCSS) by watching for file changes. This is useful for frontend development. ```bash ./lila-docker ui --watch ``` -------------------------------- ### Package Scalachess Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Package the Scalachess library using the sbt package command. ```bash docker compose run --rm -w /scalachess --entrypoint="sbt package" lila ``` -------------------------------- ### Run GHCR-Hosted Docker Image Source: https://github.com/lichess-org/lila-docker/blob/main/docs/mono-image-testing.md Run the Lichess Docker image hosted on GHCR, ensuring the latest version is pulled. ```bash docker run --rm -p 8080:8080 --pull always ghcr.io/lichess-org/lila-docker:main ``` -------------------------------- ### Run Scalachess Formatting Check Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Execute the sbt check command within the Scalachess directory to ensure code formatting standards are met. ```bash docker compose run --rm -w /scalachess --entrypoint="sbt check" lila ``` -------------------------------- ### Run Lichess Mono Docker Container Source: https://github.com/lichess-org/lila-docker/blob/main/docs/mono-image-testing.md Run the Lichess mono Docker container, mapping port 8080. Optionally set LILA_USER_PASSWORD or custom domain/URL. ```bash docker run --rm -p 8080:8080 --name lichess lila-mono ``` ```bash docker run --rm -p 8080:8080 --name lichess -e LILA_USER_PASSWORD=password lila-mono ``` ```bash docker run -it --rm -p 8080:8080 --name lichess -e LILA_DOMAIN=custom:8080 -e LILA_URL=http://custom:8080 lila-mono ``` -------------------------------- ### Publish Local Scalachess and Restart Lila Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Commands to publish local Scalachess changes and restart the lila service to reflect the updates. ```bash docker compose exec -w /scalachess lila sbt publishLocal docker compose restart lila ``` -------------------------------- ### Update Translation Keys Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Generate translation files after modifying source translation XML files. This command runs a script within a temporary Docker container. ```bash docker compose run --rm -w /lila ui pnpm run i18n-file-gen ``` -------------------------------- ### Format Lichess Code Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Apply code formatting rules to the Lichess project. This command ensures consistent code style across the project. ```bash ./lila-docker format ``` -------------------------------- ### Make Lichess Database Persistent Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Copy the current MongoDB database data to a local directory to make it persistent. This involves copying data and modifying the Docker Compose configuration. ```bash docker compose cp mongodb:/data/db ./database ``` -------------------------------- ### Restart Lichess Service for Scala Development Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Restart the Lichess service specifically for Scala development after making code changes. This ensures your Scala modifications are reflected. ```bash ./lila-docker lila restart ``` -------------------------------- ### Query InfluxDB for Measurements Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Use curl to query the InfluxDB database for a list of available measurements. Requires 'kamon' database and 'secret' token. ```bash curl --get http://localhost:8086/query \ --header "Authorization: Token secret" \ --data-urlencode 'db=kamon' \ --data-urlencode 'q=show measurements;' ``` -------------------------------- ### Remove Lichess Docker Containers Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Completely remove the Docker containers and associated network resources. Use this to clean up the environment. ```bash ./lila-docker down ``` -------------------------------- ### Query InfluxDB for Tag Keys Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Use curl to query the InfluxDB database for tag keys within the 'kamon' database. Requires 'secret' token. ```bash curl --get http://localhost:8086/query \ --header "Authorization: Token secret" \ --data-urlencode 'db=kamon' \ --data-urlencode 'q=show tag keys' ``` -------------------------------- ### Query InfluxDB for Field Keys Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Use curl to query the InfluxDB database for field keys within the 'kamon' database. Requires 'secret' token. ```bash curl --get http://localhost:8086/query \ --header "Authorization: Token secret" \ --data-urlencode 'db=kamon' \ --data-urlencode 'q=show field keys' ``` -------------------------------- ### Update Scalachess Dependency in lila Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Modify the Dependencies.scala file in the lila repository to point to the custom local version of Scalachess. ```diff - val chess = "org.lichess" %% "scalachess" % "15.6.7" + val chess = "org.lichess" %% "scalachess" % "my-test-1" ``` -------------------------------- ### Auto-Reload Page on 5xx Error Source: https://github.com/lichess-org/lila-docker/blob/main/static/errors/502.html This JavaScript code snippet automatically reloads the page if the server returns a 5xx status code, indicating a server-side error like a 502 Bad Gateway. It checks the server status every 5 seconds. ```javascript setInterval(function() { var xhr = new XMLHttpRequest(); xhr.open('GET', window.location.href); xhr.onload = function() { if (xhr.status < 500) { window.location.reload(); } }; xhr.onerror = function() { window.location.reload(); }; xhr.send(); }, 5*1000); ``` -------------------------------- ### Update Lichess Route Cache Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Update the route cache after modifying the `conf/routes` file. This command is executed within the Lichess Docker container. ```bash docker compose exec lila ./lila.sh playRoutes ``` -------------------------------- ### Update Scalachess Version in build.sbt Source: https://github.com/lichess-org/lila-docker/blob/main/README.md Modify the build.sbt file in the scalachess repository to use a custom version for local testing. ```diff - ThisBuild / version := "15.6.7" + ThisBuild / version := "my-test-1" # give it a custom version ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.