Dokuwiki: Difference between revisions
imported>Onny mNo edit summary |
m explained the „no need for databases" |
||
(13 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
[https://www.dokuwiki.org DokuWiki] is a web application and simple Wiki software for creating documentation and editable pages in markdown language. Compared to other Wikis, it is more minimal and only depends on PHP and file access without any need for databases. | [https://www.dokuwiki.org DokuWiki] is a web application and simple Wiki software for creating documentation and editable pages in markdown language. Compared to other Wikis, it is more minimal and only depends on PHP and file access without any need for databases. It stores all information in plain text files to be available even without the DokuWiki software (e.g. to read directly from backup). | ||
== Installation == | == Installation == | ||
Line 8: | Line 8: | ||
services.dokuwiki.sites."localhost" = { | services.dokuwiki.sites."localhost" = { | ||
enable = true; | enable = true; | ||
settings.title = "My Wiki"; | |||
}; | }; | ||
</nowiki>}} | </nowiki>}} | ||
Line 18: | Line 16: | ||
== Configuration == | == Configuration == | ||
Besides several options which are exposed by the DokuWiki module in NixOS, you can also use <code>settings</code> option to add custom options to your DokuWiki configuration. See the [https://www.dokuwiki.org/config upstream documentation] for available options. | |||
To disable the user | === Templates === | ||
Unfortunately no templates are packaged yet in nixpkgs. It is possible to manually package a template, for example from the [https://www.dokuwiki.org/template official template repository], and include it in your Dokuwiki instance. In the following example the template [https://www.dokuwiki.org/template:mindthedark mindthedark] is packaged and enabled | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | |||
let | |||
dokuwiki-template-mindthedark = pkgs.stdenv.mkDerivation rec { | |||
name = "mindthedark"; | |||
version = "2021-12-24"; | |||
src = pkgs.fetchFromGitHub { | |||
owner = "MrReSc"; | |||
repo = "MindTheDark"; | |||
rev = version; | |||
sha256 = "sha256-8wWwwAYYQcUYzHpnSKOubZh7UzwfxvWXXNU7CUAiS3o="; | |||
}; | |||
installPhase = "mkdir -p $out; cp -R * $out/"; | |||
}; | |||
in { | |||
services.dokuwiki.sites."localhost" = { | |||
templates = [ dokuwiki-template-mindthedark ]; | |||
settings = { | |||
template = "mindthedark"; | |||
tpl.mindthedark.autoDark = true; | |||
}; | |||
}; | |||
}; | |||
</nowiki>}} | |||
Please note that you'll have to manually update the tempalte source and checksum in case there's a new version. | |||
=== Plugins === | |||
The following example packages the [https://www.dokuwiki.org/plugin:edittable edittable plugin] | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | |||
let | |||
dokuwiki-plugin-edittable = pkgs.stdenv.mkDerivation { | |||
name = "edittable"; | |||
src = pkgs.fetchzip { | |||
url = "https://github.com/cosmocode/edittable/archive/master.zip"; | |||
sha256 = "sha256-l+GZdFGp6wyNuCbAZB9IbwpY5c/S4vSW12VP0mJHKXs="; | |||
}; | |||
sourceRoot = "."; | |||
installPhase = "mkdir -p $out; cp -R edittable-master/* $out/"; | |||
}; | |||
in { | |||
services.dokuwiki.sites."localhost" = { | |||
plugins = [ dokuwiki-plugin-edittable ]; | |||
}; | |||
}; | |||
</nowiki>}} | |||
The plugin is enabled automatically. Note that in case of this plugin, we strip the root directory called ''edittable-master'' and only copy the plugin files to the ''out''-folder. Please note that you'll have to manually update the plugin source and checksum in case there's a new version. | |||
=== Clean URLs === | |||
If supported by the webserver you've choosen (using the <code>webserver</code> option), you can enable clean urls or url rewriting by enabling the option [https://www.dokuwiki.org/config:userewrite userewrite]. This means you can access your sites with the simple URL scheme like http://localhost/my_project . | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | |||
services.dokuwiki.sites."localhost".settings = { | |||
userewrite = true; | |||
}; | |||
</nowiki>}} | |||
Clean URLs are reported to work with the webserver [[Caddy]]. | |||
=== Anonymous editing === | |||
To disable the user authentication completely and make the Wiki editable by anyone (even anonymous users), you can disable the config [https://www.dokuwiki.org/config:useacl useacl] with the following option | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
services.dokuwiki.sites."localhost" = { | services.dokuwiki.sites."localhost".settings = { | ||
acluse = false; | |||
}; | }; | ||
</nowiki>}} | </nowiki>}} | ||
Line 38: | Line 105: | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
services.dokuwiki.sites."localhost". | services.dokuwiki.sites."localhost".settings = { | ||
baseurl = "https://example.org"; | |||
}; | }; | ||
</nowiki>}} | </nowiki>}} | ||
== See also == | |||
* [[Mediawiki]], PHP- and web-based wiki software. | |||
* [[Outline]], a modern web based wiki and knowledge base for teams. | |||
[[Category:Server]] | |||
[[Category:Web Applications]] | [[Category:Web Applications]] |
Latest revision as of 16:57, 4 June 2024
DokuWiki is a web application and simple Wiki software for creating documentation and editable pages in markdown language. Compared to other Wikis, it is more minimal and only depends on PHP and file access without any need for databases. It stores all information in plain text files to be available even without the DokuWiki software (e.g. to read directly from backup).
Installation
To setup DokuWiki locally, this is the most minimal configuration to get started
/etc/nixos/configuration.nix
services.dokuwiki.sites."localhost" = {
enable = true;
settings.title = "My Wiki";
};
After that DokuWiki will be available at http://localhost .
Configuration
Besides several options which are exposed by the DokuWiki module in NixOS, you can also use settings
option to add custom options to your DokuWiki configuration. See the upstream documentation for available options.
Templates
Unfortunately no templates are packaged yet in nixpkgs. It is possible to manually package a template, for example from the official template repository, and include it in your Dokuwiki instance. In the following example the template mindthedark is packaged and enabled
/etc/nixos/configuration.nix
let
dokuwiki-template-mindthedark = pkgs.stdenv.mkDerivation rec {
name = "mindthedark";
version = "2021-12-24";
src = pkgs.fetchFromGitHub {
owner = "MrReSc";
repo = "MindTheDark";
rev = version;
sha256 = "sha256-8wWwwAYYQcUYzHpnSKOubZh7UzwfxvWXXNU7CUAiS3o=";
};
installPhase = "mkdir -p $out; cp -R * $out/";
};
in {
services.dokuwiki.sites."localhost" = {
templates = [ dokuwiki-template-mindthedark ];
settings = {
template = "mindthedark";
tpl.mindthedark.autoDark = true;
};
};
};
Please note that you'll have to manually update the tempalte source and checksum in case there's a new version.
Plugins
The following example packages the edittable plugin
/etc/nixos/configuration.nix
let
dokuwiki-plugin-edittable = pkgs.stdenv.mkDerivation {
name = "edittable";
src = pkgs.fetchzip {
url = "https://github.com/cosmocode/edittable/archive/master.zip";
sha256 = "sha256-l+GZdFGp6wyNuCbAZB9IbwpY5c/S4vSW12VP0mJHKXs=";
};
sourceRoot = ".";
installPhase = "mkdir -p $out; cp -R edittable-master/* $out/";
};
in {
services.dokuwiki.sites."localhost" = {
plugins = [ dokuwiki-plugin-edittable ];
};
};
The plugin is enabled automatically. Note that in case of this plugin, we strip the root directory called edittable-master and only copy the plugin files to the out-folder. Please note that you'll have to manually update the plugin source and checksum in case there's a new version.
Clean URLs
If supported by the webserver you've choosen (using the webserver
option), you can enable clean urls or url rewriting by enabling the option userewrite. This means you can access your sites with the simple URL scheme like http://localhost/my_project .
/etc/nixos/configuration.nix
services.dokuwiki.sites."localhost".settings = {
userewrite = true;
};
Clean URLs are reported to work with the webserver Caddy.
Anonymous editing
To disable the user authentication completely and make the Wiki editable by anyone (even anonymous users), you can disable the config useacl with the following option
/etc/nixos/configuration.nix
services.dokuwiki.sites."localhost".settings = {
acluse = false;
};
Tips and tricks
SSL behind reverse proxy
In case you're running DokuWiki behind a reverse proxy which offers ssl/https to the outside, you might have to enforce https protocol by changing the baseurl
/etc/nixos/configuration.nix
services.dokuwiki.sites."localhost".settings = {
baseurl = "https://example.org";
};