七弈智慧• 工作室

lichess安装指南

2025-05-03 15:28:58 阅读(252)

Lichess 开发入门指南

获取帮助

如果在安装过程中遇到问题,可以在 Discord 的 #lichess-dev-onboarding 频道(链接)寻求帮助。Lichess 的主要开发者(thibault)和其他成功安装过该栈的人也在那里。

先决条件

在开始之前,请确保安装了以下工具:

  • 硬件:至少 4 GB 内存,64 位 CPU。
  • 工具和依赖管理器:gitjava(JDK >= 21)、cs(coursier >= 2,也会安装 sbt)、node(node >= 14.3,推荐通过 NVM 安装)、pnpm(pnpm 8.7+)。

运行基础设施

  • mongodb(版本 5.1 >= mongo >= 4.2)
  • redis

如果机器上设置了 Docker,可以快速且强大地设置。

安装

设置 Lila
bash
git clone --recursive https://github.com/lichess-org/lila.git cd lila mongosh lichess < bin/mongodb/indexes.js # 创建数据库索引 ui/build # 构建客户端 ./lila # 启动 SBT 控制台

控制台启动后,输入 compile 开始编译,完成后输入 run 启动 HTTP 服务器。然后在浏览器中打开 http://127.0.0.1:9663。

设置 Websockets

Lichess 使用 Websockets 协议进行实时通信。由 lila-ws 服务器处理,位于 lila 主仓库之外。

bash
git clone https://github.com/lichess-org/lila-ws.git cd lila-ws sbt run -Dcsrf.origin=http://localhost:9663
UI 开发提示

运行 pnpm add-hooks 配置 Lila git 工作区,以便在每次提交前使用 prettier 格式化暂存的文件。也可以在代码编辑器中安装 prettier 插件以保存时格式化。所有 tsjsjson 扩展名的源文件都必须经过 prettier 格式化。

使用 ui/build -r 监听客户端 TypeScript 和 SCSS 代码的自动编译。对源文件所做的更改将被检测到,编译后,通过浏览器的硬刷新就可以使用。也可以在浏览器的开发者工具网络标签页禁用缓存,以便普通的页面重新加载可以获取更改。

推荐:种子数据库

可以使用 lila-db-seed 为你的本地数据库填充测试数据。

bash
git clone https://github.com/lichess-org/lila-db-seed

使用 spamdb.py 脚本填充数据库(需要 Python 3.9+)。

bash
pip3 install pymongo python3 lila-db-seed/spamdb/spamdb.py --help

或者,仅安装游戏和谜题数据:

bash
cd lila-db-seed mongorestore dump
可选:设置 Stockfish 分析

启动 fishnet 客户端进行分析(需要最新的 Rust 工具链来从源代码构建):

bash
git clone --recursive https://github.com/lichess-org/fishnet.git cd fishnet cargo run -- --endpoint http://localhost:9663/fishnet/
可选:设置与计算机对弈

lila-fishnet 允许与 Stockfish 对弈(分析不需要):

bash
git clone https://github.com/lichess-org/lila-fishnet.git cd lila-fishnet sbt app/run -Dhttp.port=9665

还需要一个客户端。启动一个 fishnet 客户端与机器对弈:

bash
git clone --recursive https://github.com/lichess-org/fishnet.git cd fishnet cargo run -- --endpoint http://localhost:9665/fishnet/
可选:设置搜索

按照这些说明在 Lila 上启用游戏、论坛、团队和学习搜索。

开发

了解更多关于使用 pnpmui/build 来处理客户端代码的信息。

Bloop 基础设置用于 Lila Scala 代码

设置 Bloop 进行快速构建和 IDE 功能。

代码格式化

这些仓库使用 scalafmt 来格式化 Scala 代码,其他所有内容使用 prettier 进行格式化。

请为你的编辑器安装 scalafmt,或者在 SBT 控制台运行 scalafmtAll 后再提交代码。同样,选择一个 prettier 插件(例如 coc-prettier 适合 nvim),或者在项目根目录输入 pnpm format

贡献

大多数开发者通过 git CLI 命令与他们的 git 仓库以及 GitHub 上的仓库进行交互。如果你不想使用命令行,可以考虑下载并熟悉 GitHub Desktop(适用于 Windows、Mac 或 Linux)。它是一个基本的 UI,可以引导你第一次像 Lila 这样的项目进行 fork 和贡献。

合作管理网站前端和后端是通过 Lila GitHub 仓库进行的。贡献是通过 GitHub Pull Request 机制进行的。首先,确保已安装 git 并创建了 GitHub 账户。接下来,将 Lila 仓库 fork 到你的新账户。然后按照链接的说明创建并使用个人访问令牌进行身份验证。之后,以下是一些基本命令来入门:

bash
git clone https://github.com/YOUR-GITHUB-USERNAME/lila # 获取源代码 git remote add upstream origin https://github.com/lichess-org/lila # 将你的仓库链接到 lichess-org/lila git checkout -b YOUR-BRANCH-NAME # 分支是可读的并且由短划线分隔,否则由你选择 git add -A . # 递归暂存当前目录中的所有更改 git commit -m 'your commit message' # 将之前暂存的更改提交到你的主机仓库 git push origin YOUR-BRANCH-NAME # 将本地仓库的状态推送到你的 fork。注意 git push 的输出包含一个 URL,你可以访问该 URL 来创建你的 Pull Request

一些可能简化你的 git 工作流程的 git 配置:

  • git config branch.autoSetupMerge inherit
  • git config push.autoSetupRemote true
  • git config push.default current

流媒体录制

Docker

你可以在 lichess.org/lila-docker 仓库中找到使用 Docker 设置的完整环境。

故障排除

  • MongoError['No primary node is available!']: 确保 mongod 正在运行,检查 /var/log/mongo/mongod.log 中的错误。如果剩余空间太少(可能需要 3GB),或者之前锁定的文件没有被清除(尝试删除 /var/lib/mongodb/mongod.lock),它可能无法启动。
  • 创建游戏失败:检查 mongo --version,确保它满足本页顶部的要求。
  • java.util.concurrent.TimeoutException: Future timed out after [5 seconds]: 确保 MongoDB 正在运行。如果在 MongoDB 之前启动了 Lila,则需要重启 Lila。在 OS X 上,可能需要增加连接超时时间(5 秒对于冷启动来说可能太短)。参见 #6718。
  • 运行 Lila 时的 Mongo 错误:运行 mongo lichess bin/mongodb/indexes.js 再次创建索引。
  • 导入游戏时的 Mongo 错误:在 /etc/mongodb.conf 中设置 setParameter: maxBSONDepth: 999
  • sbt 打印 Killed 并退出:很可能是没有足够的空闲 RAM 来编译 Lila。

请注意,这是一个非常简化的翻译,原文档中可能包含更多的细节和命令,建议在实际操作中参考原文以获得准确信息。

接口页面--全局数据:

site-> {"id":1,"name":"七弈智慧","domain":"doc.7yi.link","email":"13346163791@qq.com","wx":null,"icp":"浙ICP备2023022652号-1","code":"","json":{"siteSubtitle":"• 工作室"},"title":"七弈国象-连接七弈 智慧人生","keywords":"国际象棋,棋谱,pgn,","description":"国际象棋站","createdAt":null,"updatedAt":"2025-04-14T01:07:55.000Z","template":null,"appid":null,"secret":null}

111-->• 工作室

