How to Add a New Nextcloud Instance

Step-by-step guide to deploy an additional Nextcloud instance using shared constructs.

Prerequisites

  • Access to dp-kup repository

  • Kubernetes cluster with ArgoCD

  • Node.js and npm installed

  • Domain name for new instance

Steps

1. Create Instance Directory

cd dp-kup/internal/nextcloud
mkdir nextcloud{name}
cd nextcloud{name}

2. Copy Boilerplate Files

# Copy from existing instance
cp ../nextcloudkup/{package.json,tsconfig.json,cdk8s.yaml,main.ts} .
cp -r ../nextcloudkup/charts .

3. Update package.json

{
  "name": "nextcloud{name}",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "@kup6s/nextcloud-shared": "workspace:*",
    "cdk8s": "^2.69.0",
    "cdk8s-plus-28": "^2.7.90",
    "constructs": "^10.3.0"
  }
}

4. Create config.yaml

namespace: nextcloud{name}
domain: {your-domain}.com

versions:
  nextcloud: "31.0.13"
  postgres: "16"
  redis: "7.4"
  collabora: "25.04.8.2.1"
  whiteboard: "latest"

s3:
  endpoint: https://fsn1.your-objectstorage.com
  region: fsn1
  buckets:
    data: data-nextcloud{name}-kup6s
    backups: backups-nextcloud{name}-kup6s

storage:
  storageClass: longhorn
  postgresSize: 10Gi
  redisSize: 5Gi

resources:
  nextcloud:
    requests:
      cpu: 200m
      memory: 512Mi
    limits:
      cpu: 1000m
      memory: 2Gi
  postgres:
    requests:
      cpu: 100m
      memory: 256Mi
    limits:
      cpu: 500m
      memory: 512Mi
  redis:
    requests:
      cpu: 50m
      memory: 128Mi
    limits:
      cpu: 200m
      memory: 256Mi

replicas:
  nextcloud: 1
  postgres: 2
  redis: 1

collabora:
  enabled: true
  domain: collabora.{your-domain}.com
  resources:
    requests:
      cpu: 100m
      memory: 512Mi
    limits:
      cpu: 1000m
      memory: 1Gi

whiteboard:
  enabled: true
  resources:
    requests:
      cpu: 50m
      memory: 256Mi
    limits:
      cpu: 500m
      memory: 512Mi

5. Generate Manifests

npm install
npm run synth

Output: manifests/nextcloud{name}.k8s.yaml

6. Create ArgoCD Application

cd ../../../../argoapps
# Add to apps configuration
npm run synth
kubectl apply -f dist/nextcloud-nextcloud{name}.k8s.yaml

7. Create S3 Credentials in Infisical

  1. Log in to Infisical

  2. Navigate to project

  3. Create secret: nextcloud-{name}-s3-credentials

  4. Add keys:

    • s3_access_key: {your S3 access key}

    • s3_secret_key: {your S3 secret key}

8. Monitor Deployment

kubectl get application -n argocd nextcloud-nextcloud{name} -w
kubectl get pods -n nextcloud{name} -w

9. Configure Nextcloud

# Set admin password
kubectl get secret -n nextcloud{name} nextcloud \
  -o jsonpath='{.data.nextcloud-password}' | base64 -d

# Access admin interface
open https://{your-domain}.com

10. Update DNS

Create DNS A records:

{your-domain}.com           A     {traefik-ip}
collabora.{your-domain}.com A     {traefik-ip}

Verification

  • [ ] All pods running

  • [ ] Can access web interface

  • [ ] Can create user account

  • [ ] Can upload/download files

  • [ ] Collabora document editing works

  • [ ] PostgreSQL backups running