linux学习记录

  • 首页
  • 入门LINUX
  • 建站
  • Why
  1. 首页
  2. 入门LINUX
  3. 正文

避坑指南:通过Docker搭建思源笔记

2022年9月4日 4646点热度 2人点赞 0条评论

通过docker部署思源笔记,官方文档还算比较清晰,以下主要记录一些可能会遇到的坑,给后来人提个醒。

这个是官方的案例:

docker run -v /siyuan/workspace:/siyuan/workspace -p 6806:6806 -u 1000:1000 b3log/siyuan --workspace=/siyuan/workspace/

转换成docker-compose.yml后:

version:'3.3'
services:
    siyuan:
      image: b3log/siyuan:v2.1.12
      container_name: siyuan
      restart: always
      volumes:
        - ./Siyuan/workspace:/opt/siyuan/workspace
    ports:
      - '6806:6806'
    user: 1000:1000
    command:[--resident=true,--workspace=/opt/siyuan/workspace,--ssl=true,--accessAuthCode=xxxxxx,--   servePath=xxx.xxx.com]
    network_mode:"host"
注意:
1、image的版本我改为了手动指定,因为我用的阿里云的docker镜像源,latest经常是旧版本;
2、volumes,思源的核心文件在docker中的/opt/siyuan而非案例中的/siyuan;
3、docker容器指定1000用户,所以需手动创建workspace,并chown -R 1000:1000 workspace修改权限,否则会启动不成功;
4、command中workspace与volume中保持一致,accessAuthCode配置你的访问密码,serverPath配置你的域名(如果有的话)
5、因为我开启了SSL,并用nginx反代,所以这里也需要注意:一定要配置websocket反代/ws部分,否则会提示内核连接失败;
#siyuan
server {
    listen 443 ssl;
    server_name xxx.xxxx.com;
    client_max_body_size   20m;
    ssl_certificate /etc/ssl/siyuan/xxx.xxxx.com_bundle.crt;
    ssl_certificate_key /etc/ssl/siyuan/xxx.xxxx.com.key;
location / {
    proxy_pass http://localhost:6806;
    }
location /ws {
    proxy_pass http://localhost:6806;
    #proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header X-Real-IP $remote_addr;
    }
}
6、顺手加了一个client_max_body_size   20m,不然自己上传题头图很容易413。
标签: 暂无
最后更新:2022年9月4日

Frank

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

COPYRIGHT © 2020-2024 frank9.com. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

渝ICP备2020014100号-1

渝公网安备50010502504305号