Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

提供自建Overleaf实例的教程 #445

Open
everything411 opened this issue Dec 12, 2024 · 4 comments
Open

提供自建Overleaf实例的教程 #445

everything411 opened this issue Dec 12, 2024 · 4 comments
Assignees

Comments

@everything411
Copy link
Member

everything411 commented Dec 12, 2024

related to BITNP/BIThesis#543

编译过慢,一次更改需要编译半分钟 | BIThesis /faq/slow

@everything411 everything411 self-assigned this Dec 12, 2024
@everything411
Copy link
Member Author

refer to https://github.com/lcpu-club/overleaf/wiki/%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B.
For consistance with windows, use docker.io/everything411/sharelatex-base for MS fonts. Note that this will violate https://learn.microsoft.com/en-us/typography/fonts/font-faq

@everything411
Copy link
Member Author

https://github.com/BITNP/BIThesis-wiki/blame/61f9c670ec6615f5b8c18e8fdaa187b850bbd864/wiki/.vitepress/config.mts#L47 needs update. Official Overleaf Free does not provide enough time to compile current bithesis.

@everything411
Copy link
Member Author

// https://github.com/overleaf/toolkit/blob/master/doc/quick-start-guide.md 的一个翻译

快速入门指南

前提条件

Overleaf Toolkit 依赖以下程序:

  • bash
  • docker

建议安装系统上可用的最新版 Docker。

安装

首先,将以下 Git 仓库克隆到您的机器上:

$ git clone https://github.com/overleaf/toolkit.git ./overleaf-toolkit

接下来进入该目录:

$ cd ./overleaf-toolkit

本指南后续假设所有命令均在此目录下执行。

目录结构概览

查看仓库结构:

$ ls -l

输出示例如下:

    bin
    CHANGELOG.md
    config
    data
    doc
    lib
    LICENSE
    README.md

README.md 包含项目基本信息,doc 目录存放所有使用文档。config 目录用于存放本地配置文件(稍后创建),bin 目录包含管理 Overleaf 实例的脚本。

初始化配置

运行 bin/init 创建本地配置:

$ bin/init

检查 config/ 目录内容:

$ ls config
overleaf.rc     variables.env     version

主要配置文件说明:

  • overleaf.rc : 主配置文件
  • variables.env : 加载到 Docker 容器的环境变量
  • version : 使用的 Docker 镜像版本

选择社区版或 Server Pro

默认使用免费的 Overleaf Community Edition。

Overleaf Server Pro 是商业版本,提供额外功能和商业支持。详情请访问 https://www.overleaf.com/for/enterprises/features。

如需使用 Server Pro 或设置试用实例,请先阅读 切换至 Server Pro 文档 再继续后续步骤。

启动服务

Overleaf Toolkit 使用 docker compose 管理容器。提供封装脚本简化操作。

启动 Docker 服务:

$ bin/up

终端将显示容器日志。按 CTRL-C 可停止服务。后台启动可使用 bin/start。直接控制 docker compose 请使用 bin/docker-compose

创建首个管理员账户

浏览器访问 http://localhost/launchpad,填写邮箱和密码后点击"注册"。

点击登录链接 http://localhost/login,使用凭证登录后将跳转至欢迎页。

点击页面底部绿色按钮开始使用 Overleaf。

创建首个项目

访问 http://localhost/project,点击"创建第一个项目"按钮并按指引操作。

成功后将进入项目页面,显示文本编辑器与 PDF 预览。

(可选)查看日志

查看容器内日志:

$ bin/logs -f web

同时查看多个服务日志:

$ bin/logs -f filestore docstore web clsi

TLS 代理

Overleaf Toolkit 支持通过 NGINX 代理以 HTTPS 运行 Server Pro。初始化配置:

bin/init --tls

此命令会在 config/nginx/nginx.conf 生成基础配置,并在 config/nginx/certs/ 下创建示例证书。如需使用正式证书,请替换示例文件。

启用代理需将 config/overleaf.rc 中的 NGINX_ENABLED 设为 true 后重启服务。更多信息请参阅 TLS 代理文档

诊断工具

使用 bin/doctor 调试安装:

$ bin/doctor

输出示例:

====== Overleaf Doctor ======
- Host Information
    - Linux
    ...
- Dependencies
    - bash
        - status: present
        - version info: 5.0.17(1)-release
    - docker
        - status: present
        - version info: Docker version 23.06.6, build 369ce74a3c
    - docker compose
        - status: present
        - version info: docker compose version v2.17.3
    ...
