Skip to content

Nextcloud stack guide

The Wodby Nextcloud catalog stack runs Nextcloud file storage and sharing with PostgreSQL, Redis, and an optional OpenSMTPD mail relay. Nextcloud uses the official Nextcloud Apache image. The current composition is documented in wodby/stack-nextcloud.

Before you create the app

  • Nextcloud, PostgreSQL, and Redis are required. OpenSMTPD is optional and selected by default. You can leave it out when you create the app.
  • Enter Admin username and Admin password on the Nextcloud service. Nextcloud creates this administrator account during the first deployment. Both values are stored as secrets and Wodby does not show them again, so keep a copy.
  • Choose volume sizes now. The Nextcloud volume is 50 GB and the PostgreSQL volume is 20 GB by default. A volume cannot be resized from the app service settings after it is created. See Application persistent storage.
  • If file contents should be stored in a bucket instead of the Nextcloud volume, set that up before the first deployment. See Object storage for files.

First sign-in

Nextcloud installs itself when it first starts. After the first deployment, open the app's main domain and sign in with the administrator username and password you entered.

Changing Admin username or Admin password later does not change the account. Change the password in Nextcloud, or reset it with an occ command.

Domains

Nextcloud accepts requests only for its trusted domains. Wodby sets them from the app environment's domains, including Private App Access hostnames, each time Nextcloud starts. This list replaces trusted domains set in Nextcloud's own configuration, so manage domains in Wodby.

After you add or remove a domain, or change the main domain, deploy the Nextcloud service. Until then, Nextcloud rejects requests for a new hostname with an untrusted domain error. Links that Nextcloud creates in background jobs, such as email notifications, use the primary domain. See Domains.

The optional Trusted proxies setting lists proxy IP addresses or CIDR ranges, separated by spaces, whose forwarded client address headers Nextcloud trusts. Do not enter a range wider than your cluster's proxy network.

Background jobs

Wodby runs Nextcloud's background jobs every five minutes. On the first run, Nextcloud switches its background jobs setting to Cron. You do not need a Wodby cron schedule. Keep Cron selected under Administration settings > Basic settings > Background jobs.

Heavy daily background jobs run in a six-hour maintenance window, from 01:00 to 07:00 UTC by default. To move it to your quietest hours, set Maintenance window start on the Nextcloud service to the starting hour in UTC, from 0 to 23, then deploy the Nextcloud service. Leave the setting empty to let these jobs run at any time. The setting takes precedence over a maintenance window set with an occ command.

Phone numbers

To let people enter phone numbers in their profile without a country code, set Default phone region on the Nextcloud service to a two-letter country code, such as US or DE, then deploy the Nextcloud service.

Mail delivery

While the Nextcloud service is linked to OpenSMTPD, Nextcloud sends mail through it and takes its email server settings from Wodby. The sender address is built from two Nextcloud service settings: Mail sender, nextcloud by default, and Mail domain, the app's primary hostname by default.

Recipient mail servers often reject mail sent directly from a cluster. For production, attach an SMTP provider integration to OpenSMTPD and set Mail sender and Mail domain to an address your provider accepts. Then deploy the Nextcloud service. See the OpenSMTPD guide for relay setup and testing.

Without the OpenSMTPD link, set up an email server in Nextcloud under Administration settings > Basic settings.

Uploads and timeouts

The Nextcloud domain passes uploads through to Nextcloud as they arrive, and its request and backend timeouts are one hour. The PHP upload limit setting is 3G, and the Apache request body limit setting is 0, which means no Apache limit. Nextcloud clients normally upload large files in smaller parts, so these limits apply to each part.

To accept larger single requests, raise the PHP upload limit, then deploy the Nextcloud service. Do not set the request_body_size HTTP setting on the Nextcloud domain: it makes the route hold each upload in memory until it is complete. PHP memory limit is 512M by default.

Caching

