部署了一个 overleaf 玩,目的需求是做一个共享文档,作为腾讯文档、知识库的替代品

注册管理员账号的时候,出现了报错:

alert
Session error. Please check you have cookies enabled. If the problem persists, try clearing your cache and cookies.

查阅这个 issue 后,得到了解决方案,将 config/variables.env 这里注释掉:

variables.env
# SHARELATEX_BEHIND_PROXY=true
# SHARELATEX_SECURE_COOKIE=true

无论这里是 true 还是 false 都需要注释掉

每次 bin/up 都会这样的结果:

shell
lsy@lsy:~/data/overleaf-toolkit$ bin/up
Initiating Mongo replica set...
WARN[0000] /home/lsy/data/overleaf-toolkit/lib/docker-compose.base.yml: `version` is obsolete
WARN[0000] /home/lsy/data/overleaf-toolkit/lib/docker-compose.vars.yml: `version` is obsolete
WARN[0000] /home/lsy/data/overleaf-toolkit/lib/docker-compose.redis.yml: `version` is obsolete
WARN[0000] /home/lsy/data/overleaf-toolkit/lib/docker-compose.mongo.yml: `version` is obsolete
WARN[0000] /home/lsy/data/overleaf-toolkit/lib/docker-compose.nginx.yml: `version` is obsolete
[+] Running 1/0
 ✔ Container mongo  Running                                                                                                               0.0s
WARN[0000] /home/lsy/data/overleaf-toolkit/lib/docker-compose.base.yml: `version` is obsolete
WARN[0000] /home/lsy/data/overleaf-toolkit/lib/docker-compose.vars.yml: `version` is obsolete
WARN[0000] /home/lsy/data/overleaf-toolkit/lib/docker-compose.redis.yml: `version` is obsolete
WARN[0000] /home/lsy/data/overleaf-toolkit/lib/docker-compose.mongo.yml: `version` is obsolete
WARN[0000] /home/lsy/data/overleaf-toolkit/lib/docker-compose.nginx.yml: `version` is obsolete
[+] Running 4/4
 ✔ Container mongo       Running                                                                                                          0.0s
 ✔ Container redis       Running                                                                                                          0.0s
 ✔ Container sharelatex  Recreated                                                                                                       60.5s
 ✔ Container nginx       Recreated                                                                                                        0.1s
Attaching to mongo, nginx, redis, sharelatex
sharelatex  | *** Running /etc/my_init.d/000_check_for_old_bind_mounts_5.sh...
sharelatex  | *** Running /etc/my_init.d/000_check_for_old_env_vars_5.sh...
sharelatex  | *** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
sharelatex  | *** Running /etc/my_init.d/100_generate_secrets.sh...
sharelatex  | generating random secrets
sharelatex  | *** Running /etc/my_init.d/100_make_overleaf_data_dirs.sh...
......

显然这个项目使用的是一个需要 nohup 的脚本。

使用这样的脚本模版方便管理:

shell
.
├── running.log
├── running.pid
├── start.sh
└── stop.sh
start.sh :
run=bin/up # 启动脚本的指令
DIR="$( cd "$( dirname "$0"  )" && pwd  )"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DIR/lib
nohup $DIR/$run > $DIR/running.log 2>&1& echo $! > $DIR/running.pid
stop.sh :
kill `cat running.pid`

使用 logrotate 定期清理日志。在 /etc/logrotate.conf 配置文件中增加:

/etc/logrotate.conf
/home/lsy/data/overleaf-toolkit/running.log {
        size 1k
        create 700 lsy lsy
        rotate 4
}

当然这里 /home/lsy/data/overleaf-toolkit/ 换成自己对应的 running.log 存放的目录

重新加载 logrotate 的配置文件:

shell
sudo logrotate /etc/logrotate.conf

后续出现的问题

没办法使用 markdown 插件,不符合需求,转而寻找支持 typst 、 markdown 的更紧跟时代潮流的方案

Edited on Views times