refactoring and documentation
This commit is contained in:
36
README.md
36
README.md
@@ -4,9 +4,16 @@ Welcome to public repository of [https://cloud.limbosolutions.com](https://cloud
|
|||||||
|
|
||||||
Using [NextCloud](https://nextcloud.com/)
|
Using [NextCloud](https://nextcloud.com/)
|
||||||
|
|
||||||
## kubernetes
|
- [Setup](#setup)
|
||||||
|
- [kubernetes Namespace](#kubernetes-namespace)
|
||||||
|
- [Add helm chart](#add-helm-chart)
|
||||||
|
- [Update Helm chart](#update-helm-chart)
|
||||||
|
- [Install / Update](#install--update)
|
||||||
|
- [backups](#backups)
|
||||||
|
|
||||||
### namespace
|
## Setup
|
||||||
|
|
||||||
|
### kubernetes Namespace
|
||||||
|
|
||||||
``` yaml
|
``` yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
@@ -17,19 +24,34 @@ metadata:
|
|||||||
name: cloud-limbosolutions-com
|
name: cloud-limbosolutions-com
|
||||||
```
|
```
|
||||||
|
|
||||||
### helm chart - nextcloud
|
### Add helm chart
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
helm repo add nextcloud https://nextcloud.github.io/helm/
|
helm repo add nextcloud https://nextcloud.github.io/helm/
|
||||||
|
```
|
||||||
|
|
||||||
|
### Update Helm chart
|
||||||
|
|
||||||
|
```bash
|
||||||
helm repo update
|
helm repo update
|
||||||
```
|
```
|
||||||
|
|
||||||
Install/Upgrade Helm Chart
|
### Install / Update
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
./nexcloud/helm-up.sh
|
helm upgrade --install nextcloud nextcloud/nextcloud \
|
||||||
|
--values ./nextcloud/values.yaml \
|
||||||
|
--values ./nextcloud/values.local.yaml \
|
||||||
|
--namespace=cloud-limbosolutions-com
|
||||||
```
|
```
|
||||||
|
|
||||||
## backup
|
## backups
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
set -a
|
||||||
|
source ./jobs/backup/.env
|
||||||
|
set +a
|
||||||
|
envsubst < ./jobs/backup/secret.yaml | kubectl apply -f -
|
||||||
|
kubectl apply -f ./jobs/backup/backup-cronjob.yaml
|
||||||
|
```
|
||||||
|
|
||||||
[kubernets cron job](./jobs/backup)
|
|
||||||
59
ingress.yml
59
ingress.yml
@@ -1,59 +0,0 @@
|
|||||||
# not in use. remove and add to kb
|
|
||||||
# ingress exposing and endpoint to an docker running on another server without kubernets
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Endpoints
|
|
||||||
metadata:
|
|
||||||
name: cloud-limbosolutions-com-service
|
|
||||||
namespace: cloud-limbosolutions-com
|
|
||||||
subsets:
|
|
||||||
- addresses:
|
|
||||||
- ip: 192.168.13.2
|
|
||||||
ports:
|
|
||||||
- name: app
|
|
||||||
port: 4000
|
|
||||||
protocol: TCP
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: cloud-limbosolutions-com-service
|
|
||||||
namespace: cloud-limbosolutions-com
|
|
||||||
spec:
|
|
||||||
ports:
|
|
||||||
- name: app
|
|
||||||
port: 4000
|
|
||||||
protocol: TCP
|
|
||||||
targetPort: 4000
|
|
||||||
clusterIP: None
|
|
||||||
type: ClusterIP
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
apiVersion: networking.k8s.io/v1
|
|
||||||
kind: Ingress
|
|
||||||
metadata:
|
|
||||||
name: cloud-limbosolutions-com-ingress
|
|
||||||
namespace: cloud-limbosolutions-com
|
|
||||||
# annotations:
|
|
||||||
# cert-manager.io/cluster-issuer: "letsencrypt-staging"
|
|
||||||
# traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
|
||||||
spec:
|
|
||||||
ingressClassName: traefik
|
|
||||||
# tls:
|
|
||||||
# - hosts:
|
|
||||||
# - minio.example.com
|
|
||||||
# secretName: tls-example-com
|
|
||||||
rules:
|
|
||||||
- host: cloud.icharus.dev.lan
|
|
||||||
http:
|
|
||||||
paths:
|
|
||||||
- backend:
|
|
||||||
service:
|
|
||||||
name: cloud-limbosolutions-com-service
|
|
||||||
port:
|
|
||||||
number: 4000
|
|
||||||
path: /
|
|
||||||
pathType: Prefix
|
|
||||||
@@ -24,14 +24,10 @@ spec:
|
|||||||
command: ["bash", "-c"]
|
command: ["bash", "-c"]
|
||||||
args:
|
args:
|
||||||
- |
|
- |
|
||||||
#while true; do sleep 30; done
|
set -e
|
||||||
mkdir -p /data/mariadb-export
|
mkdir -p /data/mariadb-export
|
||||||
echo "TRACE: Exporting database"
|
echo "TRACE: Exporting database"
|
||||||
mysqldump --column-statistics=0 -u ${MYSQL_USER} -h ${MYSQL_HOST} ${MYSQL_DB} > /data/mariadb-export/backup.sql
|
mysqldump --column-statistics=0 -u ${MYSQL_USER} -h ${MYSQL_HOST} ${MYSQL_DB} > /data/mariadb-export/backup.sql
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "ERROR: Exporting database failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "TRACE: Exporting database finished"
|
echo "TRACE: Exporting database finished"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@@ -90,8 +86,11 @@ spec:
|
|||||||
command: ["bash", "-c"]
|
command: ["bash", "-c"]
|
||||||
args:
|
args:
|
||||||
- |
|
- |
|
||||||
proxmox-backup-client backup nextcloud-html.pxar:/data/nextcloud-html nextcloud-data.pxar:/data/nextcloud-data mariadb-data.pxar:/data/mariadb-data mariadb-export.pxar:/data/mariadb-export --include-dev /data/nextcloud-html --include-dev /data/nextcloud-data --include-dev /data/mariadb-data --include-dev /data/mariadb-export --backup-id "nextcloud-full" -ns cloud.limbosolutions.com
|
set -e
|
||||||
echo "INFO: Backup cloud.limbosolutions.com finished"
|
SCRIPT_START_TIME=$(date +%s)
|
||||||
|
proxmox-backup-client backup nextcloud-html.pxar:/data/nextcloud-html nextcloud-data.pxar:/data/nextcloud-data mariadb-data.pxar:/data/mariadb-data mariadb-export.pxar:/data/mariadb-export --include-dev /data/nextcloud-html --include-dev /data/nextcloud-data --include-dev /data/mariadb-data --include-dev /data/mariadb-export --backup-id "nextcloud-full" -ns cloud.limbosolutions.com && \
|
||||||
|
SCRIPT_DURATION=$(($(date +%s) - SCRIPT_START_TIME)) && \
|
||||||
|
echo "INFO: Finished Backup of cloud.limbosolutions.com ($((SCRIPT_DURATION / 60 / 60)):$((SCRIPT_DURATION / 60)):$((SCRIPT_DURATION % 60)))"
|
||||||
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: nextcloud-html
|
- name: nextcloud-html
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
#/bin/bash
|
|
||||||
|
|
||||||
# set source env variables
|
|
||||||
. ./.env
|
|
||||||
export $(cut -d= -f1 ./.env)
|
|
||||||
|
|
||||||
|
|
||||||
envsubst < secret.yaml | kubectl apply -f -
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Pod
|
|
||||||
metadata:
|
|
||||||
name: mariadb-client-test-pod
|
|
||||||
namespace: cloud-limbosolutions-com
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: mariadb-client
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
memory: "512Mi"
|
|
||||||
cpu: "500m"
|
|
||||||
requests:
|
|
||||||
memory: "256Mi"
|
|
||||||
cpu: "250m"
|
|
||||||
image: bitnami/mysql:latest
|
|
||||||
command: ["bash", "-c"]
|
|
||||||
args:
|
|
||||||
- |
|
|
||||||
#while true; do sleep 30; done
|
|
||||||
mkdir -p /data/mariadb-export
|
|
||||||
echo "INFO: Exporting database"
|
|
||||||
mysqldump --column-statistics=0 -u ${DB_USER} -p${DB_PASSWORD} -h ${DB_HOST} ${DB_NAME} > /data/mariadb-export/backup.sql
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "ERROR: Exporting database failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "INFO: Exporting database finished"
|
|
||||||
|
|
||||||
env:
|
|
||||||
- name: DB_USER
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: nextcloud-db
|
|
||||||
key: db-username
|
|
||||||
|
|
||||||
- name: DB_PASSWORD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: nextcloud-db
|
|
||||||
key: db-password
|
|
||||||
|
|
||||||
- name: DB_NAME
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: backup-secret
|
|
||||||
key: DB_NAME
|
|
||||||
|
|
||||||
- name: DB_HOST
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: backup-secret
|
|
||||||
key: DB_HOST
|
|
||||||
|
|
||||||
volumeMounts:
|
|
||||||
- name: backup-var
|
|
||||||
mountPath: /data/mariadb-export
|
|
||||||
subPath: mariadb-export
|
|
||||||
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
- name: backup-var
|
|
||||||
emptyDir: {}
|
|
||||||
2
local/.gitignore
vendored
2
local/.gitignore
vendored
@@ -1,2 +0,0 @@
|
|||||||
**
|
|
||||||
!.gitignore
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
helm upgrade --install nextcloud nextcloud/nextcloud \
|
|
||||||
--values ./values.yaml \
|
|
||||||
--values ./values.local.yaml \
|
|
||||||
--namespace=cloud-limbosolutions-com
|
|
||||||
Reference in New Issue
Block a user