====== Configuration ======
    ...
====== Warnings ======
- None, all good
====== End ======

该工具会检查系统环境、依赖项和配置。遇到问题时请先运行此工具并附上输出结果。

获取帮助

社区版用户请 提交 GitHub issue

Server Pro 用户请联系 [email protected]

建议在请求帮助时附上 bin/doctor 的输出结果。

@everything411
Copy link
Member Author

https://github.com/lcpu-club/overleaf/wiki/%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B 的markdown

The English version of this page is at Quick Start Guide

本文由 ChatGPT 翻译自Quick Start Guide

介绍

Overleaf 通过 Docker 部署。在开始之前,请根据此文档安装 Docker。Podman 不支持且未经过测试。

由于内部复杂性,不使用 Docker 启动所有服务可能会非常繁琐和复杂,但 Overleaf 确实提供了一个简单的初始化系统。如果你对此感兴趣,可以查看这些代码获取一些灵感。

Overleaf 提供了两个镜像,ghcr.io/lcpu-club/sharelatex-baseghcr.io/lcpu-club/sharelatexsharelatex-base 包含了所有 texlive 的二进制文件和软件包 (tlmgr install scheme-full),并用于沙箱编译。我们提供了最新版(2024)、2022 版和 2020 版的 texlive,镜像标签格式为 {year}.{rev}(rev 是表示修订号的数字),例如 ghcr.io/lcpu-club/sharelatex-base:2024.1sharelatex 包含应用代码,标签遵循标准的语义化版本管理。

拉取所有必要的镜像

docker pull ghcr.io/lcpu-club/sharelatex:latest
docker pull ghcr.io/lcpu-club/sharelatex-base:2024.1
docker pull ghcr.io/lcpu-club/sharelatex-base:2022.1
docker pull ghcr.io/lcpu-club/sharelatex-base:2020.1

下载 docker-compose.yml

# 首先创建一个新目录
mkdir overleaf && cd overleaf

# 下载 docker-compose.yml 和必要的文件
wget https://github.com/lcpu-club/overleaf/raw/refs/heads/main/docker-compose.yml
curl https://github.com/lcpu-club/overleaf/raw/refs/heads/main/server-ce/mongodb-init-replica-set.js -L --create-dirs --output server-ce/mongodb-init-replica-set.js

# 修改 docker-compose.yml
$EDITOR docker-compose.yml

请注意以下选项:

  • 卷挂载:默认情况下,{sharelatex_data,redis_data,mongo_data} 将存储在 ~/ 目录下,根据需要进行修改。
  • SANDBOXED_COMPILES_HOST_DIR:特别注意此目录应为 主机上的 sharelatex_data 目录 + /data/compiles,因为该目录将被挂载到编译容器中。
  • 其他值:根据需要进行更新。如果你将使用反向代理,则应设置 OVERLEAF_BEHIND_PROXY: 'true'OVERLEAF_SECURE_COOKIE: 'true'

最后,使用以下指令启动Overleaf:

docker compose up -d

现在可以查看你的Overleaf实例了!

创建和管理用户

当 Overleaf 实例运行后,访问 /launchpad 页面来设置你的第一个管理员用户。

另外,使用以下命令创建第一个用户并将其设为管理员:

docker exec sharelatex /bin/bash -c "cd /var/www/sharelatex; grunt user:create-admin [email protected]"

此命令将在用户不存在的情况下创建一个拥有指定邮箱的用户,并将其设为管理员用户。你将获得一个 URL 访问地址,在该地址可以为此用户设置密码并首次登录。

注意:上述命令将始终返回指向 http://localhost/ 的 URL。如果你已将端口转发更新为 ports: - 8080:80,你应使用正确的端口访问密码确认页面:http://localhost:8080/user/password/set?passwordResetToken=<token>。另一个选项是将 SHARELATEX_SITE_URL 环境变量设置为 http://localhost:8080http://sharelatex.mydomain.com

创建普通用户

一旦你作为管理员用户登录,可以访问 Overleaf 实例上的 /admin/register 页面来创建新用户。如果你已配置了电子邮件后端,新用户将收到一封电子邮件,内含一个设置密码的 URL。如果没有,你需要手动分发密码重置的 URL。这些 URL 会在你创建用户时显示。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant