Skip to content

ConductionNL/Nextcloud-base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

201 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Nextcloud Multi-Tenant GitOps Platform

Nextcloud Kubernetes ArgoCD Helm

Een production-ready GitOps platform voor het draaien van meerdere Nextcloud instances op Kubernetes

Quick Start β€’ Architectuur β€’ Documentatie β€’ Bijdragen


✨ Kenmerken

  • πŸš€ Multi-tenant architectuur β€” Elke tenant draait in eigen namespace met volledige isolatie
  • πŸ”„ GitOps-first β€” Alle configuratie in Git, automatische sync via Argo CD
  • πŸ“¦ S3 Primary Storage β€” Geen NFS-afhankelijkheden, resilient tijdens node upgrades
  • πŸ” Secrets Management β€” Ondersteuning voor External Secrets Operator of fallback generator
  • πŸ“Š Observability β€” Prometheus metrics, ServiceMonitors, en alerting ready
  • 🎯 Canary Deployments β€” Wave-based rollouts met canary-first strategie
  • ⚑ Connection Pooling β€” Shared Redis en PgBouncer voor efficiΓ«nt resource gebruik

πŸ—οΈ Architectuur

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              Kubernetes Cluster                              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚
β”‚  β”‚                         Platform Components                              β”‚β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚β”‚
β”‚  β”‚  β”‚   Redis     β”‚  β”‚  PgBouncer  β”‚  β”‚  External Secrets Operator       β”‚ β”‚β”‚
β”‚  β”‚  β”‚  (shared)   β”‚  β”‚  (shared)   β”‚  β”‚  (secrets from Vault/cloud)      β”‚ β”‚β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚
β”‚                                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚
β”‚  β”‚ ns: nc-canary    β”‚  β”‚ ns: nc-tenant-a  β”‚  β”‚ ns: nc-tenant-b  β”‚   ...    β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚          β”‚
β”‚  β”‚  β”‚ Nextcloud  β”‚  β”‚  β”‚  β”‚ Nextcloud  β”‚  β”‚  β”‚  β”‚ Nextcloud  β”‚  β”‚          β”‚
β”‚  β”‚  β”‚   Pod(s)   β”‚  β”‚  β”‚  β”‚   Pod(s)   β”‚  β”‚  β”‚  β”‚   Pod(s)   β”‚  β”‚          β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚          β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                           External Services                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   Ceph RGW S3   β”‚  β”‚   PostgreSQL    β”‚  β”‚        CephFS               β”‚  β”‚
β”‚  β”‚  (user files)   β”‚  β”‚   (database)    β”‚  β”‚   (minimal appdata)         β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Waarom S3 Primary Storage?

Tijdens Kubernetes node upgrades kan de provider toegang tot de OpenStack API blokkeren, waardoor:

  • CSI attach/mount operaties falen
  • In-cluster NFS provisioner onbeschikbaar wordt
  • Services uitvallen voor de duur van de upgrade

Onze oplossing: User files in S3 (Ceph RGW) zijn altijd toegankelijk, onafhankelijk van cluster-status.

Component Traditioneel Dit Platform
User files NFS/block storage S3 Object Storage
Config RWX NFS volume ConfigMaps + Secrets
Sessions Local/NFS Redis (shared)
Locking File-based Redis (distributed)

πŸ“ Repository Structuur

nextcloud-platform/
β”œβ”€β”€ argo/                           # Argo CD configuratie
β”‚   β”œβ”€β”€ applicationsets/            # ApplicationSet voor tenants
β”‚   └── projects/                   # Argo CD project definitie
β”œβ”€β”€ platform/                       # Shared platform components
β”‚   β”œβ”€β”€ redis/                      # Shared Redis deployment
β”‚   β”œβ”€β”€ pgbouncer/                  # Connection pooler
β”‚   β”œβ”€β”€ externalsecrets/            # ESO ClusterSecretStore
β”‚   └── policies/                   # NetworkPolicies, PDBs
β”œβ”€β”€ values/                         # Helm values
β”‚   β”œβ”€β”€ common.yaml                 # Gedeelde configuratie
β”‚   β”œβ”€β”€ env/                        # Environment overrides
β”‚   β”‚   β”œβ”€β”€ accept.yaml
β”‚   β”‚   └── prod.yaml
β”‚   └── tenants/                    # Tenant configuraties
β”‚       └── tenant-canary.yaml
β”œβ”€β”€ scripts/                        # Utility scripts
β”‚   β”œβ”€β”€ create-tenant-secret.sh
β”‚   β”œβ”€β”€ validate-values.sh
β”‚   └── smoke-checks.sh
└── docs/                           # Documentatie
    β”œβ”€β”€ ADDING-TENANT.md
    β”œβ”€β”€ DATABASE.md
    β”œβ”€β”€ SECRETS.md
    └── UPGRADE.md