nav-> [{"id":13,"pid":0,"name":"日常工作杂记","pinyin":"richanggongzuozaji","path":"/richanggongzuozaji","sort":4,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0","children":[{"id":14,"pid":13,"name":"前端","pinyin":"qianduan","path":"/cmsgaijin/qianduan","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":15,"pid":13,"name":"后端","pinyin":"houduan","path":"/cmsgaijin/houduan","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":16,"pid":13,"name":"总结","pinyin":"zongjie","path":"/richanggongzuozaji/zongjie","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":17,"pid":13,"name":"工作计划","pinyin":"gongzuojihua","path":"/cmsgaijin/gongzuojihua","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":22,"pid":13,"name":"炒股养棋","pinyin":"chaoguyangqi","path":"/chaoguyangqi","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":23,"pid":13,"name":"cx13","pinyin":"cx13","path":"/kaifariji/cx13","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":24,"pid":13,"name":"时限学堂","pinyin":"shixianxuetang","path":"/richanggongzuozaji/shixianxuetang","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":25,"pid":13,"name":"运营","pinyin":"yunying","path":"/richanggongzuozaji/yunying","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"}]},{"id":18,"pid":0,"name":"国象练习","pinyin":"guoxianglianxi","path":"/guoxianglianxi","sort":3,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":19,"pid":0,"name":"信息公布","pinyin":"xinxigongbu","path":"/xinxigongbu","sort":6,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0","children":[{"id":20,"pid":19,"name":"业界消息","pinyin":"yejiexiaoxi","path":"/qiyiguoxiang/yejiexiaoxi","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":21,"pid":19,"name":"七弈动态","pinyin":"qiyidongtai","path":"/xinxigongbu/qiyidongtai","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"}]}]

category-> [{"id":13,"pid":0,"name":"日常工作杂记","pinyin":"richanggongzuozaji","path":"/richanggongzuozaji","sort":4,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0","children":[{"id":14,"pid":13,"name":"前端","pinyin":"qianduan","path":"/cmsgaijin/qianduan","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":15,"pid":13,"name":"后端","pinyin":"houduan","path":"/cmsgaijin/houduan","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":16,"pid":13,"name":"总结","pinyin":"zongjie","path":"/richanggongzuozaji/zongjie","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":17,"pid":13,"name":"工作计划","pinyin":"gongzuojihua","path":"/cmsgaijin/gongzuojihua","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":22,"pid":13,"name":"炒股养棋","pinyin":"chaoguyangqi","path":"/chaoguyangqi","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":23,"pid":13,"name":"cx13","pinyin":"cx13","path":"/kaifariji/cx13","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":24,"pid":13,"name":"时限学堂","pinyin":"shixianxuetang","path":"/richanggongzuozaji/shixianxuetang","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":25,"pid":13,"name":"运营","pinyin":"yunying","path":"/richanggongzuozaji/yunying","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"}]},{"id":14,"pid":13,"name":"前端","pinyin":"qianduan","path":"/cmsgaijin/qianduan","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":15,"pid":13,"name":"后端","pinyin":"houduan","path":"/cmsgaijin/houduan","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":16,"pid":13,"name":"总结","pinyin":"zongjie","path":"/richanggongzuozaji/zongjie","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":17,"pid":13,"name":"工作计划","pinyin":"gongzuojihua","path":"/cmsgaijin/gongzuojihua","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":18,"pid":0,"name":"国象练习","pinyin":"guoxianglianxi","path":"/guoxianglianxi","sort":3,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":19,"pid":0,"name":"信息公布","pinyin":"xinxigongbu","path":"/xinxigongbu","sort":6,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0","children":[{"id":20,"pid":19,"name":"业界消息","pinyin":"yejiexiaoxi","path":"/qiyiguoxiang/yejiexiaoxi","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":21,"pid":19,"name":"七弈动态","pinyin":"qiyidongtai","path":"/xinxigongbu/qiyidongtai","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"}]},{"id":20,"pid":19,"name":"业界消息","pinyin":"yejiexiaoxi","path":"/qiyiguoxiang/yejiexiaoxi","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":21,"pid":19,"name":"七弈动态","pinyin":"qiyidongtai","path":"/xinxigongbu/qiyidongtai","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":22,"pid":13,"name":"炒股养棋","pinyin":"chaoguyangqi","path":"/chaoguyangqi","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":23,"pid":13,"name":"cx13","pinyin":"cx13","path":"/kaifariji/cx13","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":24,"pid":13,"name":"时限学堂","pinyin":"shixianxuetang","path":"/richanggongzuozaji/shixianxuetang","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":25,"pid":13,"name":"运营","pinyin":"yunying","path":"/richanggongzuozaji/yunying","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"}]

friendlink-> [{"id":1,"title":"七弈国象首页","link":"https://www.7yi.link","sort":0,"createdAt":"2023-07-22T14:59:55.000Z"}]

base_url-> /public/template/default

frag--->{"record":"<p style=\"text-align: center;\"><a href=\"http://beian.miit.gov.cn/\" target=\"_blank\" rel=\"noopener\">浙ICP备2023022652号-1</a></p>","footer-guanyu":"","footer-7yi":"","footer-chess":"","footer-fe":"","chanyue-introduce":"<p>七弈国象:专注于国际象棋开局与战术学习的网站</p>\n<ul>\n<li>国际象棋相关工具开发:<br>\n<ul>\n<li>记谱训练</li>\n<li>识谱工具</li>\n</ul>\n</li>\n<li>国象相关产品\n<ul>\n<li>记录本</li>\n</ul>\n</li>\n<li>电商网站\n<ul>\n<li>畅享一三</li>\n</ul>\n</li>\n<li>通用后台<br>\n<ul>\n<li>7Link通用后台开发系统&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</li>\n</ul>\n</li>\n</ul>","copyright":"<p style=\"text-align: center;\">杭州七弈智慧科技有限公司版权所有</p>","ad":"<p style=\"text-align: center;\"><a href=\"https://7yi.link/stock/chess/web-mobile/\" target=\"_blank\" rel=\"noopener\"> <img style=\"display: block; margin-left: auto; margin-right: auto; max-width: 100%; height: auto;\" src=\"/public/uploads/default/2023/09/21/1695286791855_mceu_83563456911695286788809.png.png\"> </a></p>\n<p style=\"text-align: center;\"><a href=\"https://7yi.link/stock/chess/web-mobile/\" target=\"_blank\" rel=\"noopener\">开局树学习</a></p>"}

tag--->[{"id":8,"name":"双马防御","path":"shuangmafangyu"},{"id":7,"name":"开发","path":"kaifa"},{"id":6,"name":"伦敦体系","path":"lunduntixi"},{"id":5,"name":"俄罗斯防御","path":"eluosifangyu"},{"id":1,"name":"cms","path":"cms"}]

-----------

position------>[{"id":13,"pid":0,"name":"日常工作杂记","pinyin":"richanggongzuozaji","path":"/richanggongzuozaji","sort":4,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0","children":[{"id":14,"pid":13,"name":"前端","pinyin":"qianduan","path":"/cmsgaijin/qianduan","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":15,"pid":13,"name":"后端","pinyin":"houduan","path":"/cmsgaijin/houduan","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":16,"pid":13,"name":"总结","pinyin":"zongjie","path":"/richanggongzuozaji/zongjie","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":17,"pid":13,"name":"工作计划","pinyin":"gongzuojihua","path":"/cmsgaijin/gongzuojihua","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":22,"pid":13,"name":"炒股养棋","pinyin":"chaoguyangqi","path":"/chaoguyangqi","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":23,"pid":13,"name":"cx13","pinyin":"cx13","path":"/kaifariji/cx13","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":24,"pid":13,"name":"时限学堂","pinyin":"shixianxuetang","path":"/richanggongzuozaji/shixianxuetang","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},{"id":25,"pid":13,"name":"运营","pinyin":"yunying","path":"/richanggongzuozaji/yunying","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"}]},{"id":16,"pid":13,"name":"总结","pinyin":"zongjie","path":"/richanggongzuozaji/zongjie","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"}]

navSub------>{"cate":{"id":16,"pid":13,"name":"总结","pinyin":"zongjie","path":"/richanggongzuozaji/zongjie","sort":0,"target":"0","status":"0","list_view":"list.html","article_view":"article.html","seo_title":"","seo_keywords":"","seo_description":"","type":"0"},"id":16}

article------>{"id":201,"cid":16,"sub_cid":"","title":"lichess安装指南","short_title":"","tag_id":"","attr":"","seo_title":"","seo_keywords":"","seo_description":"","source":"","author":"","description":"","img":"","content":"<h3>Lichess 开发入门指南</h3>\n<h4>获取帮助</h4>\n<p>如果在安装过程中遇到问题,可以在 Discord 的 <code>#lichess-dev-onboarding</code> 频道(<a href=\"https://discord.gg/lichess\" target=\"_new\" rel=\"noreferrer\">链接</a>)寻求帮助。Lichess 的主要开发者(thibault)和其他成功安装过该栈的人也在那里。</p>\n<h4>先决条件</h4>\n<p>在开始之前,请确保安装了以下工具:</p>\n<ul>\n<li>硬件:至少 4 GB 内存,64 位 CPU。</li>\n<li>工具和依赖管理器:<code>git</code>、<code>java</code>(JDK &gt;= 21)、<code>cs</code>(coursier &gt;= 2,也会安装 sbt)、<code>node</code>(node &gt;= 14.3,推荐通过 NVM 安装)、<code>pnpm</code>(pnpm 8.7+)。</li>\n</ul>\n<h4>运行基础设施</h4>\n<ul>\n<li><code>mongodb</code>(版本 5.1 &gt;= mongo &gt;= 4.2)</li>\n<li><code>redis</code></li>\n</ul>\n<p>如果机器上设置了 Docker,可以快速且强大地设置。</p>\n<h4>安装</h4>\n<h5>设置 Lila</h5>\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<div class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">bash\n<div class=\"flex items-center\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center\">Copy code</button></span></div>\n</div>\n<div class=\"overflow-y-auto p-4 text-left undefined\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">git <span class=\"hljs-built_in\">clone</span> --recursive https://github.com/lichess-org/lila.git\n<span class=\"hljs-built_in\">cd</span> lila\nmongosh lichess &lt; bin/mongodb/indexes.js <span class=\"hljs-comment\"># 创建数据库索引</span>\nui/build <span class=\"hljs-comment\"># 构建客户端</span>\n./lila <span class=\"hljs-comment\"># 启动 SBT 控制台</span>\n</code></div>\n<p>控制台启动后,输入 <code>compile</code> 开始编译,完成后输入 <code>run</code> 启动 HTTP 服务器。然后在浏览器中打开 <a target=\"_new\" rel=\"noreferrer\">http://127.0.0.1:9663。</a></p>\n<h5>设置 Websockets</h5>\n<p>Lichess 使用 Websockets 协议进行实时通信。由 lila-ws 服务器处理,位于 lila 主仓库之外。</p>\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<div class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">bash\n<div class=\"flex items-center\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center\">Copy code</button></span></div>\n</div>\n<div class=\"overflow-y-auto p-4 text-left undefined\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">git <span class=\"hljs-built_in\">clone</span> https://github.com/lichess-org/lila-ws.git\n<span class=\"hljs-built_in\">cd</span> lila-ws\nsbt run -Dcsrf.origin=http://localhost:9663\n</code></div>\n<h5>UI 开发提示</h5>\n<p>运行 <code>pnpm add-hooks</code> 配置 Lila git 工作区,以便在每次提交前使用 prettier 格式化暂存的文件。也可以在代码编辑器中安装 prettier 插件以保存时格式化。所有 <code>ts</code>、<code>js</code> 或 <code>json</code> 扩展名的源文件都必须经过 prettier 格式化。</p>\n<p>使用 <code>ui/build -r</code> 监听客户端 TypeScript 和 SCSS 代码的自动编译。对源文件所做的更改将被检测到,编译后,通过浏览器的硬刷新就可以使用。也可以在浏览器的开发者工具网络标签页禁用缓存,以便普通的页面重新加载可以获取更改。</p>\n<h5>推荐:种子数据库</h5>\n<p>可以使用 <a href=\"https://github.com/lichess-org/lila-db-seed\" target=\"_new\" rel=\"noreferrer\">lila-db-seed</a> 为你的本地数据库填充测试数据。</p>\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<div class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">bash\n<div class=\"flex items-center\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center\">Copy code</button></span></div>\n</div>\n<div class=\"overflow-y-auto p-4 text-left undefined\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">git <span class=\"hljs-built_in\">clone</span> https://github.com/lichess-org/lila-db-seed\n</code></div>\n<p>使用 <code>spamdb.py</code> 脚本填充数据库(需要 Python 3.9+)。</p>\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<div class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">bash\n<div class=\"flex items-center\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center\">Copy code</button></span></div>\n</div>\n<div class=\"overflow-y-auto p-4 text-left undefined\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">pip3 install pymongo\npython3 lila-db-seed/spamdb/spamdb.py --<span class=\"hljs-built_in\">help</span>\n</code></div>\n<p>或者,仅安装游戏和谜题数据:</p>\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<div class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">bash\n<div class=\"flex items-center\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center\">Copy code</button></span></div>\n</div>\n<div class=\"overflow-y-auto p-4 text-left undefined\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\"><span class=\"hljs-built_in\">cd</span> lila-db-seed\nmongorestore dump\n</code></div>\n<h5>可选:设置 Stockfish 分析</h5>\n<p>启动 fishnet 客户端进行分析(需要最新的 Rust 工具链来从源代码构建):</p>\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<div class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">bash\n<div class=\"flex items-center\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center\">Copy code</button></span></div>\n</div>\n<div class=\"overflow-y-auto p-4 text-left undefined\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">git <span class=\"hljs-built_in\">clone</span> --recursive https://github.com/lichess-org/fishnet.git\n<span class=\"hljs-built_in\">cd</span> fishnet\ncargo run -- --endpoint http://localhost:9663/fishnet/\n</code></div>\n<h5>可选:设置与计算机对弈</h5>\n<p>lila-fishnet 允许与 Stockfish 对弈(分析不需要):</p>\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<div class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">bash\n<div class=\"flex items-center\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center\">Copy code</button></span></div>\n</div>\n<div class=\"overflow-y-auto p-4 text-left undefined\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">git <span class=\"hljs-built_in\">clone</span> https://github.com/lichess-org/lila-fishnet.git\n<span class=\"hljs-built_in\">cd</span> lila-fishnet\nsbt app/run -Dhttp.port=9665\n</code></div>\n<p>还需要一个客户端。启动一个 fishnet 客户端与机器对弈:</p>\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<div class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">bash\n<div class=\"flex items-center\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center\">Copy code</button></span></div>\n</div>\n<div class=\"overflow-y-auto p-4 text-left undefined\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">git <span class=\"hljs-built_in\">clone</span> --recursive https://github.com/lichess-org/fishnet.git\n<span class=\"hljs-built_in\">cd</span> fishnet\ncargo run -- --endpoint http://localhost:9665/fishnet/\n</code></div>\n<h5>可选:设置搜索</h5>\n<p>按照这些说明在 Lila 上启用游戏、论坛、团队和学习搜索。</p>\n<h3>开发</h3>\n<p>了解更多关于使用 <code>pnpm</code> 和 <code>ui/build</code> 来处理客户端代码的信息。</p>\n<h5>Bloop 基础设置用于 Lila Scala 代码</h5>\n<p>设置 Bloop 进行快速构建和 IDE 功能。</p>\n<h5>代码格式化</h5>\n<p>这些仓库使用 scalafmt 来格式化 Scala 代码,其他所有内容使用 prettier 进行格式化。</p>\n<p>请为你的编辑器安装 scalafmt,或者在 SBT 控制台运行 <code>scalafmtAll</code> 后再提交代码。同样,选择一个 prettier 插件(例如 coc-prettier 适合 nvim),或者在项目根目录输入 <code>pnpm format</code>。</p>\n<h3>贡献</h3>\n<p>大多数开发者通过 <code>git</code> CLI 命令与他们的 git 仓库以及 GitHub 上的仓库进行交互。如果你不想使用命令行,可以考虑下载并熟悉 GitHub Desktop(适用于 Windows、Mac 或 Linux)。它是一个基本的 UI,可以引导你第一次像 Lila 这样的项目进行 fork 和贡献。</p>\n<p>合作管理网站前端和后端是通过 Lila GitHub 仓库进行的。贡献是通过 GitHub Pull Request 机制进行的。首先,确保已安装 <code>git</code> 并创建了 GitHub 账户。接下来,将 Lila 仓库 fork 到你的新账户。然后按照链接的说明创建并使用个人访问令牌进行身份验证。之后,以下是一些基本命令来入门:</p>\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<div class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">bash\n<div class=\"flex items-center\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center\">Copy code</button></span></div>\n</div>\n<div class=\"overflow-y-auto p-4 text-left undefined\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">git <span class=\"hljs-built_in\">clone</span> https://github.com/YOUR-GITHUB-USERNAME/lila <span class=\"hljs-comment\"># 获取源代码</span>\ngit remote add upstream origin https://github.com/lichess-org/lila <span class=\"hljs-comment\"># 将你的仓库链接到 lichess-org/lila</span>\ngit checkout -b YOUR-BRANCH-NAME <span class=\"hljs-comment\"># 分支是可读的并且由短划线分隔,否则由你选择</span>\ngit add -A . <span class=\"hljs-comment\"># 递归暂存当前目录中的所有更改</span>\ngit commit -m <span class=\"hljs-string\">'your commit message'</span> <span class=\"hljs-comment\"># 将之前暂存的更改提交到你的主机仓库</span>\ngit push origin YOUR-BRANCH-NAME <span class=\"hljs-comment\"># 将本地仓库的状态推送到你的 fork。注意 git push 的输出包含一个 URL,你可以访问该 URL 来创建你的 Pull Request</span>\n</code></div>\n<p>一些可能简化你的 git 工作流程的 git 配置:</p>\n<ul>\n<li>git config branch.autoSetupMerge inherit</li>\n<li>git config push.autoSetupRemote true</li>\n<li>git config push.default current</li>\n</ul>\n<h3>流媒体录制</h3>\n<h3>Docker</h3>\n<p>你可以在 lichess.org/lila-docker 仓库中找到使用 Docker 设置的完整环境。</p>\n<h3>故障排除</h3>\n<ul>\n<li>MongoError['No primary node is available!']: 确保 mongod 正在运行,检查 <code>/var/log/mongo/mongod.log</code> 中的错误。如果剩余空间太少(可能需要 3GB),或者之前锁定的文件没有被清除(尝试删除 <code>/var/lib/mongodb/mongod.lock</code>),它可能无法启动。</li>\n<li>创建游戏失败:检查 <code>mongo --version</code>,确保它满足本页顶部的要求。</li>\n<li>java.util.concurrent.TimeoutException: Future timed out after [5 seconds]: 确保 MongoDB 正在运行。如果在 MongoDB 之前启动了 Lila,则需要重启 Lila。在 OS X 上,可能需要增加连接超时时间(5 秒对于冷启动来说可能太短)。参见 #6718。</li>\n<li>运行 Lila 时的 Mongo 错误:运行 <code>mongo lichess bin/mongodb/indexes.js</code> 再次创建索引。</li>\n<li>导入游戏时的 Mongo 错误:在 <code>/etc/mongodb.conf</code> 中设置 <code>setParameter: maxBSONDepth: 999</code>。</li>\n<li><code>sbt</code> 打印 <code>Killed</code> 并退出:很可能是没有足够的空闲 RAM 来编译 Lila。</li>\n</ul>\n<p>请注意,这是一个非常简化的翻译,原文档中可能包含更多的细节和命令,建议在实际操作中参考原文以获得准确信息。</p>\n</div>\n</div>\n</div>\n</div>\n</div>\n</div>\n</div>\n</div>\n</div>","status":0,"pv":252,"link":"","createdAt":"2024-05-01 15:33:17","updatedAt":"2025-05-03 15:28:58","field":{},"tags":[]}

article.tags------>[]

news------>[{"id":259,"title":"七弈通用后台数据库配置文件规范","short_title":"","img":"","createdAt":"2024-12-31T10:32:53.000Z","description":"","pinyin":"zongjie","name":"总结","path":"/kaifariji/zongjie"},{"id":258,"title":"书库系统更新记录","short_title":"","img":"","createdAt":"2024-12-28T09:33:18.000Z","description":"","pinyin":"zongjie","name":"总结","path":"/kaifariji/zongjie"},{"id":254,"title":"用AI辅助帮朋友完成了一个45年同学聚会的视频","short_title":"","img":"","createdAt":"2024-12-05T00:50:11.000Z","description":"","pinyin":"zongjie","name":"总结","path":"/kaifariji/zongjie"},{"id":253,"title":"一个很好用的视频格式转换网站","short_title":"","img":"","createdAt":"2024-11-27T10:37:40.000Z","description":"","pinyin":"zongjie","name":"总结","path":"/kaifariji/zongjie"},{"id":246,"title":"运营准备","short_title":"","img":"","createdAt":"2024-07-19T14:14:01.000Z","description":"","pinyin":"zongjie","name":"总结","path":"/kaifariji/zongjie"},{"id":245,"title":"教学视频","short_title":"","img":"","createdAt":"2024-07-05T00:47:41.000Z","description":"","pinyin":"zongjie","name":"总结","path":"/kaifariji/zongjie"},{"id":242,"title":"6月30日工作总结","short_title":"","img":"","createdAt":"2024-06-30T12:03:02.000Z","description":"","pinyin":"zongjie","name":"总结","path":"/kaifariji/zongjie"},{"id":241,"title":"今天工作总结","short_title":"","img":"","createdAt":"2024-06-28T10:23:17.000Z","description":"","pinyin":"zongjie","name":"总结","path":"/kaifariji/zongjie"},{"id":237,"title":"6月19日工作记录","short_title":"","img":"","createdAt":"2024-06-18T23:57:11.000Z","description":"","pinyin":"zongjie","name":"总结","path":"/kaifariji/zongjie"},{"id":236,"title":"我的棋局开发进度","short_title":"","img":"","createdAt":"2024-06-18T14:36:31.000Z","description":"","pinyin":"zongjie","name":"总结","path":"/kaifariji/zongjie"}]

hot------>[{"id":206,"title":"如何让wsl通过代理访问","path":"/kaifariji/zongjie"},{"id":148,"title":" stockfish中 elo与 skill之间的区别 ","path":"/kaifariji/zongjie"},{"id":81,"title":"禅悦cms系统上一个版本改动汇总","path":"/kaifariji/zongjie"},{"id":22,"title":"对cms系统修改记录","path":"/kaifariji/zongjie"},{"id":210,"title":"lichess的说明","path":"/kaifariji/zongjie"},{"id":172,"title":"解决 Stockfish 引擎在本地测试时的 SharedArrayBuffer 错误","path":"/kaifariji/zongjie"},{"id":145,"title":"小兔子阿斗的故事","path":"/kaifariji/zongjie"},{"id":49,"title":"一些有用的经验","path":"/kaifariji/zongjie"},{"id":108,"title":"纸张克数选择","path":"/kaifariji/zongjie"},{"id":208,"title":"docker中测试代理的方法","path":"/kaifariji/zongjie"}]

imgs------>[{"id":145,"title":"小兔子阿斗的故事","short_title":"","img":"/public/uploads/default/2024/01/17/1705477492766_origin-mceclip0jpg","createdAt":"2024-01-17T07:44:22.000Z","description":"","pinyin":"zongjie","name":"总结","path":"/kaifariji/zongjie"},{"id":97,"title":"搬迁服务器总结","short_title":"","img":"/public/uploads/default/2023/11/08/1699443000987_mceclip0.jpg.jpg","createdAt":"2023-11-08T10:02:59.000Z","description":"自8月份以来,我们决定将我们的业务入驻亚马逊,被吸引的原因之一是亚马逊提供的一年免费服务器,这似乎非常适合我们这些仍在进行产品测试的客户。","pinyin":"zongjie","name":"总结","path":"/kaifariji/zongjie"},{"id":79,"title":"记录一下,如何让18年的笔记本支持21:9显示器","short_title":"","img":"/public/uploads/default/2023/11/01/1698876307181_mceclip0.png.png","createdAt":"2023-11-01T13:51:06.000Z","description":"借双十一,给工作站配置了一台带鱼屏34寸显示器,HKC的 曲率1000,京东各种打折下来1276元。原价 1699双11 -400红包 -4.33白条  -8加入hkc会员 -10应当把可以打折的优惠都拿了下来办公室安装 很顺利 直接usb扩展显示器接上就可以用了搬到家里,问题出来了,接hdmi扩展口 显示分辨率不支持21:9  最高只有16:9更新最新的intel 显卡控制中心,无效。。。办公室配熊猫的是采用自定义分辨率。现在系统找不到了。没办法。下载驱动精灵,刷新所有驱动,重启右键。。","pinyin":"zongjie","name":"总结","path":"/kaifariji/zongjie"},{"id":45,"title":"使用cocos creator 开发微信小程序","short_title":"","img":"/public/uploads/default/2023/10/03/1696300737570_mceclip0.png.png","createdAt":"2023-10-01T22:21:25.000Z","description":"一 帐号准备:\n开发者帐号:\n如果不是多端开发,即(网页,android app,ios app,小程序,或多项目,可以不用申请,年费 300元","pinyin":"zongjie","name":"总结","path":"/kaifariji/zongjie"}]

pre------>{"id":200,"title":"教程:根据文件下载类型和平台属性进行下载并显示进度","name":"总结","path":"/kaifariji/zongjie"}

next------>{"id":203,"title":"lichess需要的安装环境","name":"总结","path":"/kaifariji/zongjie"}

E