Unverified Commit 5a6f0a43 authored by Maximilian Bosch's avatar Maximilian Bosch
Browse files

nixos/nextcloud: document nextcloud-occ command

It's not clear how to use this command in other systemd units, this
section gives a recommendation.

I realized that there's no explicit mention of `nextcloud-occ` in the
first place, so I wrote some introductory sentences as well.
parent 82bf4690
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -617,6 +617,9 @@
  "module-services-nextcloud-httpd": [
    "index.html#module-services-nextcloud-httpd"
  ],
  "module-services-nextcloud-occ": [
    "index.html#module-services-nextcloud-occ"
  ],
  "installing-apps-php-extensions-nextcloud": [
    "index.html#installing-apps-php-extensions-nextcloud"
  ],
+31 −0
Original line number Diff line number Diff line
@@ -56,6 +56,37 @@ it's needed to add them to
Auto updates for Nextcloud apps can be enabled using
[`services.nextcloud.autoUpdateApps`](#opt-services.nextcloud.autoUpdateApps.enable).

## `nextcloud-occ` {#module-services-nextcloud-occ}

The management command [`occ`](https://docs.nextcloud.com/server/stable/admin_manual/occ_command.html) can be
invoked by using the `nextcloud-occ` wrapper that's globally available on a system with Nextcloud enabled.

It requires elevated permissions to become the `nextcloud` user. Given the way the privilege
escalation is implemented, parameters passed via the environment to Nextcloud (e.g. `OC_PASS`) are
currently ignored.

Custom service units that need to run `nextcloud-occ` either need elevated privileges
or the systemd configuration from `nextcloud-setup.service` (recommended):

```nix
{ config, ... }: {
  systemd.services.my-custom-service = {
    script = ''
      nextcloud-occ …
    '';
    serviceConfig = {
      inherit (config.systemd.services.nextcloud-cron.serviceConfig)
        User
        LoadCredential
        KillMode;
    };
  };
}
```

Please note that the options required are subject to change. Please make sure to read the
release notes when upgrading.

## Common problems {#module-services-nextcloud-pitfalls-during-upgrade}

  - **General notes.**