部署个人文档管理系统 Docspell

YG科技 后端 2025-01-17


一、Flexus 云服务器 X 实例介绍

云服务器是现代科技的杰作。它以强大的计算能力和高可靠性,为各类业务提供坚实支撑。可远程管理,轻松实现资源调配。具有高度的灵活性和扩展性,适应不同规模需求。安全防护严密,让你的数据放心存储。选择云服务器,开启高效便捷的云端之旅。

华为云下一代云服务器 Flexus X 实例焕新上线,新产品基于用户业务负载动态和内存峰值画像,动态推荐规格,减少算力浪费,提升资源利用率,按照算力规格变化,精准计算用量,按需灵活计费,搭配智能推介,始终确保成本更优,覆盖高科技、零售、金融、游戏等行业大多数通用工作负载场景。

 

Flexus X 实例通过和其他服务组合,具备计算、镜像安装、网络、存储、安全等能力,您可根据业务需要灵活配置各资源。

本次测评使用的规格是:4 核 12G-100G-3M 规格的 Flexus X 实例基础模式

 

二、Flexus 云服务器 X 实例配置

2.1 重置密码

购买服务器的时候可以提前设置用户名和密码,因为我这里跳过了,所以购买完成后需要重置密码,会短信或站内消息通过你的云服务器信息,重点是公网 IP 地址和用户名,首先打开你的服务器控制台,选择重置密码

 

勾选自动重启,点击确定即可

 

2.2 服务器连接

华为云服务器提供了多种链接方式,如使用控制台提供的 VNC 方式登录、使用 Linux/Mac OS 系统主机登录 Linux 弹性云服务器(即 ssh root@192.168.48.78 命令)或者使用 Putty、Xshell 等工具登录 Linux 弹性云服务器。

我个人习惯使用 MobaXterm 这款软件,添加 SSH 连接,输出公网 IP、用户名和端口(默认 22),连接即可。

 

2.3 安全组配置

安全组是一个逻辑上的分组,为同一个 VPC 内的云服务器提供访问策略。用户可以在安全组中定义各种访问规则,当云服务器加入该安全组后,即受到这些访问规则的保护。

系统为每个网卡默认创建一个默认安全组,默认安全组的规则是对出方向上的数据报文全部放行,入方向访问受限。您可以使用默认安全组,也可以根据需要创建自定义的安全组。

 

主要需要填写优先级(默认填 1 即可)、协议端口(协议一般为 TCP 或 UDP,端口一般选择你项目需要暴露的端口即可),描述(选填,一般会填写此端口的用途以免忘记了),其他默认点击确定即可。安全组配置主要是暴露端口可以给外网访问。

 

如果还不清楚可以参考文档:安全组配置示例

 

2.4 Docker 环境搭建

本次服务器环境是 ubuntu 系统镜像,需要自己安装 docker 环境

使用 apt-get 命令安装 docker 及其配置

# 安装必要工具包 $ sudo apt-get install \    apt-transport-https \    ca-certificates \    curl \    gnupg-agent \    software-properties-common# 添加 Docker GPG 秘钥 $ sudo curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -# 配置仓库源 $ sudo add-apt-repository \      "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \      $(lsb_release -cs) \      stable" # 更新 apt 包索引 $ sudo apt-get update# 安装 docker$ sudo apt-get install docker-ce docker-ce-cli containerd.io# 添加 docker 镜像源 $ sudo vim /etc/docker/daemon.json{    "registry-mirrors": [        "https://ustc-edu-cn.mirror.aliyuncs.com/",        "https://docker.mirrors.ustc.edu.cn",        "https://docker.nju.edu.cn",        "https://ccr.ccs.tencentyun.com/",        "https://docker.m.daocloud.io/",        "https://dockerproxy.com",    ]}# 重启 $ sudo systemctl daemon-reload$ sudo systemctl restart docker

 测试 docker 安装是否成功

root@flexusx-c6b3:~# docker -vDocker version 27.2.0, build 3ab4256```

