mirror of
				https://github.com/community-scripts/ProxmoxVE.git
				synced 2025-11-04 10:22:50 +00:00 
			
		
		
		
	@@ -27,6 +27,9 @@ function update_script() {
 | 
				
			|||||||
    msg_error "No ${APP} Installation Found!"
 | 
					    msg_error "No ${APP} Installation Found!"
 | 
				
			||||||
    exit
 | 
					    exit
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					  if ! dpkg -s python3-pip >/dev/null 2>&1; then
 | 
				
			||||||
 | 
					    $STD apt-get install -y python3-pip
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
  RELEASE=$(curl -fsSL https://api.github.com/repos/clusterzx/paperless-ai/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
 | 
					  RELEASE=$(curl -fsSL https://api.github.com/repos/clusterzx/paperless-ai/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
 | 
				
			||||||
  if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
 | 
					  if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
 | 
				
			||||||
    msg_info "Stopping $APP"
 | 
					    msg_info "Stopping $APP"
 | 
				
			||||||
@@ -42,6 +45,25 @@ function update_script() {
 | 
				
			|||||||
    mkdir -p /opt/paperless-ai/data
 | 
					    mkdir -p /opt/paperless-ai/data
 | 
				
			||||||
    cp -a /opt/paperless-ai_bak/data/. /opt/paperless-ai/data/
 | 
					    cp -a /opt/paperless-ai_bak/data/. /opt/paperless-ai/data/
 | 
				
			||||||
    cd /opt/paperless-ai
 | 
					    cd /opt/paperless-ai
 | 
				
			||||||
 | 
					    if [[ ! -f /etc/systemd/system/paperless-rag.service ]]; then
 | 
				
			||||||
 | 
					      cat <<EOF >/etc/systemd/system/paperless-rag.service
 | 
				
			||||||
 | 
					[Unit]
 | 
				
			||||||
 | 
					Description=PaperlessAI-RAG Service
 | 
				
			||||||
 | 
					After=network.target
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Service]
 | 
				
			||||||
 | 
					WorkingDirectory=/opt/paperless-ai
 | 
				
			||||||
 | 
					ExecStart=/usr/bin/python3 main.py --host 0.0.0.0 --port 8000 --initialize
 | 
				
			||||||
 | 
					Restart=always
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Install]
 | 
				
			||||||
 | 
					WantedBy=multi-user.target
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
					      echo "RAG_SERVICE_URL=http://localhost:8000" >>/opt/paperless-ai/data/.env
 | 
				
			||||||
 | 
					      echo "RAG_SERVICE_ENABLED=true" >>/opt/paperless-ai/data/.env
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					    $STD pip install --no-cache-dir -r requirements.txt
 | 
				
			||||||
 | 
					    mkdir -p data/chromadb
 | 
				
			||||||
    $STD npm install
 | 
					    $STD npm install
 | 
				
			||||||
    echo "${RELEASE}" >/opt/${APP}_version.txt
 | 
					    echo "${RELEASE}" >/opt/${APP}_version.txt
 | 
				
			||||||
    msg_ok "Updated $APP to v${RELEASE}"
 | 
					    msg_ok "Updated $APP to v${RELEASE}"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,20 +15,15 @@ update_os
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
msg_info "Installing Dependencies"
 | 
					msg_info "Installing Dependencies"
 | 
				
			||||||
$STD apt-get install -y \
 | 
					$STD apt-get install -y \
 | 
				
			||||||
  gpg \
 | 
					 | 
				
			||||||
  build-essential
 | 
					  build-essential
 | 
				
			||||||
msg_ok "Installed Dependencies"
 | 
					msg_ok "Installed Dependencies"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
msg_info "Setting up Node.js Repository"
 | 
					msg_info "Installing Python3"
 | 
				
			||||||
mkdir -p /etc/apt/keyrings
 | 
					$STD apt-get install -y \
 | 
				
			||||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
 | 
					  python3-pip
 | 
				
			||||||
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
 | 
					msg_ok "Installed Python3"
 | 
				
			||||||
msg_ok "Set up Node.js Repository"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
msg_info "Installing Node.js"
 | 
					install_node_and_modules
 | 
				
			||||||
$STD apt-get update
 | 
					 | 
				
			||||||
$STD apt-get install -y nodejs
 | 
					 | 
				
			||||||
msg_ok "Installed Node.js"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
msg_info "Setup Paperless-AI"
 | 
					msg_info "Setup Paperless-AI"
 | 
				
			||||||
cd /opt
 | 
					cd /opt
 | 
				
			||||||
@@ -37,6 +32,8 @@ curl -fsSL "https://github.com/clusterzx/paperless-ai/archive/refs/tags/v${RELEA
 | 
				
			|||||||
unzip -q v${RELEASE}.zip
 | 
					unzip -q v${RELEASE}.zip
 | 
				
			||||||
mv paperless-ai-${RELEASE} /opt/paperless-ai
 | 
					mv paperless-ai-${RELEASE} /opt/paperless-ai
 | 
				
			||||||
cd /opt/paperless-ai
 | 
					cd /opt/paperless-ai
 | 
				
			||||||
 | 
					$STD pip install --no-cache-dir -r requirements.txt
 | 
				
			||||||
 | 
					mkdir -p data/chromadb
 | 
				
			||||||
$STD npm install
 | 
					$STD npm install
 | 
				
			||||||
mkdir -p /opt/paperless-ai/data
 | 
					mkdir -p /opt/paperless-ai/data
 | 
				
			||||||
cat <<EOF >/opt/paperless-ai/data/.env
 | 
					cat <<EOF >/opt/paperless-ai/data/.env
 | 
				
			||||||
@@ -61,6 +58,8 @@ API_KEY=
 | 
				
			|||||||
CUSTOM_API_KEY=
 | 
					CUSTOM_API_KEY=
 | 
				
			||||||
CUSTOM_BASE_URL=
 | 
					CUSTOM_BASE_URL=
 | 
				
			||||||
CUSTOM_MODEL=
 | 
					CUSTOM_MODEL=
 | 
				
			||||||
 | 
					RAG_SERVICE_URL=http://localhost:8000
 | 
				
			||||||
 | 
					RAG_SERVICE_ENABLED=true
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
 | 
					echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
 | 
				
			||||||
msg_ok "Setup Paperless-AI"
 | 
					msg_ok "Setup Paperless-AI"
 | 
				
			||||||
@@ -69,7 +68,8 @@ msg_info "Creating Service"
 | 
				
			|||||||
cat <<EOF >/etc/systemd/system/paperless-ai.service
 | 
					cat <<EOF >/etc/systemd/system/paperless-ai.service
 | 
				
			||||||
[Unit]
 | 
					[Unit]
 | 
				
			||||||
Description=PaperlessAI Service
 | 
					Description=PaperlessAI Service
 | 
				
			||||||
After=network.target
 | 
					After=network.target paperless-rag.service
 | 
				
			||||||
 | 
					Requires=paperless-rag.service
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Service]
 | 
					[Service]
 | 
				
			||||||
WorkingDirectory=/opt/paperless-ai
 | 
					WorkingDirectory=/opt/paperless-ai
 | 
				
			||||||
@@ -79,6 +79,22 @@ Restart=always
 | 
				
			|||||||
[Install]
 | 
					[Install]
 | 
				
			||||||
WantedBy=multi-user.target
 | 
					WantedBy=multi-user.target
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cat <<EOF >/etc/systemd/system/paperless-rag.service
 | 
				
			||||||
 | 
					[Unit]
 | 
				
			||||||
 | 
					Description=PaperlessAI-RAG Service
 | 
				
			||||||
 | 
					After=network.target
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Service]
 | 
				
			||||||
 | 
					WorkingDirectory=/opt/paperless-ai
 | 
				
			||||||
 | 
					ExecStart=/usr/bin/python3 main.py --host 0.0.0.0 --port 8000 --initialize
 | 
				
			||||||
 | 
					Restart=always
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Install]
 | 
				
			||||||
 | 
					WantedBy=multi-user.target
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
					systemctl enable -q --now paperless-rag
 | 
				
			||||||
 | 
					sleep 5
 | 
				
			||||||
systemctl enable -q --now paperless-ai
 | 
					systemctl enable -q --now paperless-ai
 | 
				
			||||||
msg_ok "Created Service"
 | 
					msg_ok "Created Service"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user