Paperless-ngx ใช้ดูแลจัดการเอกสาร
เป็นแอพที่ไว้ช่วยจัดการเอกสารต่าง ๆ ให้เป็นระเบียบ รองรับ multi user ในการเข้ามาใช้ร่วมกัน แต่ไม่มีของใครของมันนะ โดยแอพเองมี OCR ข้อความในเอกสารได้หลายภาษา รวมภาษาไทยด้วย ช่วยให้ค้นหาสิ่งที่ต้องการได้ง่ายขึ้น คือมีรายละเอียดอื่น ๆ เยอะมากลองไปงมดูได้ใน https://github.com/paperless-ngx/paperless-ngx หรือลองดู demo จากในนั้นก็ได้
อย่าคาดหวังมากกับ OCR ภาษาไทย จากที่ลองคือแค่พอใช้ได้
ไฟล์ docker-compose ด้านล่างนี้ ผ่านการลองถูกลองผิดมาเยอะพอสมควร และได้ทำการรวม env ที่น่าจะสำคัญทำมาให้หมดแล้ว ไม่ต้องสร้างไฟล์แยกแบบตัวติดตั้งต้นฉบับ และได้แก้ระบบ folder เรียงไฟล์ให้ใหม่ เผื่อแอพนี้ระเบิดจะได้ค้นไฟล์ง่าย ๆ ในภายหลัง
ขั้นตอนติดตั้ง
จัดเตรียมไฟล์
save code ด้านล่างไปทำไฟล์ docker-compose.yaml
# docker-compose file for running paperless from the docker container registry.
# This file contains everything paperless needs to run.
# Paperless supports amd64, arm and arm64 hardware.
# All compose files of paperless configure paperless in the following way:
#
# - Paperless is (re)started on system boot, if it was running before shutdown.
# - Docker volumes for storing data are managed by Docker.
# - Folders for importing and exporting files are created in the same directory
# as this file and mounted to the correct folders inside the container.
# - Paperless listens on port 8000.
#
# SQLite is used as the database. The SQLite file is stored in the data volume.
#
# In addition to that, this docker-compose file adds the following optional
# configurations:
#
# - Apache Tika and Gotenberg servers are started with paperless and paperless
# is configured to use these services. These provide support for consuming
# Office documents (Word, Excel, Power Point and their LibreOffice counter-
# parts.
#
# For more extensive installation and update instructions, refer to the
# documentation.
version: "3.4"
services:
broker:
image: redis:6.0
restart: always
volumes:
- /volume1/docker/paperless-redis:/data # <-- Update
webserver:
image: ghcr.io/paperless-ngx/paperless-ngx:latest
restart: always
depends_on:
- broker
- gotenberg
- tika
ports:
- 8010:8000 # <-- Update
healthcheck:
test: ["CMD", "curl", "-fs", "-S", "--max-time", "2", "http://localhost:8010"] # <-- Update
interval: 30s
timeout: 10s
retries: 5
volumes:
- /volume1/docker/paperless-ngx/data:/usr/src/paperless/data # <-- Update
- /volume1/docker/paperless-ngx/media:/usr/src/paperless/media # <-- Update
- /volume1/docker/paperless-ngx/export:/usr/src/paperless/export # <-- Update
- /volume1/docker/paperless-ngx/consume:/usr/src/paperless/consume # <-- Update
environment:
PAPERLESS_REDIS: redis://broker:6379
PAPERLESS_TIKA_ENABLED: 1
PAPERLESS_TIKA_GOTENBERG_ENDPOINT: http://gotenberg:3000
PAPERLESS_TIKA_ENDPOINT: http://tika:9998
USERMAP_UID: 1035 # <-- Update
USERMAP_GID: 100 # <-- Update
PAPERLESS_SECRET_KEY: fdsfdsfdszcbvcngikh # <-- Update
PAPERLESS_URL: https://paperless.yourname.synology.com # <-- Update
PAPERLESS_TIME_ZONE: Asia/Bangkok
PAPERLESS_OCR_LANGUAGES: tha
PAPERLESS_OCR_LANGUAGE: tha+eng
PAPERLESS_ADMIN_USER: admin # <-- Update
PAPERLESS_ADMIN_PASSWORD: admin # <-- Update
PAPERLESS_FILENAME_FORMAT: "{correspondent}/{created_year}-{created_month}_{correspondent}-{title}"
gotenberg:
image: gotenberg/gotenberg:7.4
restart: always
command:
- "gotenberg"
- "--chromium-disable-routes=true"
tika:
image: ghcr.io/paperless-ngx/tika:latest
restart: always
volumes:
data:
media:
redisdata:
ใช้ notepad หรืออะไรก็ได้เปิดไฟล์ docker-compose.yaml ขึ้นมา เน้นดูตรงส่วนของ comment ในไฟล์ แก้ให้ตรงกับที่ใช้
ports:
- 8010:8000 # <-- Update
healthcheck:
test: ["CMD", "curl", "-fs", "-S", "--max-time", "2", "http://localhost:8010"] # <-- Update
port ที่ใช้เชื่อมต่อ default และ container port ค่าเริ่มต้นตั้งมาที่ 8000 ในตัวอย่างต้ั้งไว้ที่ 8010 ส่วนของ healthcheck ก็ตั้ง port ให้ตรงกัน ถ้าไปใช้ port อื่น
USERMAP_UID: 1035 # <-- Update
USERMAP_GID: 100 # <-- Update
PUID และ PGID ตั้งให้ตรงกับ ID ของเราเพื่อกันไม่ให้เกิดปัญหาเกี่ยวกับ permission ของ docker หาได้จากที่นี่
PAPERLESS_SECRET_KEY: fdsfdsfdszcbvcngikh # <-- Update
PAPERLESS_URL: https://paperless.yourname.synology.me # <-- Update
PAPERLESS_SECRET_KEY สิ่งที่ช่วยให้เราโดน hack ได้ยากขึ้นถ้าเปิด paperless ให้เข้าใช้ได้จาก internet วิธีทำคือ พิมพ์อักษรอะไรก็ได้ไปมั่ว ๆ ยิ่งยาวยิ่งดี ถ้านึกไม่ออกเอามือรูด keyboard ไปเลยก็ได้ 🤣
PAPERLESS_URL เช่นเดียวกับด้านบนเพื่อความปลอดภัย ตั้งให้ตรงกับ URL ที่เราจะใช้ ถ้าไม่ได้ใช้ reverse proxy ควรตั้งให้เป็น DDNS หรือ IP และ Port ที่ใช้งาน เช่น
ถ้า Reverse Proxy URL ของคุณคือ yourname.synology.me และต้องการเข้าผ่านทางซับโดเมน paperless ก็ใส่เป็น https://paperless.yourname.synology.me
ถ้าไม่ใช้ reverse proxy หรือ DDNS คือไม่ต้องการให้เชื่อมต่อได้จาก internet ก็อาจใส่แค่ ip และ port พอ คือ http://192.168.10:8010
ระวังเรื่อง HTTP, HTTPS ใส่ให้ถูกต้องเดี๋ยวจะเข้าไม่ได้ รวมถึงเรื่อง forward port ด้วย ถ้าไม่ได้ใช้ reverse proxy
การตั้งค่าในส่วนนี้มีความวุ่นวายพอสมควรและซับซ้อน เพราะมี env หลายตัวให้ตั้งค่า ถ้าต้องการทำนอกเหนือจากนี้ให้ไปดูเอกสารเต็มที่ https://paperless-ngx.readthedocs.io/en/latest/configuration.html#hosting-security
PAPERLESS_ADMIN_USER: admin # <-- Update
PAPERLESS_ADMIN_PASSWORD: admin # <-- Update
ตั้งค่า Username และ Password ในการเข้าสู่ระบบสำหรับ Admin หรือจะลบทั้ง 2 แถวนี้ออกไปเลยก็ได้ แล้วค่อยเข้าไปเปลี่ยนภายในเมนู Admin (default: admin/admin)
หากมีการแก้ใข Username หรือ Password ผ่านระบบ Admin ภายใน Paperless-ngx แล้วยังมี env 2 ค่านี้อยู่ ทุกครั้งที่ run docker ใหม่ ระบบจะถูกรีเซตกลับมาเป็นค่านี้ทุกครั้ง ดังนั้นถ้าไม่ต้องการให้ Username หรือ Password มีการเปลี่ยนแปลง แนะนำให้ลบ 2 ค่านี้ก่อนเริ่มทำงาน docker ใหม่ ในส่วนที่ใช้จัดการ env ของ synology docker
แก้เสร็จหมดแล้วให้เซฟไฟล์
จัดเตรียม folder ติดตั้ง
ย้อนกลับไปดูไฟล์ docker-compose.yaml อีกครั้ง ในส่วนของ volume
volumes:
- /volume1/docker/paperless-redis:/data # <-- Update
และ
volumes:
- /volume1/docker/paperless-ngx/data:/usr/src/paperless/data # <-- Update
- /volume1/docker/paperless-ngx/media:/usr/src/paperless/media # <-- Update
- /volume1/docker/paperless-ngx/export:/usr/src/paperless/export # <-- Update
- /volume1/docker/paperless-ngx/consume:/usr/src/paperless/consume # <-- Update
จะเห็นได้ว่าเราจะต้องมีการสร้าง 2 folder ย่อยใน docker นอกจากนี้จะมีอีก 4 folder ย่อยใน paperless-ngx อีกด้วย หน้าตาก็จะได้ประมาณนี้
docker
│
│
└─── paperless-ngx
│ │ docker-compose.yaml
│ │
│ └─── data
│ │
│ └─── media
│ │
│ └─── export
│ │
│ └─── consume
│
└─── paperless-redis
ถ้าต้องการใช้ชื่ออื่นก็แล้วแต่สะดวก แต่ย้อนกลับไปแก้ docker-compose.yaml ด้วยให้ถูกต้องด้วยด้วย
เข้าไปจัดการสร้าง folder ผ่าน File Station ใน DSM ให้เรียบร้อย
ตัวอักษรเล็กใหญ่มีผล ตั้งให้ถูกต้อง
หลังจากนั้น copy ไฟล์ docker-compose.yml ที่ทำไว้แล้วไปใส่ไว้ใน paperless-ngx และทำการติดตั้งตามขั้นตอนปกติได้เลย
https://mariushosting.com/how-to-install-paperless-ngx-on-your-synology-nas/