检查 docker 服务状态

root@flexusx-c6b3:~# systemctl status docker* docker.service - Docker Application Container Engine     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)     Active: active (running) since Fri 2024-08-30 15:53:45 CST; 17h agoTriggeredBy: * docker.socket       Docs: https://docs.docker.com   Main PID: 24912 (dockerd)      Tasks: 13     Memory: 24.7M        CPU: 3.778s     CGroup: /system.slice/docker.service             `-24912 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

检查 docker compose 版本

root@flexusx-c6b3:~# docker compose versionDocker Compose version v2.29.2

三、Flexus 云服务器 X 实例部署 Docspell

3.1 Docspell 介绍

Docspell 是一款个人文档管理器。有时也被称为“文档管理系统”(DMS)。您需要一台扫描仪将文件转换为文件,然后 Docspell 可以帮助您整理由此产生的杂乱,它可以将您从扫描仪、电子邮件和其他来源获取的文件统一起来。Docspell 可以关联标签、设置对应项以及许多其他预定义和自定义元数据。还可以对文档运行 OCR(如果需要),提供全文搜索,并且具有出色的电子邮件集成功能。

· 使用 OCR 提取文本从所有文件中提取文本。对于扫描的文档/图像,使用 Tesseract 进行 OCR。文本经过分析,可用于全文搜索。

· 文本分析使用 ML 算法分析提取的文本,以找到可以自动注释到文档的属性。

· 支持多种文件 Docspell 可以读取多种文件类型。可以提取 ZIP 和 EML(电子邮件文件格式)文件并导入其内容。

· 转换为 PDF 所有文件都转换为 PDF。不必担心原件。原始文件也会被存储,并且可以原封不动地下载。从图像数据(通常由扫描仪返回)创建 PDF 时,生成的 PDF 包含提取的文本并且可以搜索。

· 全文搜索所有文件的提取文本和一些属性(如名称和注释)都可用于全文搜索。全文搜索还可用于进一步限制搜索菜单的结果,您可以按标签、通讯员等进行搜索。

 

Docspell 定位于一款简单的文档整理工具,其目标是帮助用户以最小的精力轻松管理手头的电子文档。用户可将来自多种来源的文档,如扫描件和电子邮件,上传到 Docspell,系统将自主地对其进行解析和管理。Docspell 的设计初衷便是通过自动化技术减少人工干预,优化归档和检索流程,尤其适合那些处理大量文档的用户群体。

· 官网:https://docspell.org/

· Github:https://github.com/eikek/docspell

3.2 Docspell 部署

· 创建 docker-compose.yml

