Nextcloud: 4. Create the service

This documentation is part of the Automate with the CLI guide. View the full guide here: Start Nextcloud, retrieve its credentials, and change its configuration programmatically with the Stackhero CLI.

👋 Welcome to the Stackhero documentation!

Stackhero provides a Nextcloud cloud solution for your files and your team:

  • Unlimited users, apps, and transfers: no fee per user.
  • Euro-Office (Nextcloud Office) to edit documents, spreadsheets, and presentations in your browser, on the 1T and 5T plans.
  • Effortless updates: keep Nextcloud current with a single click.
  • Custom domain name with HTTPS: run Nextcloud at a secure, branded URL, such as https://cloud.your-company.com.
  • High performance and strong security: your data runs on private, dedicated infrastructure.

With Stackhero, you can launch Nextcloud in minutes. Try our Nextcloud cloud hosting to share and edit your files without managing a server.

Here is a sample script that creates a stack, adds your Nextcloud service to it, waits for it to start, retrieves its configuration (including generated credentials), and then applies a new configuration.

#!/bin/bash
set -e

export STACKHERO_TOKEN="usr-xxxxxx:your-token"

serviceStore="nextcloud"   # The Nextcloud service store name (see step 2)
instance="..."                # An instance size from step 3
region="europe"               # A region name from step 3

# Create a stack for your service (uses your default organization; add --organization if needed)
stackId=$(stackhero --format=script stack-create \
  --name="My Nextcloud stack")
echo "Stack created: ${stackId}"

# Add Nextcloud to the stack (names are resolved automatically)
serviceId=$(stackhero --format=script service-add \
  --stack="My Nextcloud stack" \
  --service-store="${serviceStore}" \
  --instance="${instance}" \
  --region="${region}")
echo "Service added: nextcloud"

# Wait for the service to be fully running (this may take a couple of minutes)
stackhero service-wait-for --service="nextcloud"

# Retrieve the service configuration, including generated credentials
stackhero service-configuration-get --service="nextcloud" --format=json