Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
docs(user): how to set data dir on Windows (closes #4853)
Elian Doranab298cbb3b10
diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Data directory.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Data directory.htmlindex b5a4868488..ad81d00c19 100644--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Data directory.html+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Data directory.html@@ -1,12 +1,12 @@<p>Data directory contains:</p><ul>- <li><code>document.db</code> - <a href="#root/_help_wX4HbRucYSDD">database</a>+ <li data-list-item-id="e02c8e6918e645272972d94bf51bd34e1"><code>document.db</code> - <a href="#root/_help_wX4HbRucYSDD">database</a></li>- <li><code>config.ini</code> - instance level settings like port on which the+ <li data-list-item-id="ee3b386f752a4d2de88a1362ff4bc447a"><code>config.ini</code> - instance level settings like port on which theTrilium application runs</li>- <li><code>backup</code> - contains automatically <a href="#root/_help_ODY7qQn5m2FT">backup</a> of+ <li data-list-item-id="e9acb98fe27a493914c7f61574b277d59"><code>backup</code> - contains automatically <a href="#root/_help_ODY7qQn5m2FT">backup</a> ofdocuments</li>- <li><code>log</code> - contains application log files</li>+ <li data-list-item-id="e9f5de6d3c7f8d79710eb8c8e2ccac979"><code>log</code> - contains application log files</li></ul><h2>Location of the data directory</h2><p>Easy way how to find out which data directory Trilium uses is to look@@ -18,30 +18,42 @@<p>Data directory is normally named <code>trilium-data</code> and it is storedin:</p><ul>- <li><code>/home/[user]/.local/share</code> for Linux</li>- <li><code>C:\Users\[user]\AppData\Roaming</code> for Windows Vista and up</li>- <li><code>/Users/[user]/Library/Application Support</code> for Mac OS</li>- <li>user's home is a fallback if some of the paths above don't exist</li>- <li>user's home is also a default setup for [[docker|Docker server installation]]</li>+ <li data-list-item-id="e52706d339ce2332e73c5cfdc51edf81d"><code>/home/[user]/.local/share</code> for Linux</li>+ <li data-list-item-id="e5709c767479c028d2ef60d17124ea924"><code>C:\Users\[user]\AppData\Roaming</code> for Windows Vista and up</li>+ <li+ data-list-item-id="eae590672aea8b24e625f372fb22d1f1b"><code>/Users/[user]/Library/Application Support</code> for Mac OS</li>+ <li+ data-list-item-id="e150ab7fc3c436d7cbac192acf3fe433f">user's home is a fallback if some of the paths above don't exist</li>+ <li+ data-list-item-id="e5f476ac39d8fa453e19b8399073a79d7">user's home is also a default setup for [[docker|Docker server installation]]</li></ul><p>If you want to back up your Trilium data, just backup this single directory- it contains everything you need.</p><h3>Changing the location of data directory</h3><p>If you want to use some other location for the data directory than the- default one, you may change it via TRILIUM_DATA_DIR environment variable- to some other location:</p>+ default one, you may change it via <code>TRILIUM_DATA_DIR</code> environment+ variable to some other location:</p>+<h3>Windows</h3>+<ol>+ <li data-list-item-id="e8597645795a4e5b079b8e2e4a772a7d7">Press the Windows key on your keyboard.</li>+ <li data-list-item-id="ee32856df1db7c2d206baa480a672eeac">Search and select “Edit the system variables”.</li>+ <li data-list-item-id="e08c7cdc0659b414465a07c78dfdaeb34">Press the “Environment Variables…” button in the bottom-right of the newly+ opened screen.</li>+ <li data-list-item-id="e6c7bae2590161a2661b6229c0853021c">On the top section ("User variables for [user]"), press the “New…” button.</li>+ <li+ data-list-item-id="effac7dc3976f17d309958dd3374cfa8d">In the <em>Variable name</em> field insert <code>TRILIUM_DATA_DIR</code>.</li>+ <li+ data-list-item-id="e3b74fdd03536563bb461e11111fae5ff">Press the <em>Browse Directory…</em> button and select the new directory+ where to store the database.</li>+ <li data-list-item-id="ed6df567f0fa772a14610b3904a0cb635">Close all the windows by pressing the <em>OK</em> button for each of them.</li>+</ol><h4>Linux</h4><pre><code class="language-text-x-trilium-auto">export TRILIUM_DATA_DIR=/home/myuser/data/my-trilium-data</code></pre><h4>Mac OS X</h4><p>You need to create a <code>.plist</code> file under <code>~/Library/LaunchAgents</code> toload it properly each login.</p><p>To load it manually, you need to use <code>launchctl setenv TRILIUM_DATA_DIR <yourpath></code></p>-<p>Here is a pre-defined template, where you just need to add your path to:</p><pre><code class="language-text-x-trilium-auto">----- Label+<p>Here is a pre-defined template, where you just need to add your path to:</p><pre><code class="language-text-x-trilium-auto"> Labelset.trilium.envRunAtLoad@@ -50,76 +62,75 @@launchctlsetenvTRILIUM_DATA_DIR- /Users/YourUserName/Library/Application Support/trilium-data---</code></pre>+ /Users/YourUserName/Library/Application Support/trilium-data </code></pre><h3>Create a script to run with specific data directory</h3><p>An alternative to globally setting environment variable is to run onlythe Trilium Notes with this environment variable. This then allows fordifferent setup styles like two <a href="#root/_help_wX4HbRucYSDD">database</a> instancesor "portable" installation.</p>-<p>To do this in unix based systems simply run trilium like this:</p><pre><code class="language-text-x-trilium-auto">TRILIUM_DATA_DIR=/home/myuser/data/my-trilium-data trilium</code></pre>+<p>To do this in Unix-based systems simply run <code>trilium</code> like this:</p><pre><code class="language-text-x-trilium-auto">TRILIUM_DATA_DIR=/home/myuser/data/my-trilium-data trilium</code></pre><p>You can then save the above command as a shell script on your path forconvenience.</p><h2>Fine-grained directory/path location</h2><p>Apart from the data directory, some of the subdirectories of it can bemoved elsewhere by changing an environment variable:</p>-<table>- <thead>- <tr>- <th>Environment variable</th>- <th>Default value</th>- <th>Description</th>- </tr>- </thead>- <tbody>- <tr>- <td><code>TRILIUM_DOCUMENT_PATH</code>- </td>- <td><code>${TRILIUM_DATA_DIR}/document.db</code>- </td>- <td>Path to the <a class="reference-link" href="#root/_help_wX4HbRucYSDD">Database</a> (storing- all notes and metadata).</td>- </tr>- <tr>- <td><code>TRILIUM_BACKUP_DIR</code>- </td>- <td><code>${TRILIUM_DATA_DIR}/backup</code>- </td>- <td>Directory where automated <a class="reference-link" href="#root/_help_ODY7qQn5m2FT">Backup</a> databases- are stored.</td>- </tr>- <tr>- <td><code>TRILIUM_LOG_DIR</code>- </td>- <td><code>${TRILIUM_DATA_DIR}/log</code>- </td>- <td>Directory where daily <a class="reference-link" href="#root/_help_bnyigUA2UK7s">Backend (server) logs</a> are- stored.</td>- </tr>- <tr>- <td><code>TRILIUM_TMP_DIR</code>- </td>- <td><code>${TRILIUM_DATA_DIR}/tmp</code>- </td>- <td>Directory where temporary files are stored (for example when opening in- an external app).</td>- </tr>- <tr>- <td><code>TRILIUM_ANONYMIZED_DB_DIR</code>- </td>- <td><code>${TRILIUM_DATA_DIR}/anonymized-db</code>- </td>- <td>Directory where a <a class="reference-link" href="#root/_help_x59R8J8KV5Bp">Anonymized Database</a> is- stored.</td>- </tr>- <tr>- <td><code>TRILIUM_CONFIG_INI_PATH</code>- </td>- <td><code>${TRILIUM_DATA_DIR}/config.ini</code>- </td>- <td>Path to <a class="reference-link" href="#root/_help_Gzjqa934BdH4">Configuration (config.ini or environment variables)</a> file.</td>- </tr>- </tbody>-</table>\ No newline at end of file+<figure class="table">+ <table>+ <thead>+ <tr>+ <th>Environment variable</th>+ <th>Default value</th>+ <th>Description</th>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td><code>TRILIUM_DOCUMENT_PATH</code>+ </td>+ <td><code>${TRILIUM_DATA_DIR}/document.db</code>+ </td>+ <td>Path to the <a class="reference-link" href="#root/_help_wX4HbRucYSDD">Database</a> (storing+ all notes and metadata).</td>+ </tr>+ <tr>+ <td><code>TRILIUM_BACKUP_DIR</code>+ </td>+ <td><code>${TRILIUM_DATA_DIR}/backup</code>+ </td>+ <td>Directory where automated <a class="reference-link" href="#root/_help_ODY7qQn5m2FT">Backup</a> databases+ are stored.</td>+ </tr>+ <tr>+ <td><code>TRILIUM_LOG_DIR</code>+ </td>+ <td><code>${TRILIUM_DATA_DIR}/log</code>+ </td>+ <td>Directory where daily <a class="reference-link" href="#root/_help_bnyigUA2UK7s">Backend (server) logs</a> are+ stored.</td>+ </tr>+ <tr>+ <td><code>TRILIUM_TMP_DIR</code>+ </td>+ <td><code>${TRILIUM_DATA_DIR}/tmp</code>+ </td>+ <td>Directory where temporary files are stored (for example when opening in+ an external app).</td>+ </tr>+ <tr>+ <td><code>TRILIUM_ANONYMIZED_DB_DIR</code>+ </td>+ <td><code>${TRILIUM_DATA_DIR}/anonymized-db</code>+ </td>+ <td>Directory where a <a class="reference-link" href="#root/_help_x59R8J8KV5Bp">Anonymized Database</a> is+ stored.</td>+ </tr>+ <tr>+ <td><code>TRILIUM_CONFIG_INI_PATH</code>+ </td>+ <td><code>${TRILIUM_DATA_DIR}/config.ini</code>+ </td>+ <td>Path to <a class="reference-link" href="#root/_help_Gzjqa934BdH4">Configuration (config.ini or environment variables)</a> file.</td>+ </tr>+ </tbody>+ </table>+</figure>\ No newline at end of filediff --git a/docs/Developer Guide/!!!meta.json b/docs/Developer Guide/!!!meta.jsonindex 397bdcab44..63e4d0cc42 100644--- a/docs/Developer Guide/!!!meta.json+++ b/docs/Developer Guide/!!!meta.json@@ -15,6 +15,20 @@"type": "text","mime": "text/html","attributes": [+ {+ "type": "relation",+ "name": "internalLink",+ "value": "T2W7WCZrYZBU",+ "isInheritable": false,+ "position": 10+ },+ {+ "type": "relation",+ "name": "internalLink",+ "value": "cxfTSHIUQtt2",+ "isInheritable": false,+ "position": 20+ },{"type": "label","name": "label:shareAlias",@@ -35,20 +49,6 @@"value": "developer-guide","isInheritable": false,"position": 30- },- {- "type": "relation",- "name": "internalLink",- "value": "T2W7WCZrYZBU",- "isInheritable": false,- "position": 40- },- {- "type": "relation",- "name": "internalLink",- "value": "cxfTSHIUQtt2",- "isInheritable": false,- "position": 50}],"format": "markdown",@@ -817,7 +817,7 @@"name": "internalLink","value": "Jg7clqogFOyD","isInheritable": false,- "position": 20+ "position": 10},{"type": "label",diff --git a/docs/Developer Guide/Developer Guide/Architecture/Security.md b/docs/Developer Guide/Developer Guide/Architecture/Security.mdindex 61fdc73776..f1ef4da771 100644--- a/docs/Developer Guide/Developer Guide/Architecture/Security.md+++ b/docs/Developer Guide/Developer Guide/Architecture/Security.md@@ -383,7 +383,7 @@ for (const blob of orphanedBlobs) {**Process:**-```sh+```# Check for vulnerabilitiesnpm audit@@ -424,7 +424,7 @@ npm audit fix --force**pnpm Patches:**-```sh+```# Create patchpnpm patch @ckeditor/ckeditor5diff --git a/docs/Developer Guide/Developer Guide/Concepts/Synchronisation.md b/docs/Developer Guide/Developer Guide/Concepts/Synchronisation.mdindex f97bd3c4eb..45a520cb68 100644--- a/docs/Developer Guide/Developer Guide/Concepts/Synchronisation.md+++ b/docs/Developer Guide/Developer Guide/Concepts/Synchronisation.md@@ -9,7 +9,7 @@ Trilium implements a **bidirectional synchronization system** that allows users## Sync Architecture-```mermaid+```graph TBDesktop1[Desktop 1<br/>Client]Desktop2[Desktop 2<br/>Client]diff --git a/docs/Developer Guide/Developer Guide/Documentation.md b/docs/Developer Guide/Developer Guide/Documentation.mdindex 4da87601a7..c11d3164c5 100644--- a/docs/Developer Guide/Developer Guide/Documentation.md+++ b/docs/Developer Guide/Developer Guide/Documentation.md@@ -1,5 +1,5 @@# Documentation-There are multiple types of documentation for Trilium:<img class="image-style-align-right" src="api/images/45okJ9xpVO32/Documentation_image.png" width="205" height="162">+There are multiple types of documentation for Trilium:<img class="image-style-align-right" src="api/images/6iUHD6bZIVmd/Documentation_image.png" width="205" height="162">* The _User Guide_ represents the user-facing documentation. This documentation can be browsed by users directly from within Trilium, by pressing <kbd>F1</kbd>.* The _Developer's Guide_ represents a set of Markdown documents that present the internals of Trilium, for developers.diff --git a/docs/User Guide/!!!meta.json b/docs/User Guide/!!!meta.jsonindex 86ddd95898..c0be591162 100644--- a/docs/User Guide/!!!meta.json+++ b/docs/User Guide/!!!meta.json@@ -25,56 +25,35 @@{"type": "relation","name": "internalLink",- "value": "BFs8mudNFgCS",+ "value": "gh7bpGYxajRS","isInheritable": false,"position": 20},{"type": "relation","name": "internalLink",- "value": "GTwFsgaA0lCt",- "isInheritable": false,- "position": 30- },- {- "type": "label",- "name": "shareAlias",- "value": "user-guide",- "isInheritable": false,- "position": 10- },- {- "type": "label",- "name": "label:shareAlias",- "value": "promoted,alias=Slug,single,text",- "isInheritable": true,- "position": 20- },- {- "type": "label",- "name": "iconClass",- "value": "bx bx-help-circle",+ "value": "BFs8mudNFgCS","isInheritable": false,"position": 30},{"type": "relation","name": "internalLink",- "value": "poXkQfguuA0U",+ "value": "GTwFsgaA0lCt","isInheritable": false,"position": 40},{"type": "relation","name": "internalLink",- "value": "WOcw2SLH6tbX",+ "value": "poXkQfguuA0U","isInheritable": false,"position": 50},{"type": "relation","name": "internalLink",- "value": "gh7bpGYxajRS",+ "value": "WOcw2SLH6tbX","isInheritable": false,"position": 60},@@ -98,6 +77,27 @@"value": "9qPsTWBorUhQ","isInheritable": false,"position": 90+ },+ {+ "type": "label",+ "name": "shareAlias",+ "value": "user-guide",+ "isInheritable": false,+ "position": 10+ },+ {+ "type": "label",+ "name": "label:shareAlias",+ "value": "promoted,alias=Slug,single,text",+ "isInheritable": true,+ "position": 20+ },+ {+ "type": "label",+ "name": "iconClass",+ "value": "bx bx-help-circle",+ "isInheritable": false,+ "position": 30}],"format": "markdown",diff --git a/docs/User Guide/User Guide/Installation & Setup/Data directory.md b/docs/User Guide/User Guide/Installation & Setup/Data directory.mdindex c2f3650c5c..3d66bafe90 100644--- a/docs/User Guide/User Guide/Installation & Setup/Data directory.md+++ b/docs/User Guide/User Guide/Installation & Setup/Data directory.md@@ -26,7 +26,17 @@ If you want to back up your Trilium data, just backup this single directory - it### Changing the location of data directory-If you want to use some other location for the data directory than the default one, you may change it via TRILIUM\_DATA\_DIR environment variable to some other location:+If you want to use some other location for the data directory than the default one, you may change it via `TRILIUM_DATA_DIR` environment variable to some other location:++### Windows++1. Press the Windows key on your keyboard.+2. Search and select “Edit the system variables”.+3. Press the “Environment Variables…” button in the bottom-right of the newly opened screen.+4. On the top section ("User variables for \[user\]"), press the “New…” button.+5. In the _Variable name_ field insert `TRILIUM_DATA_DIR`.+6. Press the _Browse Directory…_ button and select the new directory where to store the database.+7. Close all the windows by pressing the _OK_ button for each of them.#### Linux@@ -43,11 +53,6 @@ To load it manually, you need to use `launchctl setenv TRILIUM_DATA_DIR <yourpatHere is a pre-defined template, where you just need to add your path to:```-----Labelset.trilium.envRunAtLoad@@ -57,17 +62,14 @@ Here is a pre-defined template, where you just need to add your path to:launchctlsetenvTRILIUM_DATA_DIR- /Users/YourUserName/Library/Application Support/trilium-data---+ /Users/YourUserName/Library/Application Support/trilium-data```### Create a script to run with specific data directoryAn alternative to globally setting environment variable is to run only the Trilium Notes with this environment variable. This then allows for different setup styles like two [database](../Advanced%20Usage/Database.md) instances or "portable" installation.-To do this in unix based systems simply run trilium like this:+To do this in Unix-based systems simply run `trilium` like this:```TRILIUM_DATA_DIR=/home/myuser/data/my-trilium-data trilium