version: '3.5'services:  # The restserver and joex containers defined here are configured  # using env variables. Both must connect to the same database and  # solr instance. More information on configuring can be found here:  # https://docspell.org/docs/configure  #  # Please replace the values of the following with a custom secret  # string:  #  # - DOCSPELL_SERVER_ADMIN__ENDPOINT_SECRET  # - DOCSPELL_SERVER_AUTH_SERVER__SECRET  # - DOCSPELL_SERVER_INTEGRATION__ENDPOINT_HTTP__HEADER_HEADER__VALUE  #   (use the same value at the consumedir container!)  #  # After creating an account, you may want to set signup mode to  # "closed" or to "invite". When using invite, you must also set  # DOCSPELL_SERVER_BACKEND_SIGNUP_NEW__INVITE__PASSWORD to some  # secret.  restserver:    image: docspell/restserver:latest    container_name: docspell-restserver    restart: unless-stopped    ports:      - "7880:7880"    environment:      - TZ=Europe/Berlin      - DOCSPELL_SERVER_INTERNAL__URL=http://docspell-restserver:7880      - DOCSPELL_SERVER_ADMIN__ENDPOINT_SECRET=admin123      - DOCSPELL_SERVER_AUTH_SERVER__SECRET=      - DOCSPELL_SERVER_BACKEND_JDBC_PASSWORD=dbpass      - DOCSPELL_SERVER_BACKEND_JDBC_URL=jdbc:postgresql://db:5432/dbname      - DOCSPELL_SERVER_BACKEND_JDBC_USER=dbuser      - DOCSPELL_SERVER_BIND_ADDRESS=0.0.0.0      - DOCSPELL_SERVER_FULL__TEXT__SEARCH_ENABLED=true      - DOCSPELL_SERVER_FULL__TEXT__SEARCH_SOLR_URL=http://docspell-solr:8983/solr/docspell      - DOCSPELL_SERVER_INTEGRATION__ENDPOINT_ENABLED=true      - DOCSPELL_SERVER_INTEGRATION__ENDPOINT_HTTP__HEADER_ENABLED=true      - DOCSPELL_SERVER_INTEGRATION__ENDPOINT_HTTP__HEADER_HEADER__VALUE=integration-password123      - DOCSPELL_SERVER_BACKEND_SIGNUP_MODE=open      - DOCSPELL_SERVER_BACKEND_SIGNUP_NEW__INVITE__PASSWORD=      - DOCSPELL_SERVER_BACKEND_ADDONS_ENABLED=false    depends_on:      - solr      - db  joex:    image: docspell/joex:latest    container_name: docspell-joex    ## For more memory add corresponding arguments, like below. Also see    ## https://docspell.org/docs/configure/#jvm-options    # command:    #   - -J-Xmx3G    restart: unless-stopped    environment:      - TZ=Europe/Berlin      - DOCSPELL_JOEX_APP__ID=joex1      - DOCSPELL_JOEX_PERIODIC__SCHEDULER_NAME=joex1      - DOCSPELL_JOEX_SCHEDULER_NAME=joex1      - DOCSPELL_JOEX_BASE__URL=http://docspell-joex:7878      - DOCSPELL_JOEX_BIND_ADDRESS=0.0.0.0      - DOCSPELL_JOEX_FULL__TEXT__SEARCH_ENABLED=true      - DOCSPELL_JOEX_FULL__TEXT__SEARCH_SOLR_URL=http://docspell-solr:8983/solr/docspell      - DOCSPELL_JOEX_JDBC_PASSWORD=dbpass      - DOCSPELL_JOEX_JDBC_URL=jdbc:postgresql://db:5432/dbname      - DOCSPELL_JOEX_JDBC_USER=dbuser      - DOCSPELL_JOEX_ADDONS_EXECUTOR__CONFIG_RUNNER=docker,trivial      - DOCSPELL_JOEX_CONVERT_HTML__CONVERTER=weasyprint    ports:      - "7878:7878"    depends_on:      - solr      - db    ## Uncomment when using the "docker" runner with addons    # volumes:    #   - /var/run/docker.sock:/var/run/docker.sock    #   - /tmp:/tmp  # The consumedir container watches a directory for files to upload  # to docspell restserver. This uses the `dsc` tool. For information  # on the available options, see `dsc --help`.  # https://github.com/docspell/dsc  #  # The value after `Docspell-Integration` must match the secret  # specified at the restserver via  # DOCSPELL_SERVER_INTEGRATION__ENDPOINT_HTTP__HEADER_HEADER__VALUE.  #  # The --not-matches "**/.*" option is to exclude hidden files.  consumedir:    image: docspell/dsc:latest    container_name: docspell-consumedir    command:      - dsc      - "-d"      - "http://docspell-restserver:7880"      - "watch"      - "--delete"      - "-ir"      - "--not-matches"      - "**/.*"      - "--header"      - "Docspell-Integration:integration-password123"      - "/opt/docs"    restart: unless-stopped    volumes:      - ./docs:/opt/docs    depends_on:      - restserver  db:    image: postgres:17.0    container_name: postgres_db    restart: unless-stopped    volumes:      - docspell-postgres_data:/var/lib/postgresql/data/    environment:      - POSTGRES_USER=dbuser      - POSTGRES_PASSWORD=dbpass      - POSTGRES_DB=dbname  solr:    image: solr:9    container_name: docspell-solr    restart: unless-stopped    volumes:      - docspell-solr_data:/var/solr    command:      - bash      - -c      - 'precreate-core docspell; exec solr -f -Dsolr.modules=analysis-extras'    healthcheck:      test: ["CMD", "curl", "-f", "http://localhost:8983/solr/docspell/admin/ping"]      interval: 1m      timeout: 10s      retries: 2      #start_period: 30svolumes:  docspell-postgres_data:  docspell-solr_data:

· ports: 映射主机的 7880 端口到容器的 7880 端口

· volumes: 将主机目录挂载到容器目录

如果将上述代码片段保存在名为 docker-compose.yml 的文件中,则只需从同一文件夹中运行 docker compose up -d 即可自动拉取 Docspell 镜像,并创建并启动一个容器。 up 表示启动服务,-d 表示在后台执行。docker-compose down 命令用于停止和清理由 docker-compose up 启动的服务。

· 启动服务

进入项目目录,执行 docker-compose up -d 启动命令,会自动拉取容器并运行

从 Dockerhub 拉取 Docspell 镜像,地址:https://hub.docker.com/r/docspell/restserver

root@flexusx-c6b3:~/docspell# docker-compose up -dCreating network "docspell_default" with the default driverCreating volume "docspell_docspell-solr_data" with default driverCreating volume "docspell_docspell-postgres_data" with default driverPulling solr (solr:9)...9: Pulling from library/solr7478e0ac0f23: Pull complete90a925ab929a: Pull complete7d9a34308537: Pull complete80338217a4ab: Pull complete1a5fd5c7e184: Pull complete5b1aa583d1ef: Pull complete350cf53fd52a: Pull completeb317c36e5a10: Pull completeedf7dd409191: Pull completeb24483e35971: Pull complete4f4fb700ef54: Pull completeDigest: sha256:4267344d8d37c5982894f8424e923a66e21461fc2d61602d935837d5d464182bStatus: Downloaded newer image for solr:9Pulling db (postgres:17.0)...17.0: Pulling from library/postgresDigest: sha256:4ec37d2a07a0067f176fdcc9d4bb633a5724d2cc4f892c7a2046d054bb6939e5Status: Downloaded newer image for postgres:17.0Pulling restserver (docspell/restserver:latest)...latest: Pulling from docspell/restserverc6a83fedfae6: Already existsb10665a8e334: Pull complete4f4fb700ef54: Pull complete0c4bd9809776: Pull completeDigest: sha256:7184e723dcdd5241f02372748ad0aab6caca0722478abc892dc63c663e399f2dStatus: Downloaded newer image for docspell/restserver:latestPulling consumedir (docspell/dsc:latest)...latest: Pulling from docspell/dsc4abcf2066143: Already exists4f4fb700ef54: Pull completed574edd180f4: Pull completebdf75d862256: Pull completeDigest: sha256:9b7e0410737446b1409ce609061096a06281dcb3e03250443e96511583197865Status: Downloaded newer image for docspell/dsc:latestPulling joex (docspell/joex:latest)...latest: Pulling from docspell/joexc6a83fedfae6: Already exists56f69f5c011e: Pull completed46286f6b8c5: Pull complete4f4fb700ef54: Pull completeb3df55396b51: Pull complete6e868de79f50: Pull complete35510b35eae3: Pull completec3a0e85725ae: Pull completeDigest: sha256:b21d2285e49c0869d827dcba631ff10d574c673eb8df2ebf7fc1f326d0afd581Status: Downloaded newer image for docspell/joex:latestCreating docspell-joex ... Creating docspell-restserver ... Creating docspell-joexCreating docspell-restserver ... doneCreating docspell-consumedir ... Creating docspell-consumedir ... done

· 配置安全组

