Archivebox: UV Migration

This commit is contained in:
CanbiZ 2025-06-04 10:07:08 +02:00
parent 3b912745e7
commit cd4a9d4b55

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/python_to_uv/misc/build.func)
# Copyright (c) 2021-2025 tteck # Copyright (c) 2021-2025 tteck
# Author: tteck # Author: tteck
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
@ -20,29 +20,45 @@ color
catch_errors catch_errors
function update_script() { function update_script() {
header_info header_info
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -d /opt/archivebox ]]; then if [[ ! -d /opt/archivebox ]]; then
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit
fi
msg_info "Stopping ${APP}"
systemctl stop archivebox
msg_ok "Stopped ${APP}"
msg_info "Updating ${APP}"
cd /opt/archivebox/data
pip install --upgrade --ignore-installed archivebox
sudo -u archivebox archivebox init
msg_ok "Updated ${APP}"
msg_info "Starting ${APP}"
systemctl start archivebox
msg_ok "Started ${APP}"
msg_ok "Updated Successfully"
exit exit
fi
msg_info "Stopping ${APP}"
systemctl stop archivebox
msg_ok "Stopped ${APP}"
msg_info "Updating ${APP}"
cd /opt/archivebox
$STD uv venv --python "$UV_PYTHON_VERSION" .venv
if [[ -f /opt/archivebox/uv.lock ]]; then
cp /opt/archivebox/uv.lock /opt/archivebox/data/ || true
fi
cd /opt/archivebox/data
$STD ../.venv/bin/uv sync
msg_info "Running ArchiveBox Setup"
sudo -u archivebox ../.venv/bin/playwright install-deps chromium
sudo -u archivebox ../.venv/bin/playwright install chromium
sudo -u archivebox ../.venv/bin/archivebox init
msg_ok "ArchiveBox Updated"
if grep -q "ExecStart=/usr/local/bin/archivebox" /etc/systemd/system/archivebox.service; then
sed -i "s|ExecStart=/usr/local/bin/archivebox|ExecStart=/opt/archivebox/.venv/bin/archivebox|" /etc/systemd/system/archivebox.service
systemctl daemon-reload
fi
msg_info "Starting ${APP}"
systemctl start archivebox
msg_ok "Started ${APP}"
msg_ok "Updated Successfully"
exit
} }
start start
@ -52,4 +68,4 @@ description
msg_ok "Completed Successfully!\n" msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8000/admin/login${CL}" echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8000/admin/login${CL}"