Adds nextcloud app.

This commit is contained in:
2026-06-19 21:33:17 +00:00
parent 5e98b3fce6
commit 110eca06ce
10 changed files with 303 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
# Nextcloud
Nextcloud is a self-hosted file storage and collaboration platform — files, calendars, contacts, and more.
## Dependencies
- **PostgreSQL** - Database for storing metadata and configuration
- **Redis** - Used for caching and file locking
## Configuration
Key settings in `config.yaml`:
- **domain** - Where Nextcloud will be accessible
- **storage** - Persistent volume size (default: `5Gi`)
- **adminUser** - Admin account username (default: `admin`)
- **db.name** - Database name (default: `nextcloud`)
## First-Time Setup
1. Add and deploy the app:
```bash
wild app add nextcloud
wild app deploy nextcloud
```
2. Nextcloud initializes automatically on first start. Log in with:
- **Username**: value of `adminUser` in your config (default: `admin`)
- **Password**: value of `adminPassword` in your `secrets.yaml`
3. After logging in, install apps from the Nextcloud App Store (Files, Calendar, Contacts, Talk, etc.) via **Apps** in the top-right menu.
## Notes
- First startup may take a few minutes as Nextcloud runs database migrations
- The Nextcloud mobile and desktop clients can be configured to sync with your instance URL
- SMTP can be configured after login under **Settings → Administration → Basic settings → Email server**

View File

@@ -0,0 +1,59 @@
apiVersion: batch/v1
kind: Job
metadata:
name: nextcloud-db-init
labels:
component: db-init
spec:
template:
metadata:
labels:
component: db-init
spec:
restartPolicy: OnFailure
securityContext:
runAsNonRoot: true
runAsUser: 999
runAsGroup: 999
seccompProfile:
type: RuntimeDefault
containers:
- name: postgres-init
image: postgres:17
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: false
env:
- name: PGHOST
value: {{ .db.host }}
- name: PGUSER
value: postgres
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-secrets
key: postgres.password
- name: DB_NAME
value: {{ .db.name }}
- name: DB_USER
value: {{ .db.user }}
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-secrets
key: dbPassword
command:
- /bin/bash
- -c
- |
set -e
until pg_isready; do sleep 2; done
psql -c "CREATE DATABASE ${DB_NAME};" || echo "Database already exists"
psql -c "CREATE USER ${DB_USER} WITH PASSWORD '${DB_PASSWORD}';" || echo "User already exists"
psql -c "ALTER USER ${DB_USER} WITH PASSWORD '${DB_PASSWORD}';"
psql -c "GRANT ALL PRIVILEGES ON DATABASE ${DB_NAME} TO ${DB_USER};"
psql -d ${DB_NAME} -c "GRANT ALL ON SCHEMA public TO ${DB_USER};"
echo "Done"

View File

@@ -0,0 +1,106 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nextcloud
namespace: {{ .namespace }}
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
component: web
template:
metadata:
labels:
component: web
spec:
securityContext:
runAsUser: 0
runAsNonRoot: false
seccompProfile:
type: RuntimeDefault
containers:
- name: nextcloud
image: nextcloud:34.0.0-apache
ports:
- name: http
containerPort: 80
protocol: TCP
env:
- name: NEXTCLOUD_TRUSTED_DOMAINS
value: {{ .domain }}
- name: NEXTCLOUD_ADMIN_USER
value: {{ .adminUser }}
- name: NEXTCLOUD_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-secrets
key: adminPassword
- name: POSTGRES_DB
value: {{ .db.name }}
- name: POSTGRES_USER
value: {{ .db.user }}
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-secrets
key: dbPassword
- name: POSTGRES_HOST
value: {{ .db.host }}
- name: REDIS_HOST
value: {{ .redis.host }}
- name: REDIS_HOST_PORT
value: "6379"
- name: REDIS_HOST_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-secrets
key: redis.password
- name: OVERWRITEPROTOCOL
value: https
- name: OVERWRITECLIURL
value: https://{{ .domain }}
- name: TRUSTED_PROXIES
value: 10.0.0.0/8
resources:
limits:
cpu: 1000m
ephemeral-storage: 1Gi
memory: 1Gi
requests:
cpu: 50m
ephemeral-storage: 50Mi
memory: 256Mi
volumeMounts:
- name: nextcloud-data
mountPath: /var/www/html
livenessProbe:
httpGet:
path: /status.php
port: 80
httpHeaders:
- name: Host
value: {{ .domain }}
initialDelaySeconds: 120
timeoutSeconds: 5
periodSeconds: 30
failureThreshold: 6
readinessProbe:
httpGet:
path: /status.php
port: 80
httpHeaders:
- name: Host
value: {{ .domain }}
initialDelaySeconds: 60
timeoutSeconds: 3
periodSeconds: 15
failureThreshold: 3
securityContext:
readOnlyRootFilesystem: false
volumes:
- name: nextcloud-data
persistentVolumeClaim:
claimName: nextcloud-data
restartPolicy: Always

View File

@@ -0,0 +1,26 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nextcloud
namespace: {{ .namespace }}
annotations:
external-dns.alpha.kubernetes.io/target: {{ .externalDnsDomain }}
external-dns.alpha.kubernetes.io/cloudflare-proxied: "false"
external-dns.alpha.kubernetes.io/ttl: "60"
spec:
ingressClassName: traefik
rules:
- host: {{ .domain }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nextcloud
port:
number: 80
tls:
- hosts:
- {{ .domain }}
secretName: {{ .tlsSecretName }}

View File

@@ -0,0 +1,16 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: {{ .namespace }}
labels:
- includeSelectors: true
pairs:
app: nextcloud
managedBy: kustomize
partOf: wild-cloud
resources:
- namespace.yaml
- db-init-job.yaml
- deployment.yaml
- service.yaml
- ingress.yaml
- pvc.yaml

View File

@@ -0,0 +1,26 @@
version: 34.0.0-1
requires:
- name: postgres
- name: redis
defaultConfig:
namespace: nextcloud
externalDnsDomain: '{{ .cloud.domain }}'
domain: nextcloud.{{ .cloud.domain }}
tlsSecretName: wildcard-wild-cloud-tls
storage: 5Gi
adminUser: admin
db:
host: '{{ .apps.postgres.host }}'
port: '{{ .apps.postgres.port }}'
name: nextcloud
user: nextcloud
redis:
host: '{{ .apps.redis.host }}'
defaultSecrets:
- key: adminPassword
- key: dbPassword
- key: dbUrl
default: 'postgresql://{{ .app.db.user }}:{{ .secrets.dbPassword }}@{{ .app.db.host }}:{{ .app.db.port }}/{{ .app.db.name }}?sslmode=disable'
requiredSecrets:
- postgres.password
- redis.password

View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: {{ .namespace }}

View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nextcloud-data
namespace: {{ .namespace }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .storage }}

View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: nextcloud
namespace: {{ .namespace }}
spec:
selector:
component: web
ports:
- name: http
port: 80
targetPort: 80
protocol: TCP