Collectives

Runtime Dependencies

Collectives requires the following apps to be enabled. They’re all shipped and enabled by default with the Nextcloud server installation:

  • Teams (with Nextcloud >= 29) or Circles (with Nextcloud <= 28)

  • Text

  • Viewer

  • files_versions

Collectives and group_everyone

When using the group_everyone app, existing users will not see collectives with the “everyone” group as member. The group members need to be synced once in the circles app: occ circles:sync --groups

This only needs to be done once. New users that got created after the app was enabled will see the collectives straight away.

Collectives and guest users

In order to allow guest users (as provided by the guests app to access collectives, add the Collectives and Teams apps to the list of enabled apps for guest users in admin settings.

Please note that this enables guest users to create new collectives.

Public shares

WebDAV access to public shares must not be disabled (i.e. it must be enabled) for publicly shared collectives to work. Please make sure that the following admin option is enabled: “Allow users on this server to send shares to other servers (This option also enables WebDAV access to public shares)” under “Sharing -> Federated Cloud Sharing”.

Configuration

Initial Content for new collectives

It’s possible to create custom content for new collectives by putting files in the app skeleton directory at data/app_<INSTANCE_ID>/collectives/skeleton. New collectives start with the contents of this directory.

Create a Readme.md file to change the landing page that is opened automatically when entering a collective.

If the skeleton directory doesn’t contain a Readme.md, the default landing page from apps/collectives/skeleton/Readme.md will be copied into the collectives directory instead.

Allow for groups in your collectives

You can configure the Teams app to allow adding groups to teams. Since the Collectives app relies on the Teams app for user management, this also allows adding entire groups to collectives.

Keep in mind thought that in contrast to teams, groups can only be managed by server admins.

Importing existing data

Import existing Markdown files is possible with the occ command occ collectives:import:markdown.

The command imports Markdown files from a directory as new pages into a collective. After importing all files, it processes relative links and referenced local attachments in the Markdown files. It tries to fix links to other pages and uploads referenced attachments when the source file is found in the import directory.

Please beware that the command is memory intensive. When importing a directory with many Markdown files, make sure to increase the PHP memory limit accordingly:

php -d memory_limit=<X>G ./occ collectives:import:markdown -c <collectiveId> -u <userId> /path/to/markdown/files

Importing from Dokuwiki

The Markdown directory import command (see above) supports to import Markdown files generated from a Dokuwiki instance and tries to fix relative links to other pages and upload referenced attachments.

Importing is tested with Markdown files generated with the Dokuwiki2Markdown tool.

Here’s an example how to import from a Dokuwiki instance:

/path/to/doku2md.py -d /path/to/dokuwiki/data/pages -T
php -d memory_limit=2G ./occ collectives:import:markdown -c 123 -u alice /path/to/dokuwiki/data/pages

Publishing collectives as websites

Admins and owners of a collective can publish selected pages of the collective as a public static website. See Publish a collective as a website in the user manual for how this works for users.

Nextcloud doesn’t build or host the websites itself. It hands the content of a website to the external service publish. The service builds the website, serves it from its own host and reports the result back to Nextcloud. The feature is disabled by default.

Setting up the external publish service

Deploy the publish service as described in the publish wiki. Remember the URL of the service and the value of PUBLISH_API_TOKEN from its .env file. You need both to connect to your Nextcloud instance.

The published websites are served by the publish service, for example at https://publish.example.com/sites/<address>/. The exact URL of a website is reported by the service after publishing.

Connecting Nextcloud

  1. Go to Administration settings → Additional settings.

  2. In the Publish feature section, enable Enable publish feature.

  3. Enter the URL of the publish service in the Static site generator URL field, for example https://publish.example.com.

  4. Enter the value of PUBLISH_API_TOKEN in the Static site generator token field.

  5. Click Test connection to check that Nextcloud can reach the service and the token is valid.

Alternatively, configure the feature with occ:

sudo -E -u www-data php occ config:app:set collectives publish_enabled --value=true --type=boolean
sudo -E -u www-data php occ config:app:set collectives static_site_generator_url --value=https://publish.example.com
sudo -E -u www-data php occ config:app:set collectives static_site_generator_token --value=<token> --sensitive

Disabling the feature prevents new publications and updates. Websites that are already published stay online.

Maximum website size

The total size of all files of a website is limited to 100 MiB by default. To change the limit, set static_site_max_size in bytes, for example to 200 MiB:

sudo -E -u www-data php occ config:app:set collectives static_site_max_size --value=209715200 --type=integer

Network requirements

  • Nextcloud must be able to reach the publish service.

  • The publish service must be able to reach Nextcloud under its public URL. It downloads the content of a website from Nextcloud and reports the result back to Nextcloud. Make sure overwrite.cli.url in config.php is set to a URL the publish service can reach.

  • If the publish service runs on a local or private network address, Nextcloud blocks requests to it by default. Allow them in config.php:

    $CONFIG = [
        // ...
        'allow_local_remote_servers' => true,
    ];
    

Deleted collectives

When a collective is moved to the trash, its websites stay online. When a collective is deleted permanently, its websites are deleted from the publish service as well. If the service can’t be reached at that moment, the background job DeleteOrphanedStaticSites retries the deletion every six hours. Until then, the website addresses stay reserved.

Troubleshooting

  • Users don’t see Publish website: Check that Enable publish feature is enabled and that the user is an admin or the owner of the collective.

  • Publishing websites is not set up: The URL or the token of the publish service is missing.

  • The publish service is currently not available: Nextcloud can’t reach the publish service. Check the URL and the network connection.

  • Publishing fails or never finishes: The publish service may not be able to reach Nextcloud. Check the network requirements above and the logs of the publish service.