removed mariadb from hel chart, after problems with continuous deploy

This commit is contained in:
2026-01-17 22:48:26 +00:00
parent 84111b37ce
commit 1fdcb42c77
9 changed files with 126 additions and 52 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
.env
localSettings
archive
tmp/**

View File

@@ -12,6 +12,7 @@ Using [NextCloud](https://nextcloud.com/)
- [delete file locks](#delete-file-locks)
- [Setup](#setup)
- [Requirements - infra](#requirements---infra)
- [mariadb database](#mariadb-database)
## command
@@ -62,6 +63,9 @@ su -s /bin/bash www-data -c "php occ files:repair-tree"
## Setup
- deploy mariadb
- nextcloud helm chart
```bash
./ops-scripts/apply-app.sh
```
@@ -71,3 +75,20 @@ su -s /bin/bash www-data -c "php occ files:repair-tree"
```bash
./ops-scripts/apply-infra.sh
```
## mariadb database
**Connect to maria db:**
``` bash
kubectl exec -it nextcloud-mariadb-0 -- mariadb -u nextcloud -h nextcloud-mariadb.cloud-limbosolutions-com.svc.cluster.local -p
```
**Restore database:**
``` bash
kubectl run mysql-client -i --rm \
--image=mysql:latest --restart=Never -- \
mysql -h nextcloud-mariadb.cloud-limbosolutions-com.svc.cluster.local \
-u ???? -p???? nextcloud < ./tmp/host-nextcloud-full-backup.sql
```

View File

@@ -35,26 +35,23 @@ spec:
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: nextcloud-db
key: db-username
name: nextcloud-mariadb
key: MARIADB_USER
- name: MYSQL_PWD
valueFrom:
secretKeyRef:
name: nextcloud-db
key: db-password
name: nextcloud-mariadb
key: MARIADB_PASSWORD
- name: MYSQL_DB
valueFrom:
secretKeyRef:
name: backup-secret
key: DB_NAME
name: nextcloud-mariadb
key: MARIADB_DATABASE
- name: MYSQL_HOST
valueFrom:
secretKeyRef:
name: backup-secret
key: DB_HOST
value: nextcloud-mariadb.cloud-limbosolutions-com.svc.cluster.local
volumeMounts:
- name: backup-var
@@ -122,7 +119,7 @@ spec:
- name: db-data
persistentVolumeClaim:
claimName: data-nextcloud-mariadb-0
claimName: mariadb-data-nextcloud-mariadb-0
- name: backup-var
emptyDir: {}

View File

@@ -1,13 +0,0 @@
apiVersion: v1
kind: Secret
metadata:
name: backup-secret
namespace: cloud-limbosolutions-com
data:
PBS_REPOSITORY: ${PBS_REPOSITORY}
PBS_PASSWORD: ${PBS_PASSWORD}
PBS_FINGERPRINT: ${PBS_FINGERPRINT}
DB_NAME: ${DB_NAME}
DB_HOST: ${DB_HOST}
# get sql client user and password from nextcloud secret

View File

@@ -1,17 +1,19 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- cronjobs/backups/backup-borg-offsite-cronjob.yaml
- cronjobs/backups/backup-pbs-cronjob.yaml
secretGenerator:
- name: gitea-backup
namespace: git-limbosolutions-com
- name: nextcloud-mariadb
envs:
- cronjobs/backups/.env.d/secrets
files:
- BORG_KEY=cronjobs/backups/.env.d/borg_key
- SSH_ID_RSA=cronjobs/backups/.env.d/id_rsa
- ./.env.d/nextcloud-mariadb.secrets
- name: backup-secret
envs:
- ./.env.d/pbs.secrets
resources:
- ./mariadb-deploy.yaml
- ./backup-cronjob.yaml
generatorOptions:
disableNameSuffixHash: true
disableNameSuffixHash: true
namespace: cloud-limbosolutions-com

View File

@@ -0,0 +1,69 @@
apiVersion: v1
kind: Service
metadata:
name: nextcloud-mariadb
namespace: cloud-limbosolutions-com
spec:
clusterIP: None
selector:
app: nextcloud-mariadb
ports:
- name: mysql
port: 3306
targetPort: 3306
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: nextcloud-mariadb
spec:
serviceName: nextcloud-mariadb
replicas: 1
selector:
matchLabels:
app: nextcloud-mariadb
template:
metadata:
labels:
app: nextcloud-mariadb
spec:
containers:
- name: mariadb
image: mariadb:11.4
env:
- name: MARIADB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-mariadb
key: MARIADB_ROOT_PASSWORD
- name: MARIADB_USER
valueFrom:
secretKeyRef:
name: nextcloud-mariadb
key: MARIADB_USER
- name: MARIADB_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-mariadb
key: MARIADB_PASSWORD
- name: MARIADB_DATABASE
valueFrom:
secretKeyRef:
name: nextcloud-mariadb
key: MARIADB_DATABASE
ports:
- containerPort: 3306
volumeMounts:
- name: mariadb-data
mountPath: /var/lib/mysql
volumeClaimTemplates:
- metadata:
name: mariadb-data
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 10Gi

View File

@@ -11,23 +11,18 @@ internalDatabase:
enabled: false
externalDatabase:
enabled: type
enabled: true
type: mysql
host: nextcloud-mariadb.cloud-limbosolutions-com.svc.cluster.local
user: "???"
password: "???"
database: "???"
port: 3306
mariadb:
enabled: true
architecture: standalone
primary:
persistence:
enabled: true
existingClaim: ""
storageClass: ""
accessMode: ReadWriteOnce
size: 8Gi
enabled: false
service:
type: ClusterIP
port: 8080

View File

@@ -2,12 +2,14 @@
set -e
echo "Executing app deploy."
#kubectl kustomize deploy/app | kubectl apply -f -
kubectl kustomize deploy/app | kubectl apply -f -
helm repo add nextcloud https://nextcloud.github.io/helm/ 2>/dev/null || true
helm repo update nextcloud
helm upgrade --install nextcloud nextcloud/nextcloud \
--values ./deploy/helm/values.yaml \
--values ./deploy/helm/values.local.yaml \
--namespace=cloud-limbosolutions-com
--values ./deploy/helm/values.yaml \
--values ./deploy/helm/values.local.yaml \
--namespace cloud-limbosolutions-com