diff --git a/argocd/applicationset.yaml b/argocd/applicationset.yaml index 9c8d219..d707a0b 100644 --- a/argocd/applicationset.yaml +++ b/argocd/applicationset.yaml @@ -21,6 +21,7 @@ spec: - path: "cloudflare-ddns" - path: "gitea" - path: "homeassistant" + - path: "nextcloud" template: metadata: name: "{{ index .path.segments 0 }}" diff --git a/gitlab/external-secret.yaml b/gitlab/external-secret.yaml index 4ec81b4..4e3ced8 100644 --- a/gitlab/external-secret.yaml +++ b/gitlab/external-secret.yaml @@ -3,12 +3,12 @@ kind: ExternalSecret metadata: name: gitlab-root-password spec: + refreshPolicy: CreatedOnce secretStoreRef: name: vault-backend kind: ClusterSecretStore target: name: gitlab-root-password - refreshPolicy: CreatedOnce dataFrom: - - extract: - key: gitlab + - extract: + key: gitlab diff --git a/nextcloud/certificate.yaml b/nextcloud/certificate.yaml new file mode 100644 index 0000000..9d78e94 --- /dev/null +++ b/nextcloud/certificate.yaml @@ -0,0 +1,11 @@ +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: nextcloud-tls +spec: + secretName: nextcloud-tls-secret + dnsNames: + - nextcloud.tap-tap.win # IMPORTANT: Change this + issuerRef: + name: letsencrypt-issuer # This is the ClusterIssuer you created + kind: ClusterIssuer diff --git a/nextcloud/config-map.yaml b/nextcloud/config-map.yaml new file mode 100644 index 0000000..2fcfb0b --- /dev/null +++ b/nextcloud/config-map.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: nextcloud-configmap +data: + MYSQL_PASSWORD: root + MYSQL_DATABASE: nextcloud + MYSQL_USER: nextcloud + MYSQL_HOST: maria-db-nextcloud-service + NEXTCLOUD_ADMIN_USER: admin + PHP_MEMORY_LIMIT: 8192M + PHP_UPLOAD_LIMIT: 102400M + PHP_MAX_EXECUTION_TIME: "7200" + TRUSTED_PROXIES: 10.42.0.0/16 + OVERWRITEPROTOCOL: https + OVERWRITECLIURL: http://nextcloud.tap-tap.win \ No newline at end of file diff --git a/nextcloud/deployment.yaml b/nextcloud/deployment.yaml new file mode 100644 index 0000000..f20e836 --- /dev/null +++ b/nextcloud/deployment.yaml @@ -0,0 +1,34 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nextcloud-deployment + labels: + app: nextcloud +spec: + replicas: 1 + selector: + matchLabels: + app: nextcloud + template: + metadata: + labels: + app: nextcloud + spec: + containers: + - name: nextcloud + image: nextcloud:34.0.3 + # image: nextcloud:33.0.3 + ports: + - containerPort: 80 + envFrom: + - secretRef: + name: nextcloud-secret + - configMapRef: + name: nextcloud-configmap + volumeMounts: + - name: nextcloud-volume + mountPath: /var/www/html + volumes: + - name: nextcloud-volume + hostPath: + path: /root/kubernetes/nextcloud/data/mount/html diff --git a/nextcloud/external-secrets.yaml b/nextcloud/external-secrets.yaml new file mode 100644 index 0000000..274589b --- /dev/null +++ b/nextcloud/external-secrets.yaml @@ -0,0 +1,14 @@ +apiVersion: external-secrets.io/v1 +kind: ExternalSecret +metadata: + name: nextcloud-external-secret +spec: + refreshPolicy: CreatedOnce + secretStoreRef: + name: vault-backend + kind: ClusterSecretStore + target: + name: nextcloud-secret + dataFrom: + - extract: + key: nextcloud diff --git a/nextcloud/ingress.yaml b/nextcloud/ingress.yaml new file mode 100644 index 0000000..037cfe3 --- /dev/null +++ b/nextcloud/ingress.yaml @@ -0,0 +1,23 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: nextcloud-ingress + annotations: + cert-manager.io/cluster-issuer: "letsencrypt-issuer" +spec: + ingressClassName: "traefik" + tls: + - hosts: + - nextcloud.tap-tap.win + secretName: nextcloud-tls-secret + rules: + - host: nextcloud.tap-tap.win + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: nextcloud-service + port: + number: 80 diff --git a/nextcloud/kustomization.yaml b/nextcloud/kustomization.yaml new file mode 100644 index 0000000..b88251c --- /dev/null +++ b/nextcloud/kustomization.yaml @@ -0,0 +1,15 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: nextcloud +resources: + - namespace.yaml + - external-secret.yaml + - config-map.yaml + - deployment.yaml + - service.yaml + - ingress.yaml + - maria-db-config-map.yaml + - maria-db-deployment.yaml + - maria-db-service.yaml + - redis-deployment.yaml + - redis-service.yaml diff --git a/nextcloud/maria-db-config-map.yaml b/nextcloud/maria-db-config-map.yaml new file mode 100644 index 0000000..dcb72f3 --- /dev/null +++ b/nextcloud/maria-db-config-map.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: maria-db-nextcloud-configmap +data: + MYSQL_ROOT_PASSWORD: root + MYSQL_PASSWORD: root + MYSQL_DATABASE: nextcloud + MYSQL_USER: nextcloud \ No newline at end of file diff --git a/nextcloud/maria-db-deployment.yaml b/nextcloud/maria-db-deployment.yaml new file mode 100644 index 0000000..256f79f --- /dev/null +++ b/nextcloud/maria-db-deployment.yaml @@ -0,0 +1,31 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: maria-db-nextcloud-deployment + labels: + app: maria-db-nextcloud +spec: + replicas: 1 + selector: + matchLabels: + app: maria-db-nextcloud + template: + metadata: + labels: + app: maria-db-nextcloud + spec: + containers: + - name: maria-db-nextcloud + image: mariadb:11.4.4 + envFrom: + - configMapRef: + name: maria-db-nextcloud-configmap + volumeMounts: + - name: maria-db-nextcloud-volume + mountPath: /var/lib/mysql + ports: + - containerPort: 3306 + volumes: + - name: maria-db-nextcloud-volume + hostPath: + path: /root/kubernetes/nextcloud/data/mysql diff --git a/nextcloud/maria-db-service.yaml b/nextcloud/maria-db-service.yaml new file mode 100644 index 0000000..000602d --- /dev/null +++ b/nextcloud/maria-db-service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: maria-db-nextcloud-service +spec: + selector: + app: maria-db-nextcloud + ports: + - protocol: TCP + port: 3306 + targetPort: 3306 diff --git a/nextcloud/namespace.yaml b/nextcloud/namespace.yaml new file mode 100644 index 0000000..ad36609 --- /dev/null +++ b/nextcloud/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: nextcloud \ No newline at end of file diff --git a/nextcloud/redis-deployment.yaml b/nextcloud/redis-deployment.yaml new file mode 100644 index 0000000..ef39492 --- /dev/null +++ b/nextcloud/redis-deployment.yaml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: redis-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: redis + template: + metadata: + labels: + app: redis + spec: + containers: + - name: redis + image: redis:7-alpine + ports: + - containerPort: 6379 diff --git a/nextcloud/redis-service.yaml b/nextcloud/redis-service.yaml new file mode 100644 index 0000000..11caa27 --- /dev/null +++ b/nextcloud/redis-service.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Service +metadata: + name: redis-service +spec: + ports: + - port: 6379 + targetPort: 6379 + selector: + app: redis diff --git a/nextcloud/service.yaml b/nextcloud/service.yaml new file mode 100644 index 0000000..50285ca --- /dev/null +++ b/nextcloud/service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: nextcloud-service +spec: + selector: + app: nextcloud + ports: + - protocol: TCP + port: 80 + targetPort: 80