Nextcloud keeps a local cache in its own container and uses Redis for the shared cache, file locking, and browser sessions. In this stack, Redis has no volume and keeps nothing on disk. It can use up to 512 MB of memory and never removes keys to free memory, so file locks and sessions are not lost while Redis runs. When Redis restarts or is deployed, its data is cleared, and people signed in through the browser may need to sign in again. See the Redis guide.

Object storage for files

Nextcloud can store file contents in Amazon S3, Cloudflare R2, Backblaze B2, Wasabi, or an S3-compatible service instead of the Nextcloud volume. Set it up before the first deployment:

  1. Create an empty bucket used only by this app environment's Nextcloud. For Amazon S3, create it in the region selected in the AWS integration.
  2. Create an AWS, Cloudflare R2, Backblaze B2, Wasabi, or S3-compatible integration whose credentials can read, write, and delete objects in that bucket.
  3. On the Nextcloud service, attach the integration to S3 primary storage on the Integrations tab and enter the bucket name in the S3 bucket setting. Nextcloud uses the bucket only when both are set.
  4. For Wasabi or an S3-compatible service, enter the bucket's region in the S3 region setting, for example eu-central-1. Leave it empty for us-east-1. The other providers take the region from their integration.

To use a bucket with an installation that already has files, mount it as a folder instead with Nextcloud's External storage support app, under Administration settings > External storage.

Data loss

Do not enable object storage on an installation that already has files: files stored on the volume become inaccessible. For the same reason, do not detach the integration or clear S3 bucket later, or the files in the bucket become inaccessible.

The bucket holds file contents under internal names. Folder structure and file names are stored in PostgreSQL, so you cannot browse users' folders in the bucket. Do not store anything else in it, including Wodby backups.

Data and backups

  • The Nextcloud volume holds the Nextcloud installation, its configuration, installed apps, themes, and, without object storage, all user files.
  • PostgreSQL holds accounts, shares, file records, and app data.
  • Redis holds only temporary data.

The Nextcloud service has no backup or import operation in Wodby. The PostgreSQL service does: a backup is a compressed SQL dump of the database, and an import replaces the whole database. See Backups and Imports.

A PostgreSQL backup on its own does not restore Nextcloud: the database records which files exist, so a restored database does not match the files on the volume or in the bucket. Wodby cannot back up the Nextcloud volume, so copy it, and the bucket if you use one, with your own tools together with a PostgreSQL backup, and restore them together. To keep the copies consistent, turn on maintenance mode while you make them.

Run occ commands

Open a web terminal on the Nextcloud service, choose the nextcloud container, and run occ as the www-data user:

su -s /bin/sh www-data -c 'php /var/www/html/occ status'

For example, use maintenance:mode --on and maintenance:mode --off around a backup, or user:resetpassword <user> to set a new password for an account.

Upgrades

Nextcloud upgrades itself when it starts with a newer version, for example after you change the version on the General configuration tab or after a stack update. Nextcloud's built-in web updater is turned off. The upgrade runs before Nextcloud serves requests, and Wodby gives it about 15 minutes before the container is restarted.

  • Back up before you upgrade.
  • Upgrade one major version at a time. If you skip a major version, Nextcloud does not start.
  • You cannot return to an older version. Nextcloud does not start when its data is newer than the selected version. Restore a backup instead.
  • Apps that are not compatible with the new version are disabled during the upgrade. The Nextcloud service log lists them.

After the first installation and after each upgrade, Wodby adds the optional database indices and runs the file type migrations that Nextcloud reports on Administration settings > Overview. After an upgrade they run while Nextcloud serves requests, which can take a while on a large installation.

Limits

  • Nextcloud runs as one replica. Nextcloud is unavailable while its service is deployed.
  • The stack does not include an online office server, such as Collabora Online.
  • The stack does not include a deploy daemon for external apps (ExApps), so AppAPI is turned off on new installations. Enable it in Nextcloud after you register a deploy daemon.