Skip to content

Commit 88c952c

Browse files
authored
Paperless-GPT (#2965)
* New Script: Paperless-GPT * escape .env to copy on website
1 parent 8441e65 commit 88c952c

File tree

3 files changed

+249
-0
lines changed

3 files changed

+249
-0
lines changed

ct/paperless-gpt.sh

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
6+
# Source: https://github.com/icereed/paperless-gpt
7+
8+
APP="Paperless-GPT"
9+
var_tags="os"
10+
var_cpu="3"
11+
var_ram="2048"
12+
var_disk="7"
13+
var_os="debian"
14+
var_version="12"
15+
var_unprivileged="1"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
if [[ ! -d /opt/paperless-gpt ]]; then
27+
msg_error "No Paperless-GPT installation found!"
28+
exit 1
29+
fi
30+
RELEASE=$(curl -s https://api.github.com/repos/icereed/paperless-gpt/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
31+
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
32+
msg_info "Stopping Service"
33+
systemctl stop paperless-gpt
34+
msg_ok "Service Stopped"
35+
36+
msg_info "Updating Paperless-GPT to ${RELEASE}"
37+
temp_file=$(mktemp)
38+
wget -q "https://github.com/icereed/paperless-gpt/archive/refs/tags/v${RELEASE}.tar.gz" -O $temp_file
39+
tar zxf $temp_file
40+
rm -rf /opt/paperless-gpt
41+
mv paperless-gpt-${RELEASE} /opt/paperless-gpt
42+
cd /opt/paperless-gpt/web-app
43+
$STD npm install
44+
$STD npm run build
45+
cd /opt/paperless-gpt
46+
go mod download
47+
export CC=musl-gcc
48+
CGO_ENABLED=1 go build -tags musl -o /dev/null github.com/mattn/go-sqlite3
49+
CGO_ENABLED=1 go build -tags musl -o paperless-gpt .
50+
echo "${RELEASE}" >"/opt/paperless-gpt_version.txt"
51+
msg_ok "Updated Paperless-GPT to ${RELEASE}"
52+
53+
msg_info "Starting Service"
54+
systemctl start paperless-gpt
55+
msg_ok "Started Service"
56+
57+
msg_info "Cleaning Up"
58+
rm -f $temp_file
59+
msg_ok "Cleanup Completed"
60+
msg_ok "Updated Successfully"
61+
else
62+
msg_ok "No update required. ${APP} is already at ${RELEASE}"
63+
fi
64+
exit
65+
}
66+
67+
start
68+
build_container
69+
description
70+
71+
msg_ok "Completed Successfully!\n"
72+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
73+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
74+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080${CL}"

install/paperless-gpt-install.sh

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
6+
# Source: https://github.com/icereed/paperless-gpt
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt-get install -y \
18+
sudo \
19+
curl \
20+
mc \
21+
gcc \
22+
gnupg \
23+
ca-certificates \
24+
musl-dev \
25+
mupdf \
26+
libc6-dev \
27+
musl-tools
28+
msg_ok "Installed Dependencies"
29+
30+
msg_info "Setting up Node.js Repository"
31+
mkdir -p /etc/apt/keyrings
32+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
33+
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
34+
msg_ok "Set up Node.js Repository"
35+
36+
msg_info "Installing Node.js"
37+
$STD apt-get update
38+
$STD apt-get install -y nodejs
39+
msg_ok "Installed Node.js"
40+
41+
msg_info "Installing Golang"
42+
set +o pipefail
43+
temp_file=$(mktemp)
44+
golang_tarball=$(curl -s https://go.dev/dl/ | grep -oP 'go[\d\.]+\.linux-amd64\.tar\.gz' | head -n 1)
45+
wget -q https://golang.org/dl/"$golang_tarball" -O "$temp_file"
46+
tar -C /usr/local -xzf "$temp_file"
47+
ln -sf /usr/local/go/bin/go /usr/local/bin/go
48+
rm -f "$temp_file"
49+
set -o pipefail
50+
msg_ok "Installed Golang"
51+
52+
msg_info "Setup Paperless-GPT"
53+
temp_file=$(mktemp)
54+
RELEASE=$(curl -s https://api.github.com/repos/icereed/paperless-gpt/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
55+
wget -q "https://github.com/icereed/paperless-gpt/archive/refs/tags/v${RELEASE}.tar.gz" -O $temp_file
56+
tar zxf $temp_file
57+
mv paperless-gpt-${RELEASE} /opt/paperless-gpt
58+
cd /opt/paperless-gpt/web-app
59+
$STD npm install
60+
$STD npm run build
61+
cd /opt/paperless-gpt
62+
go mod download
63+
export CC=musl-gcc
64+
CGO_ENABLED=1 go build -tags musl -o /dev/null github.com/mattn/go-sqlite3
65+
CGO_ENABLED=1 go build -tags musl -o paperless-gpt .
66+
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
67+
msg_ok "Setup Paperless-GPT"
68+
69+
mkdir -p /opt/paperless-gpt-data
70+
read -p "Do you want to enter the Paperless local URL now? (y/n) " input_url
71+
if [[ "$input_url" =~ ^[Yy]$ ]]; then
72+
read -p "Enter your Paperless-NGX instance URL (e.g., http://192.168.1.100:8000): " PAPERLESS_BASE_URL
73+
else
74+
PAPERLESS_BASE_URL="http://your_paperless_ngx_url"
75+
fi
76+
77+
read -p "Do you want to enter the Paperless API token now? (y/n) " input_token
78+
if [[ "$input_token" =~ ^[Yy]$ ]]; then
79+
read -p "Enter your Paperless API token: " PAPERLESS_API_TOKEN
80+
else
81+
PAPERLESS_API_TOKEN="your_paperless_api_token"
82+
fi
83+
84+
msg_info "Setup Environment"
85+
cat <<EOF >/opt/paperless-gpt-data/.env
86+
PAPERLESS_BASE_URL=$PAPERLESS_BASE_URL
87+
PAPERLESS_API_TOKEN=$PAPERLESS_API_TOKEN
88+
89+
LLM_PROVIDER=openai
90+
LLM_MODEL=gpt-4o
91+
OPENAI_API_KEY=your_openai_api_key
92+
93+
#VISION_LLM_PROVIDER=ollama
94+
#VISION_LLM_MODEL=minicpm-v
95+
96+
LLM_LANGUAGE=English
97+
LOG_LEVEL=info
98+
99+
LISTEN_INTERFACE=:8080
100+
101+
AUTO_TAG=paperless-gpt-auto
102+
MANUAL_TAG=paperless-gpt
103+
AUTO_OCR_TAG=paperless-gpt-ocr-auto
104+
105+
OCR_LIMIT_PAGES=5
106+
EOF
107+
msg_ok "Setup Environment"
108+
109+
msg_info "Creating Service"
110+
cat <<EOF >/etc/systemd/system/paperless-gpt.service
111+
[Unit]
112+
Description=Paperless-GPT
113+
After=network.target
114+
115+
[Service]
116+
Type=simple
117+
WorkingDirectory=/opt/paperless-gpt
118+
ExecStart=/opt/paperless-gpt/paperless-gpt
119+
Restart=always
120+
User=root
121+
EnvironmentFile=/opt/paperless-gpt-data/.env
122+
123+
[Install]
124+
WantedBy=multi-user.target
125+
EOF
126+
systemctl enable -q --now paperless-gpt
127+
msg_ok "Created Service"
128+
129+
motd_ssh
130+
customize
131+
132+
msg_info "Cleaning up"
133+
rm -f $temp_file
134+
$STD apt-get -y autoremove
135+
$STD apt-get -y autoclean
136+
msg_ok "Cleaned"

json/paperless-gpt.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "Paperless-GPT",
3+
"slug": "paperless-gpt",
4+
"categories": [
5+
20
6+
],
7+
"date_created": "2025-03-10",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 8080,
12+
"documentation": null,
13+
"website": "https://github.com/icereed/paperless-gpt",
14+
"logo": "https://raw.githubusercontent.com/icereed/paperless-gpt/refs/heads/main/web-app/src/assets/logo.svg",
15+
"description": "Paperless-GPT seamlessly pairs with paperless-ngx to generate AI-powered document titles and tags, saving you hours of manual sorting. While other tools may offer AI chat features, paperless-gpt stands out by supercharging OCR with LLMs-ensuring high accuracy, even with tricky scans. If you’re craving next-level text extraction and effortless document organization, this is your solution.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/paperless-gpt.sh",
20+
"resources": {
21+
"cpu": 3,
22+
"ram": 2048,
23+
"hdd": 7,
24+
"os": "debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": null,
31+
"password": null
32+
},
33+
"notes": [
34+
{
35+
"text": "Configuration File: `/opt/paperless-gpt-data/.env`",
36+
"type": "info"
37+
}
38+
]
39+
}

0 commit comments

Comments
 (0)