πŸš€ Quick Start

Prerequisites

  • Kubernetes 1.28+
  • Argo CD geΓ―nstalleerd
  • cert-manager met letsencrypt-prod ClusterIssuer
  • S3-compatible storage (Ceph RGW, MinIO, AWS S3)
  • DNS geconfigureerd voor tenants

1. Clone de repository

git clone https://github.com/your-org/nextcloud-platform.git
cd nextcloud-platform

2. Configureer de eerste tenant

Maak een secret aan voor de canary tenant:

kubectl create namespace nc-canary

kubectl create secret generic nextcloud-secrets \
  --namespace=nc-canary \
  --from-literal=nextcloud-username=admin \
  --from-literal=nextcloud-password='$(openssl rand -base64 24)' \
  --from-literal=s3-access-key='YOUR_S3_ACCESS_KEY' \
  --from-literal=s3-secret-key='YOUR_S3_SECRET_KEY' \
  --from-literal=db-password='YOUR_DB_PASSWORD' \
  --from-literal=redis-password='' \
  --from-literal=nextcloud-secret="$(openssl rand -base64 48)"

3. Deploy met Argo CD

# Apply Argo CD project
kubectl apply -f nextcloud-platform/argo/projects/nextcloud-platform.yaml

# Apply ApplicationSet
kubectl apply -f nextcloud-platform/argo/applicationsets/nextcloud-tenants.yaml

4. Monitor de deployment

kubectl get applications -n argocd -w
kubectl get pods -n nc-canary -w

5. Toegang tot Nextcloud

Open je browser en ga naar https://nextcloud-canary.commonground.nu (of je geconfigureerde hostname).

πŸ“š Documentatie

Document Beschrijving
SETUP.md Volledige setup guide voor eerste deployment
ADDING-TENANT.md Stap-voor-stap guide voor nieuwe tenants
DATABASE.md Database opties (MariaDB, PostgreSQL, External)
SECRETS.md Secrets management met ESO of fallback
UPGRADE.md Upgrade procedures en rollback

πŸ”§ Tenant Toevoegen

Maak een nieuw bestand values/tenants/tenant-<naam>.yaml:

tenant:
  name: mijn-tenant
  environment: prod
  wave: "1"
  hostname: mijn-tenant.nextcloud.example.com
  
  s3:
    bucket: nextcloud-mijn-tenant

nextcloud:
  host: mijn-tenant.nextcloud.example.com
  trustedDomains:
    - mijn-tenant.nextcloud.example.com

ingress:
  tls:
    - secretName: nextcloud-mijn-tenant-tls
      hosts:
        - mijn-tenant.nextcloud.example.com
  hosts:
    - host: mijn-tenant.nextcloud.example.com
      paths:
        - path: /
          pathType: Prefix

Commit en push β€” Argo CD maakt automatisch de Application aan.

πŸ“Š Monitoring & Alerting

Het platform is voorbereid op Prometheus monitoring:

  • ServiceMonitors voor Nextcloud, Redis, PgBouncer
  • Pod annotations voor metrics scraping
  • Aanbevolen alert rules in de documentatie

πŸ”„ Upgrade Strategie

  1. Update chart version in values/common.yaml
  2. Canary rollout β€” Wave 0 (canary) wordt eerst geupgrade
  3. Validatie β€” Health checks op canary
  4. Wave rollout β€” Overige tenants per wave
# Controleer status
argocd app get nc-canary

# Valideer na upgrade
kubectl exec -it -n nc-canary deploy/nextcloud -- php occ status

🀝 Bijdragen

  1. Fork de repository
  2. Maak een feature branch (git checkout -b feature/mijn-feature)
  3. Valideer je wijzigingen:
    ./scripts/validate-values.sh
    ./scripts/smoke-checks.sh
  4. Commit je changes (git commit -m 'feat: beschrijving')
  5. Push naar de branch (git push origin feature/mijn-feature)
  6. Open een Pull Request

πŸ“ License

Dit project is gelicenseerd onder de MIT License - zie het LICENSE bestand voor details.


Built with ❀️ for the CommonGround community

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors