diff --git a/Wiki/anonymized-database.md b/Wiki/anonymized-database.md index 54f79d5..9667d56 100644 --- a/Wiki/anonymized-database.md +++ b/Wiki/anonymized-database.md @@ -1,20 +1,17 @@ -# Anonymized database -### Anonymized database +# Anonymized Database -In some cases, it's necessary to see the database structure to be able to debug the problem. Of course, we can't ask you to send us [Document](document.md) file with your notes. +![screenshot of advanced settings](images/anonymization.png) -For this, Trilium supports anonymization of the database - you can trigger this in Options -> Advanced tab. +In certain scenarios, understanding the structure of a database is crucial for troubleshooting issues. However, sharing your actual [database](database.md) file with personal notes is not advisable. To address this, Trilium offers a feature to anonymize the database. This feature can be accessed via Menu -> Options -> Advanced tab. -![](images/anonymization.png) +This feature creates a copy of your database with all sensitive data removed. Specifically, it strips out note titles, contents, revisions, history, and some non-system attributes while retaining the overall structure and metadata, such as modification dates. After anonymization, the database undergoes a [vacuuming process](https://sqlite.org/lang_vacuum.html) to ensure no sensitive data remnants remain in the file. The anonymized database is saved in the `anonymized` directory within the [data directory](data-directory.md), making it safe to share with bug reports. -This will create a copy of your document and remove all sensitive data (currently note titles, contents, revisions, history and some of the options, and non-system attributes) while leaving all structure and metadata (e.g. date of last change). After this is done, the database is [VACUUMed](https://sqlite.org/lang_vacuum.html) to make sure there's no stale sensitive data in the document file. The resulting file is stored in `anonymized` directory (placed in the [data directory](data-directory.md)). You can safely attach it with your bug report or send it to [zadam.apps@gmail.com](#root/N3Zt66yETj9g) %%{WARNING}%% +## Command Line Anonymization -#### Command line anonymization +If your [database](database.md) is corrupted to the point where Trilium cannot start, the anonymization process can still be executed via the command line: -If the database is corrupted in a way which prevents Trilium to start up, you won't be able to trigger the anonymization from the UI. For such a case, anonymization is also available from command line: - -```text-plain +```sh node src/anonymize.js ``` -This needs to be executed in the directory with Trilium source files, for desktop builds this in `resources/app` directory. +Run this command from the directory containing Trilium's source files, typically found in the `resources/app` directory for desktop builds. diff --git a/Wiki/attachments.md b/Wiki/attachments.md index 86440f6..8a8b011 100644 --- a/Wiki/attachments.md +++ b/Wiki/attachments.md @@ -1,8 +1,9 @@ -# Attachments -A note can _own_ one or more attachments. The attachment is either an image or file which can be displayed/linked in the note which owns it. +# Attachments -The note is the exclusive owner of its attachments - they can't be linked from other notes. If a user copies the attachment link from one note to another, the attachment itself is copied and from then on lives an independent life. +A [note](note.md) in Trilium can _own_ one or more attachments, which can be either images or files. These attachments can be displayed or linked within the note that owns them. -Attachments is a feature available in Trilium since v0.61. Attachment is now a preferred way to include images into notes. Previously, an image had to be an independent note which could be then displayed in multiple notes, but this approach proved to be complicated. Image as notes still remains as an option, and is a more suitable choice in some cases (e.g. when the particular image is sort of standalone). It is possible to convert an image to an attachment and vice versa. +This can be especially useful to include dependencies for your [scripts](scripts.md). The [Weight Tracker](weight-tracker.md) shows how to use [chartjs](https://chartjs.org/) which is attached to the [script note](script-note.md). -Image attachments are expected to be linked in the owning text note. If it's not linked, it will get deleted in a configurable timeout. +Each note exclusively owns its attachments, meaning attachments cannot be shared or linked from one note to another. If an attachment link is copied to a different note, the attachment itself is duplicated, and the copies are managed independently thereafter. + +Attachments, especially image files, are the recommended method for embedding visuals in notes. It is important to link image attachments within the text of the owning note; otherwise, they will be automatically deleted after a configurable timeout period if not referenced. diff --git a/Wiki/attribute-inheritance.md b/Wiki/attribute-inheritance.md index 05f25a5..c34c01c 100644 --- a/Wiki/attribute-inheritance.md +++ b/Wiki/attribute-inheritance.md @@ -1,21 +1,26 @@ -# Attribute inheritance -Standard inheritance --------------------- +# Attribute Inheritance in Trilium -Every [attribute](attributes.md) has flag called `isInheritable`. If this is true, then this attribute (key-value) is also applied to all its children notes, children's children notes etc. +## 1. Standard Inheritance -Example how this might be useful is `archived` label which hides its note from Jump to / Add link dialogs. Often times you want to archive some specific subtree, you can do this by making the `archived` label inheritable. +In Trilium, attributes can be automatically inherited by child notes if they have the `isInheritable` flag set to `true`. This means the attribute (a key-value pair) is applied to the note and all its descendants. -Copying inheritance -------------------- +### Example Use Case -A different kind of inheritance is achieved using `child:` attribute name prefix. We can define that when a note is created under a certain parent note then the new child note will automatically receive defined attributes. The difference from standard inheritance is that these are real new attributes which are completely independent of the parent and will be therefore kept even if the note is moved elsewhere in the note tree. +The `archived` label can be set to be inheritable, allowing you to hide a whole subtree of notes from searches and other dialogs by applying this label at the top level. -For defining the copy-attributes we use `child:` prefix in attribute name, the rest is defined normally. So as an example, when we create a child note in a note with `#child:exampleAttribute` label, then the child note will have `#exampleAttribute` label. This can be even chained, e.g. `#child:child:exampleAttribute`, in this case `#child:exampleAttribute` will be created in the child and `#exampleAttribute` will be created in the child of the child. +## 2. Copying Inheritance -Which kind of attribute inheritance (or if any at all) should be used depends on the specific use case. +Copying inheritance differs from standard inheritance by using a `child:` prefix in the attribute name. This prefix causes new child notes to automatically receive specific attributes from the parent note. These attributes are independent of the parent and will persist even if the note is moved elsewhere. -Template inheritance --------------------- +### How to Use -[Attribute template](template.md) could be also seen as a form of inheritance. +- **Syntax:** `#child:attributeName` +- **Chained Inheritance:** You can chain this inheritance, such as `#child:child:attributeName`, where each child down the hierarchy receives the appropriate attribute. + +### Example + +If a parent note has the label `#child:exampleAttribute`, all newly created child notes will inherit the `#exampleAttribute` label. This can be useful for setting default properties for notes in a specific section. + +## 3. Template Inheritance + +Attributes can also be inherited from [templates](template.md). When a new note is created using a template, it inherits the attributes defined in that template. This is particularly useful for maintaining consistency across notes that follow a similar structure or function. diff --git a/Wiki/attributes.md b/Wiki/attributes.md index 7e7b3cb..edad597 100644 --- a/Wiki/attributes.md +++ b/Wiki/attributes.md @@ -1,114 +1,82 @@ -# Attributes -Note attributes are key-value records owned by (assigned to) given note. - -There are 2 types of attributes: - -* Labels - simple key-value text record -* Relation - specifies named relation (link) to another note - -Sometimes we're talking about labels and relations - keep in mind that both of them are types of attributes. - -![](images/attributes.png) - -Labels ------- - -Labels can be used for several things: - -* as labels with optional value - e.g. when cataloguing books, you might add labels like #year=1999, #genre="sci-fi", #author="Neal Stephenson" -* attributes can be used to configure some advanced features / settings - see below -* plugins / scripts can use these to mark notes with some special values / metadata (e.g. [Weight Tracker](weight-tracker.md) will have "weight" attribute on [day notes](day-notes.md) based on whose it can create chart). - -Labels can be used for [searching](search.md). - -### Standard labels - -The following labels are used for advanced configuration: - -* `disableVersioning` - disables auto-versioning. Useful for e.g. large, but unimportant notes - e.g. large JS libraries used for scripting -* `calendarRoot` - marks note which should be used as root for [day notes](day-notes.md). Only one should be marked as such. -* `archived` - notes with this label won't be visible by default in search results (also in Jump To, Add Link dialogs etc). -* `excludeFromExport` - notes (with their sub-tree) won't be included in any note export. -* `run` - defines on which events script should run. Possible values are: - * `frontendStartup` - when Trilium frontend starts up (or is refreshed). - * `backendStartup` - when Trilium backend starts up. - * `hourly` - run once an hour. You can use additional label `runAtHour` to specify at which hour. - * `daily` - run once a day. -* `runAtHour` - On which hour should this run. Should be used together with `#run=hourly`. Can be defined multiple times for more runs during the day. -* `runOnInstance` - define which trilium instance this should run on. Defaults to all instances. -* `disableInclusion` - scripts with this label won't be included into parent script execution. -* `sorted` - keeps child notes sorted (by title, alphabetically. See [Sorting](sorting.md)). -* `top` - keeps this note at the top of the list within its parent (applies only on parents with `sorted` attribute). -* `hidePromotedAttributes` - hide promoted attributes on this note. -* `readOnly` - editor is in read only mode. Works only for text and code notes. See some use cases [here](https://github.com/TriliumNext/Notes/issues/371). -* `autoReadOnlyDisabled` - text/code notes can be set automatically into read mode when they are too large. You can disable this behavior on per-note basis by adding this label to the note -* `appCss` - marks CSS notes which are loaded into the Trilium application and can thus be used to modify Trilium's looks. -* `appTheme` - marks CSS notes which are full Trilium themes and are thus available in Trilium options. -* `cssClass` - the value of this label is then added as CSS class to the node representing the given note in the tree. This can be useful for advanced [themes](themes.md). Can be used in `template` notes. -* `iconClass` - the value of this label is added as a CSS class to the icon on the tree, which can help visually distinguish the notes in the tree. An example might be `bx bx-home` - icons are taken from [boxicons](https://boxicons.com/). Can be used in [template](template.md) notes. -* `pageSize`\- number of items per page in note listing. -* `customRequestHandler` and `customResourceProvider` - see [Custom request handler](custom-request-handler.md) -* `widget` - marks this note as a custom widget, which will be added to the Trilium component tree. See [Custom widget](custom-widget.md). -* `workspace`, `workspaceIconClass`, `workspaceTabBackgroundColor`, `workspaceCalendarRoot` - see [Workspace](workspace.md) -* `searchHome` - new search notes will be created as children of this note (otherwise they are created in [Day notes](day-notes.md)) -* `hoistedSearchHome` - new search notes will be created as children of this note when hoisted to some ancestor of this note -* `inbox` - default inbox location for new notes - when you create a note using "new note" button in the sidebar, notes will be created as child notes in the note marked as with `#inbox` label. -* `hoistedInbox` - default inbox location for new notes when hoisted to some ancestor of this note -* `sqlConsoleHome` - default location of SQL console notes -* `bookmarked` and `bookmarkFolder` - see [Bookmarks](bookmarks.md) -* `shareXXX` labels - see [Sharing](sharing.md) -* `keyboardShortcut` - can be defined as e.g. "Ctrl+I". Pressing this keyboard combination will then bring you to the note on which it is defined. Note that Trilium must be reloaded/restarted (Ctrl+R) for changes to be in effect. -* `displayRelations` and `hideRelations` - comma delimited names of relations which should be displayed/hidden. All other relations will be hidden/visible. -* `hideRelations` - comma delimited names of relations which should be hidden. -* `titleTemplate` - see [Default note title](default-note-title.md). -* `template` - this note will appear in the selection of available templates when creating new notes. -* `toc` - `#toc` or `#toc=show` will force the table of contents to be shown, `#toc=hide` will force hiding it. -* `color` - defines the color of the note in links, tree etc. Use any valid CSS value like `red` or `#f0a349` -* `hideChildrenOverview` - Hides child notes from being displayed in the editor of the parent note -* `viewType` - Allows setting the view of the child notes inside the editor to a grid or list. Possible values: - * `grid` - displays child notes in a grid - * `list` - displays child notes in a list - -Relations ---------- - -Relation is a kind of link between two notes. - -This could be used when you e.g. keep a book database, you can use relations to keep formal links between the book (note) and the book's author (note) by defining an "author" relation on the book note pointing to the author's note. - -Relations are used also for some advanced scripting - like attaching scripts to events happening on certain note. - -### Standard relations - -[Events](events.md): - -* `runOnNoteCreation` - executes when note is created on backend. Use this relation if you want to run the script for all notes created under a specific subtree. In that case, create it on the subtree root note and make it inheritable. A new note created within the subtree (any depth) will trigger the script. -* `runOnChildNoteCreation` - executes when new note is created under the note where this relation is defined -* `runOnNoteTitleChange` - executes when note title is changed (includes note creation as well) -* `runOnNoteChange` - executes when note is changed (includes note creation as well) -* `runOnNoteDeletion` - executes when note is being deleted. -* `runOnBranchCreation` and `runOnBranchDeletion` - executes when a branch is created/deleted. Branches are links between a parent and a child note, and are created when e.g. cloning or moving notes. -* `runOnAttributeCreation` - executes when new attribute is created for the note which defines this relation -* `runOnAttributeChange` - executes when the attribute is changed of a note which defines this relation. This is triggered also when the attribute is deleted - -Other relations: - -* `template` - attached note's attributes will be inherited even without parent-child relationship. See [template](template.md) for details. -* `renderNote` - notes of type "render HTML note" will be rendered using a code note (HTML or script) and it is necessary to point using this relation to which note should be rendered -* `widget` - target of this relation will be executed and rendered as a widget in the sidebar -* `shareXXX` relations described in [Sharing](sharing.md) - -Multiplicity ------------- - -Attributes allow multiplicity - there can be multiple attributes with the same name. We're then calling such attributes "multivalued". - -Attribute definitions / promoted attributes -------------------------------------------- - -Special kind of labels are used to create "label/attribute" definitions. See [Promoted attributes](promoted-attributes.md) for details. - -Attribute inheritance ---------------------- - -See [Attribute inheritance](attribute-inheritance.md). +# Attributes in Trilium + +In Trilium, attributes are key-value pairs assigned to notes, providing additional metadata or functionality. There are two primary types of attributes: + +1. **Labels**: Simple key-value text records +2. **Relations**: Named links to other notes + +These attributes play a crucial role in organizing, categorizing, and enhancing the functionality of notes. + +![Screenshot of 'task template' attributes](images/attributes.png) + +## Labels + +Labels in Trilium can be used for a variety of purposes: + +- **Metadata**: Assign labels with optional values for categorization, such as `#year=1999`, `#genre="sci-fi"`, or `#author="Neal Stephenson"` +- **Configuration**: Labels can configure advanced features or settings +- **Scripts and Plugins**: Used to tag notes with special metadata, such as the "weight" attribute in the [Weight Tracker](weight-tracker.md) + +Labels are also searchable, enhancing note retrieval. + +### Common Labels for Advanced Configuration + +- **`disableVersioning`**: Disables automatic versioning, ideal for large, unimportant notes like script libraries +- **`calendarRoot`**: Marks the note as the root for [day notes](day-notes.md). Only one note should carry this label +- **`archived`**: Hides notes from default search results and dialogs +- **`excludeFromExport`**: Excludes notes and their subtrees from export operations +- **`run`**: Specifies events to trigger scripts (e.g., `frontendStartup`, `hourly`) +- **`runAtHour`**: Defines specific hours for scripts to run, used with `#run=hourly` +- **`disableInclusion`**: Prevents a script from being included in parent script executions +- **`sorted`**: Automatically sorts child notes alphabetically by title +- **`top`**: Keeps the note at the top of its parent's list, useful with `sorted` +- **`hidePromotedAttributes`**: Hides certain attributes in the note's display +- **`readOnly`**: Sets the note to read-only mode, applicable to text and code notes +- **`autoReadOnlyDisabled`**: Disables automatic read-only mode for large notes +- **`appCss`**: Marks CSS notes used to modify Trilium’s appearance +- **`appTheme`**: Marks full CSS themes available in Trilium's options +- **`cssClass`**: Adds a CSS class to the note's representation in the tree +- **`iconClass`**: Adds a CSS class to the note's icon, useful for distinguishing notes visually +- **`pageSize`**: Specifies the number of items per page in note listings +- **`customRequestHandler` and `customResourceProvider`**: Refer to [Custom request handler](custom-request-handler.md) +- **`widget`**: Marks a note as a custom widget, added to Trilium's component tree +- **`workspace` and related attributes**: See [Workspace](workspace.md) for more details +- **`searchHome`**: Specifies the parent for new search notes +- **`inbox`**: Designates a default location for new notes created via the sidebar +- **`sqlConsoleHome`**: Default location for SQL console notes +- **`bookmarked` and `bookmarkFolder`**: See [Bookmarks](bookmarks.md) +- **`shareXXX`**: See [Sharing](sharing.md) +- **`keyboardShortcut`**: Assigns a keyboard shortcut to open the note +- **`displayRelations` and `hideRelations`**: Manages the display of note relations +- **`titleTemplate`**: See [Default note title](default-note-title.md) +- **`template`**: Makes the note available as a template +- **`toc`**: Controls the visibility of the table of contents +- **`color`**: Defines the color of the note in the tree and links +- **`hideChildrenOverview`**: Hides child notes in the parent note's editor +- **`viewType`**: Sets the view of child notes (grid or list) + +## Relations + +Relations define connections between notes, similar to links. + +### Uses + +- **Metadata Relationships**: For example, linking a book note to an author note +- **Scripting**: Attaching scripts to events or conditions related to the note + +### Common Relations + +- **Event-based Relations**: Such as `runOnNoteCreation` or `runOnNoteChange`, which trigger scripts on specific actions +- **Other Relations**: Include `template`, `renderNote`, `widget`, and sharing-related relations + +## Multiplicity + +Attributes in Trilium can be "multivalued", meaning multiple attributes with the same name can coexist. + +## Attribute Definitions and Promoted Attributes + +Special labels create "label/attribute" definitions, enhancing the organization and management of attributes. For more details, see [Promoted attributes](promoted-attributes.md). + +## Attribute Inheritance + +Trilium supports attribute inheritance, allowing child notes to inherit attributes from their parents. For more information, see [Attribute inheritance](attribute-inheritance.md). diff --git a/Wiki/book-note.md b/Wiki/book-note.md index 3f37a0f..9d29d28 100644 --- a/Wiki/book-note.md +++ b/Wiki/book-note.md @@ -1,10 +1,21 @@ -# Book note -Book [note](note.md) is a type of note which displays all its children's content in a linear fashion, so you can read note subtree like a book. This can be useful for reading many smaller notes. Seeing an example might explain this concept better: +# Book Notes in Trilium -![](images/book-note.png) +A **Book Note** in Trilium is a special type of [note](note.md) designed to display the contents of its child notes sequentially, creating a linear, book-like reading experience. This format is particularly useful for viewing multiple smaller notes in a cohesive, continuous manner. -Notice in the tree on the left pane how "node.js" note has some children and these are then displayed on the right pane. +![Book Note Example](images/book-note.png) -You can also switch to "grid view" in the Book properties: +In the example above, the "node.js" note on the left panel contains several child notes. The right panel displays the content of these child notes as a single continuous document. -![](images/book-note-pictures.png) +## Features + +### Linear Display + +The Book Note format compiles the contents of all child notes into one continuous view. This makes it ideal for reading extensive information broken into smaller, manageable segments. + +### Grid View Option + +Trilium also offers a "Grid View" option within the Book Note properties. This view presents the child notes in a grid format, allowing for a more visual navigation experience. + +![Grid View Example](images/book-note-pictures.png) + +Switching between these views can be easily managed through the Book Note's settings (or `viewType` attribu), allowing users to choose the format that best suits their reading or navigation preferences. diff --git a/Wiki/desktop-installation.md b/Wiki/desktop-installation.md index e6c86c8..be989dd 100644 --- a/Wiki/desktop-installation.md +++ b/Wiki/desktop-installation.md @@ -1,17 +1,22 @@ -# Desktop-installation -If you want to use Trilium on the desktop, download binary release for your platform from [latest release](https://github.com/TriliumNext/Notes/releases/latest), unzip the package and run `trilium` executable. +# Desktop Installation Guide for Trilium -Startup scripts ---------------- +To install Trilium on your desktop, follow these steps: -There are also some other options to start Trilium: +1. **Download the Latest Release**: Obtain the appropriate binary release for your operating system from the [latest release page](https://github.com/TriliumNext/Notes/releases/latest) on GitHub. +2. **Extract the Package**: Unzip the downloaded package to a location of your choice. +3. **Run the Application**: Launch Trilium by executing the `trilium` executable found within the unzipped folder. -* `trilium-no-cert-check` - Trilium will not validate the certificates, useful e.g. when you're syncing against a sync server with self-signed certificate - * Alternatively you can set `NODE_TLS_REJECT_UNAUTHORIZED=0` environment variable to the Trilium process. -* `trilium-portable` - Trilium will try to create [data directory](data-directory.md) in the trilium's directory -* `trilium-safe-mode` - start up in "safe mode" which disables any startup scripts which might e.g. crash the application +## Startup Scripts -Synchronization ---------------- +Trilium offers various startup scripts to customize your experience: -If you are using a desktop instance and would like to sync with your server instance: [Synchronization](synchronization.md) +- **`trilium-no-cert-check`**: Starts Trilium without validating [TLS certificates](tls-configuration.md), useful if connecting to a server with a self-signed certificate. + - Alternatively, set the `NODE_TLS_REJECT_UNAUTHORIZED=0` environment variable before starting Trilium. + +- **`trilium-portable`**: Launches Trilium in portable mode, where the [data directory](data-directory.md) is created within the application's directory, making it easy to move the entire setup. + +- **`trilium-safe-mode`**: Boots Trilium in "safe mode," disabling any startup scripts that might cause the application to crash. + +## Synchronization + +For Trilium desktp users who wish to synchronize their data with a server instance, refer to the [Synchronization Guide](synchronization.md) for detailed instructions. diff --git a/Wiki/docker-server-installation.md b/Wiki/docker-server-installation.md index a5729b1..905d4fd 100644 --- a/Wiki/docker-server-installation.md +++ b/Wiki/docker-server-installation.md @@ -1,93 +1,103 @@ -# Docker-server-installation -Trilium can be run as docker image. This is recommended way to deploy Trilium on servers. +# Docker Server Installation for Trilium -Official docker images are published on docker hub for **AMD64**, **ARMv6**, **ARMv7** and **ARMv8/64**: [https://hub.docker.com/r/zadam/trilium/](https://hub.docker.com/r/zadam/trilium/)%%{WARNING}%% +Trilium can be deployed using a Docker image, which is the recommended method for server installations. Official Docker images for **AMD64**, **ARMv6**, **ARMv7**, and **ARMv8/64** are available on [Docker Hub](https://hub.docker.com/r/zadam/trilium/). %%%{WARNING}%%% zadams dockerhub -Prerequisites -------------- +## Prerequisites -To start, you will need to have docker installed on your computer. Here are two guides that can help: +Ensure Docker is installed on your system. -* [https://docs.docker.com/engine/install/ubuntu/](https://docs.docker.com/engine/install/ubuntu/) -* [https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04) +If you need help installing Docker, reference the [Docker Installation Docs](https://docs.docker.com/engine/install/) -Trilium docker container requires running as root, check if this is possible in your environment. +**Note:** Trilium's Docker container requires root privileges to operate correctly. -Pull image ----------- +## Pulling the Docker Image -```text-plain -docker pull zadam/trilium:[VERSION] %%{WARNING}%% -``` +To pull the Trilium image, use the following command, replacing `[VERSION]` with the desired version or tag, such as `0.90-latest` or just `latest`: + +%%%{WARNING}%%% zadams container -Replace \[VERSION\] for actual latest version or use "series" tag - e.g. `0.52-latest`. +```sh +docker pull zadam/trilium:[VERSION] +``` -**It's not recommended to use "latest" tag since it may upgrade your Trilium instance to a new minor version, which may potentially break your sync setup or cause other issues.** +**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. -Prepare data directory on the host system ------------------------------------------ +## Preparing the Data Directory -Trilium needs a directory where it can store its data, this then needs to be mounted into the docker container. The container needs to runs as a root to be able to access it in write mode. +Trilium requires a directory on the host system to store its data. This directory must be mounted into the Docker container with write permissions. -Run image ---------- +## Running the Docker Container -These commands mount the volume to the host system so that trilium's data (most importantly [database](database.md)) is persisted and not cleared after container stops. +### Local Access Only -### Local 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. -This will run the container so that it only available on the localhost. Use this to test the installation from a web browser on the same machine you run this command on, or if you are using a proxy with nginx/apache. +%%%{WARNING}%%% zadams container -```text-plain -sudo docker run -t -i -p 127.0.0.1:8080:8080 -v ~/trilium-data:/home/node/trilium-data zadam/trilium:[VERSION] %%{WARNING}%% +```sh +sudo docker run -t -i -p 127.0.0.1:8080:8080 -v ~/trilium-data:/home/node/trilium-data zadam/trilium:[VERSION] ``` -1. Test to see that the docker image is running with `docker ps` -2. Access the trilium by opening a browser and go to `127.0.0.1:8080` +1. Verify the container is running using `docker ps`. +2. Access Trilium via a web browser at `127.0.0.1:8080`. -### Local network only +### Local Network Access -This command will run the container so that it is only available on your local network. This is preferable if you do not want to open ports to the rest of the internet. However, you can still access it from outside by using a VPN like WireGuard to get into your own network first. This method does assume that your local network limits outside access. +To make the container accessible only on your local network, first create a new Docker network: -First, you have to create a new network in Docker to access your local network. Here is an example, give note to "parent" and the network numbers as it may differ from your own. For more detailed information, [click here](https://blog.oddbit.com/post/2018-03-12-using-docker-macvlan-networks/). +%%%{WARNING}%%% zadams container -```text-plain +```sh 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 ``` -Secondly, you have to adjust the docker run command so it takes this network into account but keep using localhost to limit the accessibility of the ports to the outside world. +Then, run the container with the network settings: -```text-plain +%%%{WARNING}%%% zadams container + +```sh docker run --net=mynet -d -p 127.0.0.1:8080:8080 -v ~/trilium-data:/home/node/trilium-data zadam/trilium:0.52-latest ``` -Alternatively, if you wish to have the saved data and the application using a different UID & GID than 1000:1000, you can use the USER\_UID & USER\_GID environment variables: +To set a different user ID (UID) and group ID (GID) for the saved data, use the `USER_UID` and `USER_GID` environment variables: + +%%%{WARNING}%%% zadams container -```text-plain -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 zadam/trilium:0.52-latest %%{WARNING}%% +```sh +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 zadam/trilium:0.52-latest ``` -Finally, use docker inspect to find your local IP address to connect to. You can access this from all your devices connected to the local network as such: \[local:ip\]:8080. +Find the local IP address using `docker inspect [container_name]` and access the service from devices on the local network. -```text-plain -docker ps -docker inspect [container_name] -``` +#### Reverse Proxy -### Available anywhere +1. [Nginx](nginx-proxy-setup.md) +2. [Apache](apache-proxy-setup.md) -This will run the container as a background process and will be available from any IP address +### Global Access -```text-plain -docker run -d -p 0.0.0.0:8080:8080 -v ~/trilium-data:/home/node/trilium-data zadam/trilium:[VERSION] %%{WARNING}%% +To allow access from any IP address, run the container as follows: + +%%%{WARNING}%%% zadams container + +```sh +docker run -d -p 0.0.0.0:8080:8080 -v ~/trilium-data:/home/node/trilium-data zadam/trilium:[VERSION] ``` -To stop this background docker process use `docker ps` to get the "CONTAINER ID" and then use `docker stop ` +Stop the container with `docker stop `, where the container ID is obtained from `docker ps`. + +### Custom Data Directory -### Different data directory location +For a custom data directory, use: + +%%%{WARNING}%%% zadams container + +```sh +-v ~/YourOwnDirectory:/home/node/trilium-data zadam/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 zadam/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/](https://docs.docker.com/storage/volumes/) +The path before the colon is the host directory, and the path after the colon is the container's path. More details can be found in the [Docker Volumes Documentation](https://docs.docker.com/storage/volumes/). -### Note about --user directive +### Note on --user Directive -Please note, the --user directive is not supported and the container will not run without root. Instead please use the USER\_UID & USER\_GID environment variables as shown above. +The `--user` directive is unsupported. Instead, use the `USER_UID` and `USER_GID` environment variables to set the appropriate user and group IDs.