@@ -15,20 +15,15 @@ update_os
1515
1616msg_info " Installing Dependencies"
1717$STD apt-get install -y \
18- gpg \
1918 build-essential
2019msg_ok " Installed Dependencies"
2120
22- msg_info " Setting up Node.js Repository"
23- mkdir -p /etc/apt/keyrings
24- curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
25- 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
26- msg_ok " Set up Node.js Repository"
21+ msg_info " Installing Python3"
22+ $STD apt-get install -y \
23+ python3-pip
24+ msg_ok " Installed Python3"
2725
28- msg_info " Installing Node.js"
29- $STD apt-get update
30- $STD apt-get install -y nodejs
31- msg_ok " Installed Node.js"
26+ install_node_and_modules
3227
3328msg_info " Setup Paperless-AI"
3429cd /opt
@@ -37,6 +32,8 @@ curl -fsSL "https://github.com/clusterzx/paperless-ai/archive/refs/tags/v${RELEA
3732unzip -q v${RELEASE} .zip
3833mv paperless-ai-${RELEASE} /opt/paperless-ai
3934cd /opt/paperless-ai
35+ $STD pip install --no-cache-dir -r requirements.txt
36+ mkdir -p data/chromadb
4037$STD npm install
4138mkdir -p /opt/paperless-ai/data
4239cat << EOF >/opt/paperless-ai/data/.env
@@ -61,6 +58,8 @@ API_KEY=
6158CUSTOM_API_KEY=
6259CUSTOM_BASE_URL=
6360CUSTOM_MODEL=
61+ RAG_SERVICE_URL=http://localhost:8000
62+ RAG_SERVICE_ENABLED=true
6463EOF
6564echo " ${RELEASE} " > " /opt/${APPLICATION} _version.txt"
6665msg_ok " Setup Paperless-AI"
@@ -69,7 +68,8 @@ msg_info "Creating Service"
6968cat << EOF >/etc/systemd/system/paperless-ai.service
7069[Unit]
7170Description=PaperlessAI Service
72- After=network.target
71+ After=network.target paperless-rag.service
72+ Requires=paperless-rag.service
7373
7474[Service]
7575WorkingDirectory=/opt/paperless-ai
@@ -79,6 +79,22 @@ Restart=always
7979[Install]
8080WantedBy=multi-user.target
8181EOF
82+
83+ cat << EOF >/etc/systemd/system/paperless-rag.service
84+ [Unit]
85+ Description=PaperlessAI-RAG Service
86+ After=network.target
87+
88+ [Service]
89+ WorkingDirectory=/opt/paperless-ai
90+ ExecStart=/usr/bin/python3 main.py --host 0.0.0.0 --port 8000 --initialize
91+ Restart=always
92+
93+ [Install]
94+ WantedBy=multi-user.target
95+ EOF
96+ systemctl enable -q --now paperless-rag
97+ sleep 5
8298systemctl enable -q --now paperless-ai
8399msg_ok " Created Service"
84100
0 commit comments