Refactor: Trilium (#5665)

* Refactor: Trilium

* change name & description of trilium

* finalize

* Change Logo to new selfhst

* Update trilium.sh

---------

Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com>
This commit is contained in:
CanbiZ 2025-07-03 15:49:02 +02:00 committed by GitHub
parent c293b058c0
commit 5ac4818030
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 51 additions and 64 deletions

View File

@ -3,9 +3,9 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
# Copyright (c) 2021-2025 tteck # Copyright (c) 2021-2025 tteck
# Author: tteck (tteckster) # Author: tteck (tteckster)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://triliumnext.github.io/Docs/ # Source: https://github.com/TriliumNext/Trilium
APP="Trilium" APP="Trilium Notes"
var_tags="${var_tags:-notes}" var_tags="${var_tags:-notes}"
var_cpu="${var_cpu:-1}" var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-512}" var_ram="${var_ram:-512}"
@ -27,57 +27,52 @@ function update_script() {
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
if [[ ! -f /opt/${APP}_version.txt ]]; then touch /opt/${APP}_version.txt; fi RELEASE=$(curl -fsSL https://api.github.com/repos/TriliumNext/Trilium/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
RELEASE=$(curl -fsSL https://api.github.com/repos/TriliumNext/Notes/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') if [[ "${RELEASE}" != "$(cat ~/.Trilium 2>/dev/null)" ]] || [[ ! -f ~/.Trilium ]]; then
if [[ "v${RELEASE}" != "$(cat /opt/${APP}_version.txt 2>/dev/null)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
if [[ -d /opt/trilium/db ]]; then
if [[ -d /opt/trilium/db ]]; then DB_PATH="/opt/trilium/db"
DB_PATH="/opt/trilium/db" DB_RESTORE_PATH="/opt/trilium/db"
DB_RESTORE_PATH="/opt/trilium/db" elif [[ -d /opt/trilium/assets/db ]]; then
elif [[ -d /opt/trilium/assets/db ]]; then DB_PATH="/opt/trilium/assets/db"
DB_PATH="/opt/trilium/assets/db" DB_RESTORE_PATH="/opt/trilium/assets/db"
DB_RESTORE_PATH="/opt/trilium/assets/db" else
msg_error "Database not found in either /opt/trilium/db or /opt/trilium/assets/db"
exit 1
fi
msg_info "Stopping ${APP}"
systemctl stop trilium
sleep 1
msg_ok "Stopped ${APP}"
msg_info "Backing up Database"
mkdir -p /opt/trilium_backup
cp -r "${DB_PATH}" /opt/trilium_backup/
rm -rf /opt/trilium
msg_ok "Backed up Database"
fetch_and_deploy_gh_release "Trilium" "TriliumNext/Trilium" "prebuild" "latest" "/opt/trilium" "TriliumNotes-Server-*linux-x64.tar.xz"
msg_info "Restoring Database"
mkdir -p "$(dirname "${DB_RESTORE_PATH}")"
cp -r /opt/trilium_backup/$(basename "${DB_PATH}") "${DB_RESTORE_PATH}"
msg_ok "Restored Database"
msg_info "Cleaning up"
rm -rf /opt/trilium_backup
msg_ok "Cleaned"
msg_info "Starting ${APP}"
systemctl start trilium
sleep 1
msg_ok "Started ${APP}"
msg_ok "Updated Successfully"
else else
msg_error "Database not found in either /opt/trilium/db or /opt/trilium/assets/db" msg_ok "No update required. ${APP} is already at ${RELEASE}"
exit 1
fi fi
msg_info "Stopping ${APP}" exit
systemctl stop trilium
sleep 1
msg_ok "Stopped ${APP}"
msg_info "Updating to ${RELEASE}"
mkdir -p /opt/trilium_backup
cp -r "${DB_PATH}" /opt/trilium_backup/
rm -rf /opt/trilium
cd /tmp
curl -fsSL "https://github.com/TriliumNext/trilium/releases/download/v${RELEASE}/TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz" -o "TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz"
tar -xf "TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz"
mv "TriliumNextNotes-Server-${RELEASE}-linux-x64" /opt/trilium
# Restore database
mkdir -p "$(dirname "${DB_RESTORE_PATH}")"
cp -r /opt/trilium_backup/$(basename "${DB_PATH}") "${DB_RESTORE_PATH}"
echo "v${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated to ${RELEASE}"
msg_info "Cleaning up"
rm -rf "/tmp/TriliumNextNotes-Server-${RELEASE}-linux-x64.tar.xz"
rm -rf /opt/trilium_backup
msg_ok "Cleaned"
msg_info "Starting ${APP}"
systemctl start trilium
sleep 1
msg_ok "Started ${APP}"
msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit
} }
start start

View File

@ -1,5 +1,5 @@
{ {
"name": "TriliumNext", "name": "Trilium Notes",
"slug": "trilium", "slug": "trilium",
"categories": [ "categories": [
12 12
@ -9,11 +9,11 @@
"updateable": true, "updateable": true,
"privileged": false, "privileged": false,
"interface_port": 8080, "interface_port": 8080,
"documentation": "https://triliumnext.github.io/Docs/", "documentation": "https://github.com/TriliumNext/trilium/wiki",
"website": "https://github.com/TriliumNext/trilium", "website": "https://github.com/TriliumNext/trilium",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/triliumnext.webp", "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/trilium-notes.webp",
"config_path": "/root/trilium-data/config.ini", "config_path": "/root/trilium-data/config.ini",
"description": "TriliumNext is an newer Fork of Trilium. TriliumNext is an open-source note-taking and personal knowledge management application. It allows users to organize and manage their notes, ideas, and information in a single place, using a hierarchical tree-like structure. Trilium offers a range of features, including rich text formatting, links, images, and attachments, making it easy to create and structure notes. The software is designed to be flexible and customizable, with a range of customization options and plugins available, including themes, export options, and more. Trilium is a self-hosted solution, and can be run on a local machine or a cloud-based server, providing users with full control over their notes and information.", "description": "Trilium Notes is the latest and officially maintained version of the powerful, self-hosted note-taking and personal knowledge management application. It enables users to organize information in a hierarchical tree structure and supports rich text editing, internal linking, images, attachments, and powerful scripting capabilities. This version reflects the most current development efforts under the TriliumNext organization and replaces all prior forks or legacy variants. Trilium is ideal for building personal wikis, structured documentation, and long-term knowledge archives, giving users full local control and privacy.",
"install_methods": [ "install_methods": [
{ {
"type": "default", "type": "default",

View File

@ -3,7 +3,7 @@
# Copyright (c) 2021-2025 tteck # Copyright (c) 2021-2025 tteck
# Author: tteck (tteckster) # Author: tteck (tteckster)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://triliumnext.github.io/Docs/ # Source: https://github.com/TriliumNext/Trilium
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color color
@ -13,14 +13,7 @@ setting_up_container
network_check network_check
update_os update_os
msg_info "Setup TriliumNext" fetch_and_deploy_gh_release "Trilium" "TriliumNext/Trilium" "prebuild" "latest" "/opt/trilium" "TriliumNotes-Server-*linux-x64.tar.xz"
cd /opt
RELEASE=$(curl -fsSL https://api.github.com/repos/TriliumNext/trilium/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
curl -fsSL "https://github.com/TriliumNext/trilium/releases/download/v${RELEASE}/TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz" -o "TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz"
tar -xf TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz
mv TriliumNextNotes-Server-$RELEASE-linux-x64 /opt/trilium
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
msg_ok "Setup TriliumNext"
msg_info "Creating Service" msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/trilium.service cat <<EOF >/etc/systemd/system/trilium.service
@ -46,7 +39,6 @@ motd_ssh
customize customize
msg_info "Cleaning up" msg_info "Cleaning up"
rm -rf /opt/TriliumNextNotes-Server-${RELEASE}-linux-x64.tar.xz
$STD apt-get -y autoremove $STD apt-get -y autoremove
$STD apt-get -y autoclean $STD apt-get -y autoclean
msg_ok "Cleaned" msg_ok "Cleaned"