git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #51053 from Ma27/draft-nextcloud-module-docs

nixos/nextcloud: add basic module documentation and warn about current upgrading issues

commit34d45007e230b01d50f2cfa9181862073a340edf authorFlorian Klink <flokli@flokli.de> dateSun 16 Dec 2018, 12:16 (8 years ago) parent3dbf0f9216a954
2 files changed+101
nixos/modules/services/web-apps/nextcloud.nix+2 nixos/modules/services/web-apps/nextcloud.xml+99
nixos/modules/services/web-apps/nextcloud.nix+2
@@ -484,4 +484,6 @@ in {
484484 };
485485 })
486486 ]);
487+
488+ meta.doc = ./nextcloud.xml;
487489}
nixos/modules/services/web-apps/nextcloud.xmlnew file+99
@@ -0,0 +1,99 @@
1+<chapter xmlns="http://docbook.org/ns/docbook"
2+ xmlns:xlink="http://www.w3.org/1999/xlink"
3+ xmlns:xi="http://www.w3.org/2001/XInclude"
4+ version="5.0"
5+ xml:id="module-services-nextcloud">
6+ <title>Nextcloud</title>
7+
8+ <para>
9+ <link xlink:href="https://nextcloud.com/">Nextcloud</link> is an open-source, self-hostable cloud
10+ platform. The server setup can be automated using
11+ <link linkend="opt-services.nextcloud.enable">services.nextcloud</link>. A desktop client is packaged
12+ at <literal>pkgs.nextcloud-client</literal>.
13+ </para>
14+
15+ <section xml:id="module-services-nextcloud-basic-usage">
16+ <title>Basic usage</title>
17+ <para>
18+ Nextcloud is a PHP-based application which requires an HTTP server
19+ (<literal><link linkend="opt-services.nextcloud.enable">services.nextcloud</link></literal> optionally supports
20+ <literal><link linkend="opt-services.nginx.enable">services.nginx</link></literal>) and a database
21+ (it's recommended to use <literal><link linkend="opt-services.postgresql.enable">services.postgresql</link></literal>).
22+ </para>
23+ <para>
24+ A very basic configuration may look like this:
25+<programlisting>{ pkgs, ... }:
26+{
27+ services.nextcloud = {
28+ <link linkend="opt-services.nextcloud.enable">enable</link> = true;
29+ <link linkend="opt-services.nextcloud.hostName">hostName</link> = "nextcloud.tld";
30+ <link linkend="opt-services.nextcloud.nginx.enable">nginx.enable</link> = true;
31+ config = {
32+ <link linkend="opt-services.nextcloud.config.dbtype">dbtype</link> = "pgsql";
33+ <link linkend="opt-services.nextcloud.config.dbuser">dbuser</link> = "nextcloud";
34+ <link linkend="opt-services.nextcloud.config.dbhost">dbhost</link> = "/tmp"; # nextcloud will add /.s.PGSQL.5432 by itself
35+ <link linkend="opt-services.nextcloud.config.dbname">dbname</link> = "nextcloud";
36+ <link linkend="opt-services.nextcloud.config.adminpassFile">adminpassFile</link> = "/path/to/admin-pass-file";
37+ <link linkend="opt-services.nextcloud.config.adminuser">adminuser</link> = "root";
38+ };
39+ };
40+
41+ services.postgresql = {
42+ <link linkend="opt-services.postgresql.enable">enable</link> = true;
43+ <link linkend="opt-services.postgresql.initialScript">initialScript</link> = pkgs.writeText "psql-init" ''
44+ CREATE ROLE nextcloud WITH LOGIN;
45+ CREATE DATABASE nextcloud WITH OWNER nextcloud;
46+ '';
47+ };
48+
49+ # ensure that postgres is running *before* running the setup
50+ systemd.services."nextcloud-setup" = {
51+ requires = ["postgresql.service"];
52+ after = ["postgresql.service"];
53+ };
54+
55+ <link linkend="opt-networking.firewall.allowedTCPPorts">networking.firewall.allowedTCPPorts</link> = [ 80 443 ];
56+}</programlisting>
57+ </para>
58+ <para>
59+ The options <literal>hostName</literal> and <literal>nginx.enable</literal> are used internally to configure an
60+ HTTP server using <literal><link xlink:href="https://php-fpm.org/">PHP-FPM</link></literal> and <literal>nginx</literal>.
61+ The <literal>config</literal> attribute set is used for the <literal>config.php</literal> which is used
62+ for the application's configuration.
63+ <emphasis>Beware: this isn't entirely pure since the config is modified by the application's runtime!</emphasis>
64+ </para>
65+ <para>
66+ In case the application serves multiple hosts (those are checked with
67+ <literal><link xlink:href="http://php.net/manual/en/reserved.variables.server.php">$_SERVER['HTTP_HOST']</link></literal>)
68+ those can be added using
69+ <literal><link linkend="opt-services.nextcloud.config.extraTrustedDomains">services.nextcloud.config.extraTrustedDomains</link></literal>.
70+ </para>
71+ </section>
72+
73+ <section xml:id="module-services-nextcloud-pitfalls-during-upgrade">
74+ <title>Pitfalls</title>
75+ <para>
76+ Unfortunately Nextcloud appears to be very stateful when it comes to managing its own configuration. The
77+ config file lives in the home directory of the <literal>nextcloud</literal> user (by default
78+ <literal>/var/lib/nextcloud/config/config.php</literal>) and is also used to track several
79+ states of the application (e.g. whether installed or not).
80+ </para>
81+ <para>
82+ Right now changes to the <literal>services.nextcloud.config</literal> attribute set won't take effect
83+ after the first install
84+ (except <literal><link linkend="opt-services.nextcloud.config.extraTrustedDomains">services.nextcloud.config.extraTrustedDomains</link></literal>) since the actual configuration
85+ file is generated by the NextCloud installer which also sets up critical parts such as the database
86+ structure.
87+ </para>
88+ <para>
89+ <emphasis>Warning: don't delete <literal>config.php</literal>! This file tracks the application's state and a deletion can cause unwanted side-effects!</emphasis>
90+ </para>
91+ <para>
92+ <emphasis>Warning: don't rerun <literal>nextcloud-occ maintenance:install</literal>! This command tries to install the application and can cause unwanted side-effects!</emphasis>
93+ </para>
94+ <para>
95+ The issues are known and reported in <link xlink:href="https://github.com/NixOS/nixpkgs/issues/49783">#49783</link>, for now it's unfortunately necessary to manually work around these issues.
96+ </para>
97+ </section>
98+
99+</chapter>