Files
k8s-apps/nextcloud/nextcloud.yaml
2025-08-24 13:38:37 +02:00

227 lines
5.5 KiB
YAML

#apiVersion: v1
#kind: ConfigMap
#metadata:
# name: env
# namespace: nextcloud
#data:
# # file-like keys
# .env: |
# #from configmap
#
#---
apiVersion: v1
kind: ConfigMap
metadata:
name: startup
namespace: nextcloud
data:
startup.sh: |
#!/bin/sh
echo "startup..."
#if test ! -f "/data/startup.ran"; then
# echo "waiting 60s for startup..."
#else
# echo "startup ran already!"
#fi
apt update
docker-php-ext-install bz2
apt install smbclient libsmbclient-dev pecl install smbclient docker-php-ext-enable smbclient
apt install libgmp3-dev docker-php-ext-install gmp
apt install ffmpeg
apt install libmagickcore-6.q16-6-extra
echo "startup done."
#exit 123
---
apiVersion: v1
kind: ConfigMap
metadata:
name: after-ready
namespace: nextcloud
data:
script.sh: |
#!/bin/sh
echo "startup..."
#if test ! -f "/data/startup.ran"; then
# echo "waiting 60s for startup..."
#else
# echo "startup ran already!"
#fi
echo "startup done."
#exit 123
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: nextcloud
# Change "rook-ceph" provisioner prefix to match the operator namespace if needed
provisioner: rook-ceph.cephfs.csi.ceph.com
parameters:
# clusterID is the namespace where the rook cluster is running
# If you change this namespace, also change the namespace below where the secret namespaces are defined
clusterID: rook-ceph
# CephFS filesystem name into which the volume shall be created
fsName: nextcloud
# Ceph pool into which the volume shall be created
# Required for provisionVolume: "true"
pool: nextcloud-replicated
# The secrets contain Ceph admin credentials. These are generated automatically by the operator
# in the same namespace as the cluster.
csi.storage.k8s.io/provisioner-secret-name: rook-csi-cephfs-provisioner
csi.storage.k8s.io/provisioner-secret-namespace: rook-ceph
csi.storage.k8s.io/controller-expand-secret-name: rook-csi-cephfs-provisioner
csi.storage.k8s.io/controller-expand-secret-namespace: rook-ceph
csi.storage.k8s.io/node-stage-secret-name: rook-csi-cephfs-node
csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph
reclaimPolicy: Delete
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nextcloud
namespace: nextcloud
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 64Gi
storageClassName: nextcloud
---
#apiVersion: v1
#kind: PersistentVolumeClaim
#metadata:
# name: nextcloud-config
# namespace: nextcloud
#spec:
# accessModes:
# - ReadWriteMany
# resources:
# requests:
# storage: 128Mi
# storageClassName: nextcloud
#---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nextcloud
namespace: nextcloud
labels:
app: nextcloud
spec:
replicas: 1
selector:
matchLabels:
app: nextcloud
template:
metadata:
labels:
app: nextcloud
spec:
#initContainers:
#- name: copyappini
# image: linuxserver/bookstack:23.02.3
# command: ["bash", "-c", "mkdir -p /data/gitea/conf && cp -f /copy/app.ini /data/gitea/conf/app.ini"]
# volumeMounts:
# - mountPath: /data
# name: data
# - mountPath: /copy
# name: app-ini
containers:
- name: nextcloud
image: evokom/nextcloud-full
imagePullPolicy: IfNotPresent
ports:
- containerPort: 443
#lifecycle:
# postStart:
# exec:
# command:
# - "/bin/startup.sh"
env:
- name: PUID
value: "1000"
- name: PGID
value: "1000"
- name: MYSQL_DATABASE
value: "nextcloud"
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: nextcloud-db
key: username
optional: false
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-db
key: user.pw
optional: false
- name: MYSQL_HOST
value: "db"
- name: NEXTCLOUD_ADMIN_USER
value: admin
- name: NEXTCLOUD_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-admin
key: pw
optional: false
- name: NEXTCLOUD_DATA_DIR
value: "/var/www/html/data"
- name: NEXTCLOUD_TRUSTED_DOMAINS
value: "nextcloud.undercloud.cf nextcloud.nextcloud.svc.k8aux.undercloud.cf"
volumeMounts:
- mountPath: "/var/www/html"
name: nextcloud
#- mountPath: /startup.sh
# name: startup
# subPath: startup.sh
#- mountPath: "/config/www/.env"
# name: env
# subPath: .env
volumes:
- name: nextcloud
persistentVolumeClaim:
claimName: nextcloud
#- name: env
# configMap:
# name: env
# items:
# - key: ".env"
# path: ".env"
- name: startup
configMap:
name: startup
defaultMode: 0700
items:
- key: "startup.sh"
path: "startup.sh"
---
apiVersion: v1
kind: Service
metadata:
name: nextcloud
namespace: nextcloud
labels:
app: nextcloud
spec:
internalTrafficPolicy: Cluster
ipFamilies:
- IPv6
- IPv4
ipFamilyPolicy: PreferDualStack
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
selector:
app: nextcloud
sessionAffinity: None
type: ClusterIP