feat: 优化思源笔记安装包

This commit is contained in:
wanghe-fit2cloud 2024-04-10 17:04:51 +08:00
parent e9203be6c6
commit 667d3652d8
9 changed files with 59 additions and 113 deletions

View File

@ -0,0 +1,25 @@
additionalProperties:
formFields:
- default: 6806
edit: true
envKey: PANEL_APP_PORT_HTTP
labelEn: Port
labelZh: 端口
required: true
rule: paramPort
type: number
- default: ""
envKey: ACCESS_AUTH_CODE
labelEn: Access Authorization Code
labelZh: 访问授权码
required: true
edit: true
rule: paramComplexity
type: password
- default: Asia/Shanghai
edit: true
envKey: TIME_ZONE
labelEn: Time zone
labelZh: 时区
required: true
type: text

View File

View File

@ -0,0 +1,21 @@
version: '3'
services:
siyuan:
image: b3log/siyuan:v3.0.8
container_name: ${CONTAINER_NAME}
restart: unless-stopped
user: '1000:1000'
ports:
- ${PANEL_APP_PORT_HTTP}:6806
networks:
- 1panel-network
command: ['--workspace=/siyuan/workspace/', '--accessAuthCode=${ACCESS_AUTH_CODE}']
volumes:
- ./data:/siyuan/workspace
environment:
- TZ=${TIME_ZONE}
labels:
createdBy: "Apps"
networks:
1panel-network:
external: true

View File

@ -0,0 +1,3 @@
#!/bin/bash
chown -R 1000:1000 data

View File

@ -1,29 +1,14 @@
# 使用说明
### 安装方法
## 安装好后,我的笔记数据在哪?
请根据安装时的表单填写以下内容:
| 表单填写项 | 内容解释 |
| --------------------------------------------- | ------------------------------------------------------------ |
| 工作空间文件夹路径WORKSPACE_PATH | 主机上的工作空间文件夹路径 |
| 容器中的文件夹路径WORKSPACE_DIR_CONTAINER | 工作空间文件夹在容器中的路径,与指定的参数 --workspace 相同 |
| 访问授权码ACCESS_AUTH_CODE | 访问授权码,请务必填写,且需要足够复杂。否则任何人都可以读写您的数据 |
| 端口SIYUAN_PORT | 指定思源端口号默认为6806 |
为了防止您更新/删除思源笔记导致的数据丢失问题,默认笔记数据将放置在应用安装目录的 ./data/ 的文件夹下。
勾选【端口外部访问】选项。安装完毕后您可以通过【IP/域名:端口】这种形式服务。例http://127.0.0.1:6806。
### 安装好后,我的笔记数据在哪?
在您设置的工作空间文件夹WORKSPACE_PATH下。为了防止您更新/删除思源笔记导致的数据丢失问题,默认笔记数据将放置在主机的文件夹 /opt/siyuan/ 下,以确保在卸载时不会将其删除。
### 我该如何修改访问授权码?
## 我该如何修改访问授权码?
请您在【应用商店】内【已安装】选项卡中找到思源笔记,然后点击参数,选择编辑且修改访问授权码,保存即可。
### 网页版和客户端有什么区别?
## 网页版和客户端有什么区别?
网页版和客户端相比,局限性在于:
1. 不支持桌面和移动应用程序连接,仅支持在浏览器上使用
@ -32,8 +17,7 @@
以上内容来自[Docker Siyuan](https://hub.docker.com/r/b3log/siyuan),如果你需要以上部分或全部内容,请使用客户端。
### 如何隐藏端口
## 如何隐藏端口
首先先关闭思源笔记的【端口外部访问】功能然后在左侧【网站】选项卡内找到【创建网站】选择【反向代理】功能最后填写上主域名和代理地址HTTP保存即可。
@ -50,4 +34,4 @@ location /ws {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'Upgrade';
}
```
```

View File

@ -7,12 +7,13 @@ additionalProperties:
key: siyuan
name: 思源笔记
tags:
- WebSite
- Tool
shortDescZh: 隐私优先的个人知识管理系统
shortDescEn: Privacy-Prioritized Personal Knowledge Management System
type: website
type: tool
crossVersionUpdate: true
limit: 1
limit: 0
recommend: 0
website: https://b3log.org/siyuan/
github: https://github.com/siyuan-note/siyuan
document: https://b3log.org/siyuan/community.html

View File

@ -1,30 +0,0 @@
additionalProperties:
formFields:
- default: "/opt/siyuan/"
envKey: WORKSPACE_PATH
labelEn: Workspace Folder PATH
labelZh: 工作空间文件夹路径
required: true
type: text
- default: "/siyuan/workspace/"
envKey: WORKSPACE_DIR_CONTAINER
labelEn: Workspace Folder PATH
labelZh: 容器中的文件夹路径
required: true
type: text
- default: ""
envKey: ACCESS_AUTH_CODE
labelEn: Access Authorization Code
labelZh: 访问授权码
required: true
edit: true
rule: paramComplexity
type: password
- default: 6806
edit: true
envKey: SIYUAN_PORT
labelEn: Port
labelZh: 端口
required: true
rule: paramPort
type: number

View File

@ -1,23 +0,0 @@
version: '3.9'
services:
siyuan:
image: b3log/siyuan:latest
container_name: ${CONTAINER_NAME}
restart: unless-stopped
networks:
- 1panel-network
command: [
'--workspace=${WORKSPACE_DIR_CONTAINER}',
'--accessAuthCode=${ACCESS_AUTH_CODE}'
]
user: '1000:1000'
environment:
- TZ=${TimeZone}
volumes:
- ${WORKSPACE_PATH}:${WORKSPACE_DIR_CONTAINER}
ports:
- "${SIYUAN_PORT}:6806"
networks:
1panel-network:
external: true

View File

@ -1,35 +0,0 @@
#!/bin/bash
# 检查并加载环境变量
if [ -f .env ]; then
source .env
else
echo ".env file not found. Please create one with the WORKSPACE_PATH variable defined."
exit 1
fi
# 判断 WORKSPACE_PATH 变量是否被设置
if [ -z "${WORKSPACE_PATH}" ]; then
echo "WORKSPACE_PATH is not set."
exit 1
fi
# 检查 WORKSPACE_PATH 指定的文件夹是否存在,不存在则创建
if [ ! -d "${WORKSPACE_PATH}" ]; then
echo "Creating workspace directory at ${WORKSPACE_PATH}"
mkdir -p "${WORKSPACE_PATH}"
fi
# 修改 WORKSPACE_PATH 文件夹及其内容的所有者为用户ID 1000 和组ID 1000
echo "Setting ownership of ${WORKSPACE_PATH} to user 1000 and group 1000"
chown -R 1000:1000 "${WORKSPACE_PATH}" 2>/dev/null
# 检查是否成功设置了所有权
if [ $? -eq 0 ]; then
echo "Ownership set successfully."
else
echo "Failed to set ownership."
exit 1
fi
exit 0