@@ -27,58 +27,33 @@ function update_script() {
2727 msg_error " No ${APP} Installation Found!"
2828 exit
2929 fi
30- if ! dpkg -s python3-pip > /dev/null 2>&1 ; then
31- $STD apt install -y python3-pip
32- fi
33- RELEASE=$( curl -fsSL https://api.github.com/repos/clusterzx/paperless-ai/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
34- if [[ " ${RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]] || [[ ! -f /opt/${APP} _version.txt ]]; then
35- msg_info " Stopping Service"
36- systemctl stop paperless-ai
37- msg_info " Stopped Service"
3830
39- msg_info " Updating $APP to v${RELEASE} "
40- cd /opt
41- mv /opt/paperless-ai /opt/paperless-ai_bak
42- curl -fsSL " https://github.com/clusterzx/paperless-ai/archive/refs/tags/v${RELEASE} .zip" -o $( basename " https://github.com/clusterzx/paperless-ai/archive/refs/tags/v${RELEASE} .zip" )
43- $STD unzip v${RELEASE} .zip
44- mv paperless-ai-${RELEASE} /opt/paperless-ai
45- mkdir -p /opt/paperless-ai/data
46- cp -a /opt/paperless-ai_bak/data/. /opt/paperless-ai/data/
47- cd /opt/paperless-ai
48- if [[ ! -f /etc/systemd/system/paperless-rag.service ]]; then
49- cat << EOF >/etc/systemd/system/paperless-rag.service
50- [Unit]
51- Description=PaperlessAI-RAG Service
52- After=network.target
31+ if check_for_gh_release " paperless-ai" " clusterzx/paperless-ai" ; then
32+ msg_info " Stopping Service"
33+ systemctl stop paperless-ai paperless-rag
34+ msg_ok " Stopped Service"
5335
54- [Service]
55- WorkingDirectory=/opt/paperless-ai
56- ExecStart=/usr/bin/python3 main.py --host 0.0.0.0 --port 8000 --initialize
57- Restart=always
36+ fetch_and_deploy_gh_release " paperless-ai" " clusterzx/paperless-ai"
5837
59- [Install]
60- WantedBy=multi-user.target
61- EOF
62- echo " RAG_SERVICE_URL=http://localhost:8000" >> /opt/paperless-ai/data/.env
63- echo " RAG_SERVICE_ENABLED=true" >> /opt/paperless-ai/data/.env
64- fi
38+ msg_info " Updating Paperless-AI"
39+ cd /opt/paperless-ai
40+ source /opt/paperless-ai/venv/bin/activate
41+ $STD pip install --upgrade pip
6542 $STD pip install --no-cache-dir -r requirements.txt
6643 mkdir -p data/chromadb
67- $STD npm install
68- rm -rf /opt/v${RELEASE} .zip
69- rm -rf /opt/paperless-ai_bak
70- echo " ${RELEASE} " > /opt/${APP} _version.txt
71- msg_ok " Updated $APP to v${RELEASE} "
44+ $STD npm ci --only=production
45+ msg_ok " Updated Paperless-AI"
7246
7347 msg_info " Starting Service"
48+ systemctl start paperless-rag
49+ sleep 3
7450 systemctl start paperless-ai
7551 msg_ok " Started Service"
7652 msg_ok " Updated successfully!"
77- else
78- msg_ok " No update required. ${APP} is already at v${RELEASE} "
7953 fi
8054 exit
8155}
56+
8257start
8358build_container
8459description
0 commit comments