add db for nextcloud
This commit is contained in:
49
cluster/apps/nextcloud/nextcloud-db.yml
Normal file
49
cluster/apps/nextcloud/nextcloud-db.yml
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nextcloud-db
|
||||
namespace: default
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: nextcloud-db
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: nextcloud-db
|
||||
spec:
|
||||
containers:
|
||||
- name: nextcloud-db
|
||||
image: mariadb:11.7.2
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
env:
|
||||
- name: MYSQL_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: nextcloud-db-secret
|
||||
key: root-password
|
||||
- name: MYSQL_DATABASE
|
||||
value: "nextcloud"
|
||||
- name: MYSQL_USER
|
||||
value: "nextcloud"
|
||||
- name: MYSQL_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: nextcloud-db-secret
|
||||
key: user-password
|
||||
volumeMounts:
|
||||
- name: nextcloud-db-storage
|
||||
mountPath: /var/lib/mysql
|
||||
- name: nextcloud-db-backup
|
||||
mountPath: /backup
|
||||
volumes:
|
||||
- name: nextcloud-db-storage
|
||||
nfs:
|
||||
server: 10.0.0.10
|
||||
path: /home/akshun/nextcloud/db
|
||||
- name: nextcloud-db-backup
|
||||
nfs:
|
||||
server: 10.0.0.10
|
||||
path: /home/akshun/nextcloud/backup
|
||||
@@ -43,3 +43,17 @@ spec:
|
||||
- protocol: TCP
|
||||
port: 443
|
||||
targetPort: 443
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: nextcloud-db-service
|
||||
namespace: default
|
||||
spec:
|
||||
selector:
|
||||
app: nextcloud-db
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 3306
|
||||
targetPort: 3306
|
||||
|
||||
@@ -13,6 +13,17 @@ spec:
|
||||
labels:
|
||||
app: nextcloud
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-db
|
||||
image: busybox
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
until nc -z -v -w30 nextcloud-db-service 3306; do
|
||||
echo "Waiting for database to be ready..."
|
||||
sleep 2
|
||||
done
|
||||
containers:
|
||||
- name: nextcloud
|
||||
image: lscr.io/linuxserver/nextcloud:31.0.4
|
||||
|
||||
Reference in New Issue
Block a user