diff --git a/Attributes.md b/Attributes.md new file mode 100644 index 0000000..b70983e --- /dev/null +++ b/Attributes.md @@ -0,0 +1,57 @@ +Note attributes are key-value records owned by (assigned to) given note. + +There are four types of attributes: + +* Labels - simple key-value text record +* Relation - specifies named relation (link) to another note +* Label and relation definition - these are described in [[Promoted attributes]] page + +Sometimes we're talking about labels and relations - keep in mind that both of them are types of attributes and are very similar. + +[[images/attributes.png]] + +## Labels +Labels are used for several things: + +* user can use them as labels with optional value - e.g. when catalogizing 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. note with imported reddit comment will have label with comment ID) + +Labels can be used when [[searching|Search]]. + +### Standard labels + +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 note]]. Only one should be marked as such. +* ```archived``` - notes with this label won't be visible in autocomplete-based search (jump to, add link). Applies also to all its sub-notes. +* ```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 + * ```daily``` - run once a day +* ```disableInclusion``` - scripts with this label won't be included into parent script execution. + +## Relations +Relation is a kind of link between two notes. + +This could be used when you e.g. keep a people database, you can use relations to keep formal links between people - e.g. note "Mike" will have relation "is husband of" note "Kate". + +More importantly relations are used for some more advanced things - like attaching scripts to events happening on certain note. + +### Standard relations + +* ```runOnNoteView``` - attached script will be run whenever the note has been loaded +* ```runOnNoteTitleChange``` - attached script will be run whenever the note title has been changed +* ```runOnAttributeChange``` - attached script will be run whenever the note's attribute has been changed +* ```inheritAttributes``` - attached note's attributes will be inherited even without parent-child relationship + +## Multiplicity + +Attributes allow multiplicity - there can be multiple attributes with the same name. We're then calling such attributes "multivalue". + +## Attribute inheritance + +Every attribute has a 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. diff --git a/Docker.md b/Docker-server-installation.md similarity index 76% rename from Docker.md rename to Docker-server-installation.md index 80bea46..8e48fbc 100644 --- a/Docker.md +++ b/Docker-server-installation.md @@ -1,4 +1,5 @@ Trilium can be run as docker image. This is useful for server deployments. + Docker images are published on docker hub: https://hub.docker.com/r/zadam/trilium/ ## Pull image @@ -12,5 +13,5 @@ Replace [VERSION] for actual latest version. It's not recommended to use "latest ## Run image ~~~~ -sudo docker run -t -i -p 8080:8080 -v ~/trilium-data:/root/trilium-data zadam/trilium:latest +sudo docker run -t -i -p 8080:8080 -v ~/trilium-data:/home/[myuser]/trilium-data zadam/trilium:latest ~~~~ \ No newline at end of file diff --git a/Labels.md b/Labels.md deleted file mode 100644 index 22c64f4..0000000 --- a/Labels.md +++ /dev/null @@ -1,45 +0,0 @@ -Note labels is a set of key-value records owned by (assigned to) given note. - -They are used mainly for several things: - -* user can use them as tags/labels with optional value - e.g. when catalogizing books, you might add labels like @year=1999, @genre=sci-fi, @author=Neal Stephenson -* labels 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. note with imported reddit comment will have label with comment ID) - -Both of these can then be used in filters. - -### Show / edit labels - -Click on note -> Note actions -> Labels (or use keyboard shortcut ```ALT+A```). - -### Filter query syntax - -Following examples demonstrates syntax: - -* ```@abc``` - matches notes with label abc -* ```@!abc``` - matches notes without abc label (maybe not the best syntax) -* ```@abc=true``` - matches notes with label abc having value true -* ```@abc!=true``` -* ```@"weird label"="weird value"``` - works also with whitespace inside names values -* ```@abc and @def``` - matches notes with both abc and def -* ```@abc @def``` - AND relation is implicit when specifying multiple labels -* ```@abc or @def``` - OR relation -* ```@abc<=5``` - numerical comparison (also >, >=, <). -* ```some search string @abc @def``` - combination of fulltext and label search - both of them need to match (OR not supported) -* ```@abc @def some search string``` - same combination - -### Standard labels - -Following labels are used for advanced configuration: - -* ```disable_versioning``` - disables auto-versioning. Useful for e.g. large, but unimportant notes - e.g. large JS libraries used for scripting -* ```calendar_root``` - marks note which should be used as root for "day notes". Only one should be marked as such. -* ```run_on_startup``` - JavaScript notes with this label will be executed after Trilium startup -* ```hide_in_autocomplete``` - notes with this label won't be visible in autocomplete-based search (jump to, add link). Applies also to all its sub-notes. -* ```exclude_from_export``` - notes (with their sub-tree) won't be included in any note export -* ```run``` - defines on which events script should run. Possible values are: - * ```frontend_startup``` - when Trilium frontend starts up (or is refreshed). - * ```backend_startup``` - when Trilium backend starts up - * ```hourly``` - run once an hour - * ```daily``` - run once a day -* ```disable_inclusion``` - scripts with this label won't be included into parent script execution. \ No newline at end of file diff --git a/Installation-as-webapp.md b/Manual-server-installation.md similarity index 77% rename from Installation-as-webapp.md rename to Manual-server-installation.md index 2db0f39..b99aea6 100644 --- a/Installation-as-webapp.md +++ b/Manual-server-installation.md @@ -1,12 +1,4 @@ -This pages describes installing Trilium as a web application as opposed to installing desktop (electron) build. - -Trilium as web application is typically used as a [[sync|Synchronization]] server, but can be also used as online version of Trilium. - -## Use docker if possible - -The easiest way to run Trilium as a webapp is to run a docker container. See [[Docker]] for details. - -If for some reason this is not possible or desirable, continue reading below. +This pages describes manually installing Trilium on your server. ## Requirements @@ -20,6 +12,7 @@ node --version If your linux distribution has only outdated version of node.js, you can take a look at the [[installation instructions|https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions]] on node.js website which covers most popular distributions. ### Image requirements +If you want to use Trilium server installation only as a [[sync server|Synchronization]], you can skip this section. To compile libraries required for image support you need to have "autoconf" installed. In ubuntu you can do this with @@ -56,3 +49,7 @@ nohup node src/www & ~~~~ Application by default starts up on port 8080, so you can open your browser and navigate to http://localhost:8080 to access Trilium (replace "localhost" with your hostname). + +## TLS + +Don't forget to [[configure TLS|TLS configuration]], which is required for secure usage! \ No newline at end of file diff --git a/Packaged-server-binary.md b/Packaged-server-binary.md new file mode 100644 index 0000000..60d8b69 --- /dev/null +++ b/Packaged-server-binary.md @@ -0,0 +1,16 @@ +This is the easiest and recommended method method on how to install Trilium on your server. + +## Steps + +* ssh into your server +* use ```wget``` (or ```curl``` or whatever) to download latest [ +trilium-linux-x64-[VERSION]-server.7z](https://github.com/zadam/trilium/releases/latest) (notice -server suffix) on your server +* unpack the archive, e.g. using ```p7zip -d``` +* ```cd trilium-linux-x64-server``` +* nohup ./trilium & + * this will start the trilium application in background and keep it running even after your ssh connection disconnects +* you can open the browser and open http://[your-server-hostname]:8080 and you should see Trilium initialization page + +## TLS + +Don't forget to [[configure TLS|TLS configuration]], which is required for secure usage! \ No newline at end of file diff --git a/Promoted-attributes.md b/Promoted-attributes.md new file mode 100644 index 0000000..57a158e --- /dev/null +++ b/Promoted-attributes.md @@ -0,0 +1,22 @@ +Promoted attributes are [[attributes|Attributes]] which are considered important and thus are "promoted" onto main note UI. See example below: + +[[images/promoted-attributes.png]] + +You can see the note having kind of form with several fields. Each of these is just regular attribute, the only difference is that they appear on the note itself. + +Attributes can be pretty useful since they allow for querying and script automation etc. but they are also inconveniently hidden in the note attributes dialog. This allows you to select few of the important ones and push them to the front of the user. + +Now, how do we make attribute to appear on the UI? + +## Attribute definition + +Attribute is always name-value pair where both name and value are strings. + +Attribute definition specifies how should this value be interpreted - is it just string, or is it a date? Should we allow multiple values or note? + +[[images/attribute-definitions.png]] + +In the above picture you can see two labels - tag and todoDate with some values. But below them you can notice again tag and todoDate attributes, but now of type "Label definition". These "definition" attributes define how the "value" attributes should behave. + +So there's one attribute for value and one for attribute. But notice how definition attribute is Inheritable, meaning that it's also applied to all descendant note. So in a way, this definition is used for the whole subtree while "value" attributes are applied only for this note. + diff --git a/Search.md b/Search.md new file mode 100644 index 0000000..440ad50 --- /dev/null +++ b/Search.md @@ -0,0 +1,15 @@ +## Filter query syntax + +Following examples demonstrates syntax: + +* ```@abc``` - matches notes with label abc +* ```@!abc``` - matches notes without abc label (maybe not the best syntax) +* ```@abc=true``` - matches notes with label abc having value true +* ```@abc!=true``` +* ```@"weird label"="weird value"``` - works also with whitespace inside names values +* ```@abc and @def``` - matches notes with both abc and def +* ```@abc @def``` - AND relation is implicit when specifying multiple labels +* ```@abc or @def``` - OR relation +* ```@abc<=5``` - numerical comparison (also >, >=, <). +* ```some search string @abc @def``` - combination of fulltext and label search - both of them need to match (OR not supported) +* ```@abc @def some search string``` - same combination diff --git a/Server-installation.md b/Server-installation.md new file mode 100644 index 0000000..0bec896 --- /dev/null +++ b/Server-installation.md @@ -0,0 +1,7 @@ +This pages describes installing Trilium on your own server. You might want to do this in case you want to setup [[sync|Synchronization]] or you want to use it as online version of Trilium accessible from anywhere. + +There are three options how to do this, each one with some advantage: + +* Recommended: [[Packaged server binary]] +* [[Docker|Docker server installation]] +* [[Manual installation|Manual server installation]] diff --git a/TLS-configuration.md b/TLS-configuration.md new file mode 100644 index 0000000..c07e7df --- /dev/null +++ b/TLS-configuration.md @@ -0,0 +1,24 @@ +TLS configuration is required for server installation, it's not relevant for purely desktop usage. + +First thing to do is to get a TLS certificate. You have two options: + +* Recommended - get TLS certificate signed by root certificate authority. For personal usage, best choice is [Let's encrypt](https://letsencrypt.org). It's free, automated and easy. +* generate your own self signed certificate. You will have extra trouble with importing the certificate into all machines from which you connect to the server installation so this is not recommended. + +## Modifying config.ini + +Now that you have your certificate, we need to modify ~/trilium-data/config.ini so that Trilium will use it: + +``` +[Network] +port=8080 +# true for TLS/SSL/HTTPS (secure), false for HTTP (unsecure). +https=true +# path to certificate (run "bash bin/generate-cert.sh" to generate self-signed certificate). Relevant only if https=true +certPath=/[username]/.acme.sh/[hostname]/fullchain.cer +keyPath=/[username]/.acme.sh/[hostname]/0o.cz.key +``` + +Above is only example of how this is setup on my environment when I generated the certificate using Let's encrypt acme utility. Your paths may be completely different. + +After you set this up, you may restart trilium and now visit the hostname with "https". \ No newline at end of file diff --git a/images/attribute-definitions.png b/images/attribute-definitions.png new file mode 100644 index 0000000..d44a126 Binary files /dev/null and b/images/attribute-definitions.png differ diff --git a/images/attributes.png b/images/attributes.png new file mode 100644 index 0000000..b18609d Binary files /dev/null and b/images/attributes.png differ diff --git a/images/promoted-attributes.png b/images/promoted-attributes.png new file mode 100644 index 0000000..385952f Binary files /dev/null and b/images/promoted-attributes.png differ