在 Flexus 云服务器 X 实例的安全组管理页面,添加入方向规则,接下来我们启动服务需要监听 7880 端口,所以添加安全组为 TCP:7880 协议端口。

 

· 检查容器状态

检查 Docspell 容器状态,确保容器正常启动

root@flexusx-c6b3:~/docspell# docker psCONTAINER ID   IMAGE                                COMMAND                  CREATED          STATUS                   PORTS                                       NAMESf4b65aae420b   docspell/dsc:latest                  "dsc -d http://docsp…"   3 minutes ago    Up 3 minutes                                                         docspell-consumedir55a2021c9b2a   docspell/restserver:latest           "/opt/docspell-rests…"   3 minutes ago    Up 3 minutes (healthy)   0.0.0.0:7880->7880/tcp, :::7880->7880/tcp   docspell-restserver14d19ff6af95   docspell/joex:latest                 "/opt/joex-entrypoin…"   3 minutes ago    Up 3 minutes (healthy)   0.0.0.0:7878->7878/tcp, :::7878->7878/tcp   docspell-joexec67e91edc8e   postgres:17.0                        "docker-entrypoint.s…"   17 minutes ago   Up 3 minutes             5432/tcp                                    postgres_db1f2f3fa23a36   solr:9                               "docker-entrypoint.s…"   17 minutes ago   Up 3 minutes (healthy)   8983/tcp                                    docspell-solr

· 访问地址

内网:http://localhost:7880 外网:http://公网 IP:7880

· 访问结果

 

若出现此页面,则部署 docspell server 成功。

3.3 Docspell 使用

没有帐号需要先注册,注册时,为集体和用户选择相同的名称,然后使用此名称和密码登录

 

输出刚刚注册的帐号和密码进行登录,确保 Collection ID 和 User Login 一致

 

登录成功后进入首页仪表盘,左侧是功能菜单选项,包括仪表盘、项目搜索、上传文件,设置部分:Webhook、定期查询、来源、分享,管理模块:组织、人员、设备、标签和文件夹,最后还有官方文档说明的链接,右上角有用户设置设置

 

点击用户图标,可以查看组织资料、用户资料、主题切换、退出登录

 

用户资料里,有很多设置项,比如 UI 设置(默认不支持中文),通知设置、邮箱设置和修改密码

 

点击设置图标,可以查看项目搜索、管理数据、上传文件、处理队列

 

选择文件,出现选择文件列表,点击提交即可开启上传任务

 

所有文件已上传成功后有提示,并且告知现在正在处理中,稍后查看项目页面,文件最终将到达该页面,或者转到处理页面查看当前处理状态,对中文的支持不是很好都乱码了,文件名称为中文的可能需要修改为英文才好看些

 

查看文件处理页面

 

查看项目搜索页

 

点击文件封面,查看文件预览页

 

在现代企业和家庭生活中,处理和管理大量数字化文档是不可避免的。随着各类型信息越来越多地以数码化形式出现,它们带来的存储和分类问题也越来越复杂。Docspell 提供了一种能够高效管理种类繁多的数字文件的解决方案,文件的上传和整理流程就是上诉操作,目前的缺点是没有中文支持,导致乱码问题,还有更多有趣的设置和功能就需要自行探索了。

四、总结

随着 Docspell 的出现,数字文件管理不再是件头疼的事。它通过技术的力量简单化了复杂的问题,使个人和企业均能轻松管理自己的电子数据,让您专注于更重要的创造性任务。此次使用的 Flexus X 实例配置还是很高的 4 核 12G-100G-3M 规格的基础模式,文件上传和元数据获取处理都很快,整理文件可修改的信息配置很多,项目整体运行稳定流畅,使用体验很好。

体验华为云服务器的卓越性能,现正值 828 B2B 企业节,助力企业轻松上云!无论是初创公司还是大型企业,都能享受高效、安全的计算服务。立即注册 ,享受专属优惠,快速部署,提升业务效率。


Apipost 私有化火热进行中

评论