Step 5: Nextcloud on Postgres and S3
New line, in development. Installed on a four-node test cluster built from shc next
b43f0c168(ce5db649eb) on 2026-10-08, with an S3 server on the cluster in place of the B2 bucket: a Versity S3 Gateway, connected with the sameconnection connectandconnection grantas below, its own address as the endpoint and its own key. The run named that connections3fixwhere this page saysb2, and its bucketnextcloud. The output below is that run’s, trimmed.
Nextcloud is a catalog app with many plugs. This step binds two of them:
| Plug | Required | What it wants |
|---|---|---|
postgres | unless --var postgres.hostname=... names an external server, or --var backend=mysql moves Nextcloud to the mysql plug | a database and a user, as in step 4 |
s3 | no, --var s3.endpoint=... also names an S3 server directly | a bucket; Nextcloud keeps its files in it, since S3 primary storage is native to Nextcloud |
The others (oidc, smtp, imap, onlyoffice, paperless and more) are optional: a plug file with no required: line is optional (ce modules/app/plug_required.go).
Leave the s3 plug out and Nextcloud keeps its files on the server’s disk, in the nextcloud-data volume, and its backup carries them.
The catalog has no S3 server. The bucket comes from a hosted provider, here Backblaze B2, through a connection, and Nextcloud’s s3 plug binds straight to that connection. Object storage for apps is the full page, including the external-s3 front, which checks the bucket before an app starts; this step is the short path.
At Backblaze
Section titled “At Backblaze”Make two things in the B2 console. SHC makes neither.
- A bucket. B2 bucket names are global, so
nextcloudis taken: pick a name of your own. This page writes it<bucket>. - An application key restricted to that one bucket, with read and write access. B2 shows a
keyIDand anapplicationKey, once.
Note the bucket’s region from its endpoint, for example us-west-004.
Connect and grant
Section titled “Connect and grant”$ shc connection connect b2 --type s3 -t rig \ --cred s3_endpoint=s3.us-west-004.backblazeb2.com \ --cred region=us-west-004 \ --value-file b2.json$ shc connection grant b2 -t rig --capability s3 --grantee rig --boundary '{"unscoped":true}'connection connectstores the endpoint and the key pair in the vault as a connection namedb2.s3_endpointis the bare host, with nohttps://and no port. Before it stores anything, SHC lists buckets with the key; a dead endpoint, an unknown key or a wrong secret refuses the connect (X400461HLDRCH, cemodules/connections/providers/s3hold/probe.go). A key the provider denies the bucket list is proven on a bucket it can list instead, named with--cred probe_bucket=<bucket>.b2.jsonholds{"access_key": "<keyID>", "secret_key": "<applicationKey>"}. A secret is never typed on the command line, where your shell history and the process list keep it, and--cred secret_key=<applicationKey>is refused (X400548CRDSEC). The secret comes from the file--value-filenames, the flagshc vault settakes: one field is--cred secret_key=- --value-file b2.key; two fields are the JSON object in the file named by--value-filealone.connection grantlets tenantriguse the connection’ss3capability.{"unscoped":true}says in writing that the tenant’s apps get the connection’s own key, not a key SHC cut down. With no--boundarythe grant is refused (X403922CONUNS). An unscoped grant serves every app bound tob2this same key, so each can reach every bucket it reaches. Here the key is limited to one bucket, because you limited it at B2. A grant with--boundary '{"buckets":["<name>"]}'instead mints each app its own B2 key for those buckets, which needs a connection key allowed towriteKeys,deleteKeys,listKeysandlistBucketsplus the object capabilities the app key gets (see the S3 connections guide).
Install Nextcloud
Section titled “Install Nextcloud”Keep pg from step 2 installed. The install may run on any node: the postgres edge reads its provider’s socket from the replicated store, as in step 4. The s3 edge needs no deployment; the daemon serves it from the connection.
$ shc install nextcloud -s cloud -t rig -i postgres=pg -i s3=@b2 \ --var s3.bucket=<bucket> \ --expose 8082=nextcloud:80installing stack "cloud"cloud: startingcloud: runninginstalled deployment "cloud"exposure: lan$ shc integration ls -t rig -e prodCONSUMER STACK NAME CONSUMER PLUG PROVIDER STACK NAME PROVIDER SOCKET STATUS IDcloud postgres pg postgres connected 0cloud s3 s3 connected 28$ curl -s http://<node address>:8082/status.php{"installed":true,"maintenance":false,"needsDbUpgrade":false,"version":"34.0.2.1","versionstring":"34.0.2","edition":"","productname":"Nextcloud","extendedSupport":false}The s3 edge has no provider stack: its provider is the connection. On the test cluster the install took about three and a half minutes, and once Nextcloud was up its bucket held 66 objects: the files it keeps from its first start.
-i postgres=pgis step 4’s edge: the Postgres socket makes Nextcloud its own database and user.-i s3=@b2binds thes3plug to the connectionb2. The@names a connection, not a stack. Ans3connection serves thes3capability: the key it holds. Anawsconnection would serves3-bucketinstead and make a bucket and a key for the app (cemodules/app/mint_seam.go,capabilitiesForPlug).--var s3.bucket=<bucket>names the bucket you made. With a held key SHC keeps the app’s own bucket, and the package’s default isnextcloud, which is not yours at B2.- There is no key variable to set. The package defaults
s3.accessKeyands3.secretKeyto a key of Nextcloud’s own, and on a connection edge SHC writes the connection’s key pair over them (cemodules/app/integration_render.go,stampEdgeCredentials). A non-empty--var s3.accessKey=...of yours would still win. --expose 8082=nextcloud:80publishes the container’s port 80 on port 8082 of the node.
What SHC does
Section titled “What SHC does”- It resolves both edges. For
s3=@b2the daemon checks thatb2is granted torigfors3, or refuses withX403910CONGRT. It then asks the connection’ss3capability for the endpoint, port 443, region, the key pair and TLS on, and puts exactly those under the plug’s socket data. It writes the key pair over the plug’s ownaccessKeyandsecretKeytoo, so the package’s default key never reaches the render. The connection record itself never reaches a render (cedaemon/services_seams_connections_mint.go,modules/connections/providers/s3hold/hold.go). Serving the held key logsX200464HLDUNSCOPED, naming the tenant, the app and the endpoint. SHC keeps a copy of what it served inrig’s vault for this app. An update never reads a held copy back: it asks the connection again, so a key rotated inb2reaches the app on its next update (SHC-1457). - It renders Nextcloud’s compose with
SHC_S3_HOST,SHC_S3_BUCKET, the key pair andSHC_S3_SSLset. - It runs the Postgres socket’s job, which creates the database and the user. The connection runs no job: nothing checks the bucket before Nextcloud starts, so a missing bucket or a key B2 rejects shows up in Nextcloud’s own log on its first write. The
external-s3front runs that check first, if you want the install refused instead. - It starts Nextcloud, which keeps its files in the bucket from its first start. Every start renders the bucket, endpoint and key into Nextcloud’s
objectstoreconfig inconfig/zz-shc.config.php(apps/flagship/nextcloud/compose.yaml, SHC-3439).
Remove it
Section titled “Remove it”$ shc uninstall cloud -t rig -yUninstalling Nextcloud leaves the bucket and every object in it, and leaves pg’s database and user, as in step 4. For the s3 edge SHC drops its own copy of the key; the key stays in the connection and at B2. To drop the files, empty the bucket at B2.
Keep cloud and pg installed for the next step.
Next: Step 6: Nextcloud add-ons.