From d224f3391356816c86e8384fd4f731f4abd70af7 Mon Sep 17 00:00:00 2001 From: Jin <22962980+JYC333@users.noreply.github.com> Date: Tue, 12 Aug 2025 22:03:36 +0200 Subject: [PATCH] =?UTF-8?q?docs:=20=E2=9C=8F=EF=B8=8F=20Improve=20OIDC=20d?= =?UTF-8?q?ocs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Packaged version for Linux.html | 96 +++++++++++++++++++ .../Using Docker.html | 32 +++---- .../Multi-Factor Authentication.html | 72 +++++++++----- .../Packaged version for Linux.md | 11 ++- .../1. Installing the server/Using Docker.md | 2 +- .../Multi-Factor Authentication.md | 16 +++- 6 files changed, 183 insertions(+), 46 deletions(-) diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Packaged version for Linux.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Packaged version for Linux.html index 4fd608881..52566a4a0 100644 --- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Packaged version for Linux.html +++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Packaged version for Linux.html @@ -59,6 +59,102 @@ WantedBy=multi-user.target
Run as the same User Trilium runs
+if you run as root please remove 'sudo' from the commands
+requires "jq" apt install jq
+
It will stop the service above, overwrite everything (i expect no config.ini), + and start service It also creates a version file in the Trilium directory + so it updates only with a newer Version
#!/bin/bash
+
+# Configuration
+REPO="TriliumNext/Trilium"
+PATTERN="TriliumNotes-Server-.*-linux-x64.tar.xz"
+DOWNLOAD_DIR="/var/tmp/trilium_download"
+OUTPUT_DIR="/opt/trilium"
+SERVICE_NAME="trilium"
+VERSION_FILE="$OUTPUT_DIR/version.txt"
+
+# Ensure dependencies are installed
+command -v curl >/dev/null 2>&1 || { echo "Error: curl is required"; exit 1; }
+command -v jq >/dev/null 2>&1 || { echo "Error: jq is required"; exit 1; }
+command -v tar >/dev/null 2>&1 || { echo "Error: tar is required"; exit 1; }
+
+# Create download directory
+mkdir -p "$DOWNLOAD_DIR" || { echo "Error: Cannot create $DOWNLOAD_DIR"; exit 1; }
+
+# Get the latest release version
+LATEST_VERSION=$(curl -sL https://api.github.com/repos/$REPO/releases/latest | jq -r '.tag_name')
+if [ -z "$LATEST_VERSION" ]; then
+ echo "Error: Could not fetch latest release version"
+ exit 1
+fi
+
+# Check current installed version (from version.txt or existing tarball)
+CURRENT_VERSION=""
+if [ -f "$VERSION_FILE" ]; then
+ CURRENT_VERSION=$(cat "$VERSION_FILE")
+elif [ -f "$DOWNLOAD_DIR/TriliumNotes-Server-$LATEST_VERSION-linux-x64.tar.xz" ]; then
+ CURRENT_VERSION="$LATEST_VERSION"
+fi
+
+# Compare versions
+if [ "$CURRENT_VERSION" = "$LATEST_VERSION" ]; then
+ echo "Latest version ($LATEST_VERSION) is already installed"
+ exit 0
+fi
+
+# Download the latest release
+LATEST_URL=$(curl -sL https://api.github.com/repos/$REPO/releases/latest | jq -r ".assets[] | select(.name | test(\"$PATTERN\")) | .browser_download_url")
+if [ -z "$LATEST_URL" ]; then
+ echo "Error: No asset found matching pattern '$PATTERN'"
+ exit 1
+fi
+
+FILE_NAME=$(basename "$LATEST_URL")
+FILE_PATH="$DOWNLOAD_DIR/$FILE_NAME"
+
+# Download if not already present
+if [ -f "$FILE_PATH" ]; then
+ echo "Latest release $FILE_NAME already downloaded"
+else
+ curl -LO --output-dir "$DOWNLOAD_DIR" "$LATEST_URL" || { echo "Error: Download failed"; exit 1; }
+ echo "Downloaded $FILE_NAME to $DOWNLOAD_DIR"
+fi
+
+# Extract the tarball
+EXTRACT_DIR="$DOWNLOAD_DIR/extracted"
+mkdir -p "$EXTRACT_DIR"
+tar -xJf "$FILE_PATH" -C "$EXTRACT_DIR" || { echo "Error: Extraction failed"; exit 1; }
+
+# Find the extracted directory (e.g., TriliumNotes-Server-0.97.2-linux-x64)
+INNER_DIR=$(find "$EXTRACT_DIR" -maxdepth 1 -type d -name "TriliumNotes-Server-*-linux-x64" | head -n 1)
+if [ -z "$INNER_DIR" ]; then
+ echo "Error: Could not find extracted directory matching TriliumNotes-Server-*-linux-x64"
+ exit 1
+fi
+
+# Stop the trilium-server service
+if systemctl is-active --quiet "$SERVICE_NAME"; then
+ echo "Stopping $SERVICE_NAME service..."
+ sudo systemctl stop "$SERVICE_NAME" || { echo "Error: Failed to stop $SERVICE_NAME"; exit 1; }
+fi
+
+# Copy contents to /opt/trilium, overwriting existing files
+echo "Copying contents from $INNER_DIR to $OUTPUT_DIR..."
+sudo mkdir -p "$OUTPUT_DIR"
+sudo cp -r "$INNER_DIR"/* "$OUTPUT_DIR"/ || { echo "Error: Copy failed"; exit 1; }
+echo "$LATEST_VERSION" | sudo tee "$VERSION_FILE" >/dev/null
+echo "Files copied to $OUTPUT_DIR"
+
+# Start the trilium-server service
+echo "Starting $SERVICE_NAME service..."
+sudo systemctl start "$SERVICE_NAME" || { echo "Error: Failed to start $SERVICE_NAME"; exit 1; }
+
+# Clean up
+rm -rf "$EXTRACT_DIR"
+echo "Cleanup complete. Trilium updated to $LATEST_VERSION."
Error: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /var/www/virtual/.../node_modules/@mlink/scrypt/build/Release/scrypt.node)
at Object.Module._extensions..node (module.js:681:18)
diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Using Docker.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Using Docker.html
index 60e5d049e..53b131799 100644
--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Using Docker.html
+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Using Docker.html
@@ -1,6 +1,6 @@
Official docker images are published on docker hub for AMD64, ARMv7 and ARM64/v8:
https://hub.docker.com/r/triliumnext/notes/
+ href="https://hub.docker.com/r/triliumnext/trilium/">https://hub.docker.com/r/triliumnext/trilium/
Prerequisites
Ensure Docker is installed on your system.
@@ -15,7 +15,7 @@
mounting your SMB share.
Running with Docker Compose
-Grab the latest docker-compose.yml:
wget https://raw.githubusercontent.com/TriliumNext/Notes/master/docker-compose.yml
+Grab the latest docker-compose.yml:
wget https://raw.githubusercontent.com/TriliumNext/Trilium/master/docker-compose.yml
Optionally, edit the docker-compose.yml
file to configure the
container settings prior to starting it. Unless configured otherwise, the
data directory will be ~/trilium-data
and the container will
@@ -26,7 +26,7 @@
Pulling the Docker Image
To pull the image, use the following command, replacing [VERSION]
with
the desired version or tag, such as v0.91.6
or just latest
.
- (See published tag names at https://hub.docker.com/r/triliumnext/notes/tags.):
docker pull triliumnext/notes:v0.91.6
+ (See published tag names at https://hub.docker.com/r/triliumnext/trilium/tags.):docker pull triliumnext/trilium:v0.91.6
Warning: Avoid using the "latest" tag, as it may automatically
upgrade your instance to a new minor version, potentially disrupting sync
setups or causing other issues.
@@ -37,7 +37,7 @@
Local Access Only
Run the container to make it accessible only from the localhost. This
setup is suitable for testing or when using a proxy server like Nginx or
- Apache.
sudo docker run -t -i -p 127.0.0.1:8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:[VERSION]
+ Apache.sudo docker run -t -i -p 127.0.0.1:8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/trilium:[VERSION]
- Verify the container is running using
docker ps
.
- Access Trilium via a web browser at
127.0.0.1:8080
.
@@ -45,20 +45,20 @@
Local Network Access
To make the container accessible only on your local network, first create
a new Docker network:
docker network create -d macvlan -o parent=eth0 --subnet 192.168.2.0/24 --gateway 192.168.2.254 --ip-range 192.168.2.252/27 mynet
-Then, run the container with the network settings:
docker run --net=mynet -d -p 127.0.0.1:8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:-latest
+Then, run the container with the network settings:
docker run --net=mynet -d -p 127.0.0.1:8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/trilium:-latest
To set a different user ID (UID) and group ID (GID) for the saved data,
- use the USER_UID
and USER_GID
environment variables:
docker run --net=mynet -d -p 127.0.0.1:8080:8080 -e "USER_UID=1001" -e "USER_GID=1001" -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:-latest
+ use the USER_UID
and USER_GID
environment variables:docker run --net=mynet -d -p 127.0.0.1:8080:8080 -e "USER_UID=1001" -e "USER_GID=1001" -v ~/trilium-data:/home/node/trilium-data triliumnext/trilium:-latest
Find the local IP address using docker inspect [container_name]
and
access the service from devices on the local network.
docker ps
docker inspect [container_name]
Global Access
-To allow access from any IP address, run the container as follows:
docker run -d -p 0.0.0.0:8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:[VERSION]
+To allow access from any IP address, run the container as follows:
docker run -d -p 0.0.0.0:8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/trilium:[VERSION]
Stop the container with docker stop <CONTAINER ID>
,
where the container ID is obtained from docker ps
.
Custom Data Directory
-For a custom data directory, use:
-v ~/YourOwnDirectory:/home/node/trilium-data triliumnext/notes:[VERSION]
+For a custom data directory, use:
-v ~/YourOwnDirectory:/home/node/trilium-data triliumnext/trilium:[VERSION]
If you want to run your instance in a non-default way, please use the
- volume switch as follows: -v ~/YourOwnDirectory:/home/node/trilium-data triliumnext/notes:<VERSION>
.
+ volume switch as follows: -v ~/YourOwnDirectory:/home/node/trilium-data triliumnext/trilium:<VERSION>
.
It is important to be aware of how Docker works for volumes, with the first
path being your own and the second the one to virtually bind to. https://docs.docker.com/storage/volumes/ The
path before the colon is the host directory, and the path after the colon
@@ -89,10 +89,10 @@ docker inspect [container_name]
If you're unsure, stick to the “rootful” Docker image referenced above.
Below are some commands to pull the rootless images:
# For Debian-based image
-docker pull triliumnext/notes:rootless
+docker pull triliumnext/trilium:rootless
# For Alpine-based image
-docker pull triliumnext/notes:rootless-alpine
+docker pull triliumnext/trilium:rootless-alpine
Running containers as non-root is a security best practice that reduces the potential impact of container breakouts. If an attacker manages to @@ -117,13 +117,13 @@ TRILIUM_UID=$(id -u) TRILIUM_GID=$(id -g) docker-compose -f docker-compose.rootl TRILIUM_DATA_DIR=/path/to/your/data TRILIUM_UID=$(id -u) TRILIUM_GID=$(id -g) docker-compose -f docker-compose.rootless.yml up -d
# Build the image
-docker build -t triliumnext/notes:rootless -f apps/server/Dockerfile.rootless .
+docker build -t triliumnext/trilium:rootless -f apps/server/Dockerfile.rootless .
# Run with default UID/GID (1000:1000)
-docker run -d --name trilium -p 8080:8080 -v ~/trilium-data:/home/trilium/trilium-data triliumnext/notes:rootless
+docker run -d --name trilium -p 8080:8080 -v ~/trilium-data:/home/trilium/trilium-data triliumnext/trilium:rootless
# Run with custom UID/GID
-docker run -d --name trilium -p 8080:8080 --user $(id -u):$(id -g) -v ~/trilium-data:/home/trilium/trilium-data triliumnext/notes:rootless
+docker run -d --name trilium -p 8080:8080 --user $(id -u):$(id -g) -v ~/trilium-data:/home/trilium/trilium-data triliumnext/trilium:rootless
If you would prefer, you can also customize the UID/GID at build time:
# For Debian-based image with custom UID/GID
docker build --build-arg USER=myuser --build-arg UID=1001 --build-arg GID=1001 \
- -t triliumnext/notes:rootless-custom -f apps/server/Dockerfile.rootless .
+ -t triliumnext/trilium:rootless-custom -f apps/server/Dockerfile.rootless .
# For Alpine-based image with custom UID/GID
docker build --build-arg USER=myuser --build-arg UID=1001 --build-arg GID=1001 \
- -t triliumnext/notes:alpine-rootless-custom -f apps/server/Dockerfile.alpine.rootless .
+ -t triliumnext/trilium:alpine-rootless-custom -f apps/server/Dockerfile.alpine.rootless .
Available build arguments:
In order to setup OpenID, you will need to setup a authentication provider. This requires a bit of extra setup. Follow these instructions to - setup an OpenID service through google.
+ setup an OpenID service through google. The Redirect URL of Trilium ishttps://<your-trilium-domain>/callback
.
oauthBaseUrl
, oauthClientId
and oauthClientSecret
in
+ oauthBaseUrl
, oauthClientId
and oauthClientSecret
in
the config.ini
file (check Configuration (config.ini or environment variables) for
more information).
TRILIUM_OAUTH_BASE_URL
, TRILIUM_OAUTH_CLIENT_ID
and TRILIUM_OAUTH_CLIENT_SECRET
).TRILIUM_OAUTH_BASE_URL
, TRILIUM_OAUTH_CLIENT_ID
and TRILIUM_OAUTH_CLIENT_SECRET
).oauthBaseUrl
should be the link of your Trilium instance server,
+ for example, https://<your-trilium-domain>
.If you don’t already have a running Authentik instance, please follow + these instructionsto set one up.
+https://<your-trilium-domain>/callback
.oauthIssuerBaseUrl
→ Use the OpenID Configuration Issuer
URL
+ from your application's overview page.oauthIssuerName
and oauthIssuerIcon
→ Set these
+ to customize the name and icon displayed on the login page. If omitted,
+ Google’s name and icon will be shown by default.