Merge branch 'master' of ssh://repo.prod.meissa.de:2222/meissa/c4k-nextcloud

This commit is contained in:
Mirco 2024-04-12 11:27:28 +02:00
commit 96343b9af5
18 changed files with 61 additions and 43 deletions

View file

@ -41,18 +41,18 @@ def initialize(project):
@task
def test_clj(project):
def test_clj():
run("lein test", shell=True, check=True)
@task
def test_cljs(project):
def test_cljs():
run("shadow-cljs compile test", shell=True, check=True)
run("node target/node-tests.js", shell=True, check=True)
@task
def test_schema(project):
def test_schema():
run("lein uberjar", shell=True, check=True)
run(
"java -jar target/uberjar/c4k-nextcloud-standalone.jar "
@ -63,6 +63,11 @@ def test_schema(project):
check=True,
)
@task
def test():
test_clj()
test_cljs()
test_schema()
@task
def report_frontend(project):
@ -97,6 +102,7 @@ def package_frontend(project):
@task
def package_uberjar(project):
run("lein uberjar", shell=True, check=True)
run(
"sha256sum target/uberjar/c4k-nextcloud-standalone.jar > target/uberjar/c4k-nextcloud-standalone.jar.sha256",
shell=True,
@ -221,7 +227,7 @@ def release(project):
def linttest(project, release_type):
build = get_devops_build(project)
build.update_release_type(release_type)
test_clj(project)
test_cljs(project)
test_schema(project)
test_clj()
test_cljs()
test_schema()
lint(project)

View file

@ -10,37 +10,37 @@
## Manual init the restic repository for the first time
1. Scale backup-restore deployment up:
`kubectl scale deployment backup-restore --replicas=1`
`kubectl -n nextcloud scale deployment backup-restore --replicas=1`
1. exec into pod and execute restore pod
`kubectl exec -it backup-restore -- /usr/local/bin/init.sh`
`kubectl -n nextcloud exec -it backup-restore -- /usr/local/bin/init.sh`
1. Scale backup-restore deployment down:
`kubectl scale deployment backup-restore --replicas=0`
`kubectl -n nextcloud scale deployment backup-restore --replicas=0`
## Manual backup the restic repository for the first time
1. Scale Cloud deployment down:
`kubectl scale deployment cloud-deployment --replicas=0`
`kubectl -n nextcloud scale deployment cloud-deployment --replicas=0`
1. Scale backup-restore deployment up:
`kubectl scale deployment backup-restore --replicas=1`
`kubectl -n nextcloud scale deployment backup-restore --replicas=1`
1. exec into pod and execute restore pod
`kubectl exec -it backup-restore -- /usr/local/bin/backup.sh`
`kubectl -n nextcloud exec -it backup-restore -- /usr/local/bin/backup.sh`
1. Scale backup-restore deployment down:
`kubectl scale deployment backup-restore --replicas=0`
`kubectl -n nextcloud scale deployment backup-restore --replicas=0`
1. Scale Cloud deployment up:
`kubectl scale deployment cloud-deployment --replicas=1`
`kubectl -n nextcloud scale deployment cloud-deployment --replicas=1`
## Manual restore
1. Scale Cloud deployment down:
`kubectl scale deployment cloud-deployment --replicas=0`
`kubectl -n nextcloud scale deployment cloud-deployment --replicas=0`
2. Scale backup-restore deployment up:
`kubectl scale deployment backup-restore --replicas=1`
`kubectl -n nextcloud scale deployment backup-restore --replicas=1`
3. exec into pod and execute restore pod
`kubectl exec -it backup-restore -- /usr/local/bin/restore.sh`
`kubectl -n nextcloud exec -it backup-restore -- /usr/local/bin/restore.sh`
4. Scale backup-restore deployment down:
`kubectl scale deployment backup-restore --replicas=0`
`kubectl -n nextcloud scale deployment backup-restore --replicas=0`
5. Scale Cloud deployment up:
`kubectl scale deployment cloud-deployment --replicas=1`
`kubectl -n nextcloud scale deployment cloud-deployment --replicas=1`

View file

@ -6,7 +6,7 @@ from ddadevops import *
name = "c4k-cloud"
MODULE = "backup"
PROJECT_ROOT_PATH = "../.."
version = "8.0.1-dev"
version = "8.0.8-dev"
@init

View file

@ -6,7 +6,7 @@ from ddadevops import *
name = 'c4k-cloud'
MODULE = 'not_set'
PROJECT_ROOT_PATH = '../..'
version = "8.0.1-dev"
version = "8.0.8-dev"
@init
def initialize(project):

View file

@ -2,7 +2,7 @@
"name": "c4k-nextcloud",
"description": "Generate c4k yaml for a nextcloud deployment.",
"author": "meissa GmbH",
"version": "8.0.1-SNAPSHOT",
"version": "8.0.8-SNAPSHOT",
"homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud#readme",
"repository": "https://www.npmjs.com/package/c4k-nextcloud",
"license": "APACHE2",

View file

@ -1,11 +1,11 @@
(defproject org.domaindrivenarchitecture/c4k-nextcloud "8.0.1-SNAPSHOT"
(defproject org.domaindrivenarchitecture/c4k-nextcloud "8.0.8-SNAPSHOT"
:description "nextcloud c4k-installation package"
:url "https://domaindrivenarchitecture.org"
:license {:name "Apache License, Version 2.0"
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
:dependencies [[org.clojure/clojure "1.11.1"]
[org.clojure/tools.reader "1.4.0"]
[org.domaindrivenarchitecture/c4k-common-clj "6.1.3"]
:dependencies [[org.clojure/clojure "1.11.2"]
[org.clojure/tools.reader "1.4.1"]
[org.domaindrivenarchitecture/c4k-common-clj "6.2.2"]
[hickory "0.7.1" :exclusions [viebel/codox-klipse-theme]]]
:target-path "target/%s/"
:source-paths ["src/main/cljc"
@ -23,7 +23,7 @@
:main dda.c4k-nextcloud.uberjar
:uberjar-name "c4k-nextcloud-standalone.jar"
:dependencies [[org.clojure/tools.cli "1.1.230"]
[ch.qos.logback/logback-classic "1.5.0"
[ch.qos.logback/logback-classic "1.5.3"
:exclusions [com.sun.mail/javax.mail]]
[org.slf4j/jcl-over-slf4j "2.0.12"]
[com.github.clj-easy/graal-build-time "1.0.5"]]}}

View file

@ -4,7 +4,7 @@
"src/test/cljc"
"src/test/cljs"
"src/test/resources"]
:dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "6.1.3"]
:dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "6.2.2"]
[hickory "0.7.1"]]
:builds {:frontend {:target :browser
:modules {:main {:init-fn dda.c4k-nextcloud.browser/init}}

View file

@ -8,7 +8,8 @@
[dda.c4k-common.postgres :as postgres]
[dda.c4k-nextcloud.nextcloud :as nextcloud]
[dda.c4k-nextcloud.backup :as backup]
[dda.c4k-common.monitoring :as mon]))
[dda.c4k-common.monitoring :as mon]
[dda.c4k-common.namespace :as ns]))
(def default-storage-class :local-path)
@ -23,17 +24,18 @@
(filter
#(not (nil? %))
(cm/concat-vec
[(postgres/generate-config {:postgres-size :8gb :db-name "nextcloud"})
(postgres/generate-secret auth)
(postgres/generate-pvc {:pv-storage-size-gb 50
:pvc-storage-class-name default-storage-class})
(postgres/generate-deployment)
(postgres/generate-service)
(nextcloud/generate-secret auth)
(ns/generate (merge {:namespace "nextcloud"} config))
(postgres/generate {:postgres-size :8gb
:db-name "nextcloud"
:pv-storage-size-gb 50
:pvc-storage-class-name default-storage-class
:namespace "nextcloud"}
auth)
[(nextcloud/generate-secret auth)
(nextcloud/generate-pvc (merge nextcloud-default-storage-config config))
(nextcloud/generate-deployment config)
(nextcloud/generate-service)]
(nextcloud/generate-ingress-and-cert config)
(nextcloud/generate-ingress-and-cert (merge {:namespace "nextcloud"} config))
(when (:contains? config :restic-repository)
[(backup/generate-config config)
(backup/generate-secret auth)

View file

@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: backup-restore
namespace: nextcloud
spec:
replicas: 0
selector:

View file

@ -2,6 +2,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: backup-config
namespace: nextcloud
labels:
app.kubernetes.io/name: backup
app.kubernetes.io/part-of: cloud

View file

@ -2,6 +2,7 @@ apiVersion: batch/v1
kind: CronJob
metadata:
name: cloud-backup
namespace: nextcloud
labels:
app.kubernetes.part-of: cloud
spec:

View file

@ -2,6 +2,7 @@ apiVersion: v1
kind: Secret
metadata:
name: backup-secret
namespace: nextcloud
type: Opaque
data:
aws-access-key-id: "aws-access-key-id"

View file

@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: cloud-deployment
namespace: nextcloud
spec:
selector:
matchLabels:

View file

@ -2,6 +2,7 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: cloud-pvc
namespace: nextcloud
labels:
app.kubernetes.io/application: cloud
spec:

View file

@ -2,6 +2,7 @@ apiVersion: v1
kind: Secret
metadata:
name: cloud-secret
namespace: nextcloud
type: Opaque
data:
nextcloud-admin-user: "admin-user"

View file

@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: cloud-service
namespace: nextcloud
labels:
app.kubernetes.io/name: cloud-service
app.kubernetes.io/application: cloud

View file

@ -8,7 +8,7 @@
(deftest should-generate-secret
(is (= {:apiVersion "v1"
:kind "Secret"
:metadata {:name "backup-secret"}
:metadata {:name "backup-secret", :namespace "nextcloud"}
:type "Opaque"
:data
{:aws-access-key-id "YXdzLWlk", :aws-secret-access-key "YXdzLXNlY3JldA==", :restic-password "cmVzdGljLXB3"}}
@ -18,6 +18,7 @@
(is (= {:apiVersion "v1"
:kind "ConfigMap"
:metadata {:name "backup-config"
:namespace "nextcloud"
:labels {:app.kubernetes.io/name "backup"
:app.kubernetes.io/part-of "cloud"}}
:data
@ -27,7 +28,7 @@
(deftest should-generate-cron
(is (= {:apiVersion "batch/v1"
:kind "CronJob"
:metadata {:name "cloud-backup", :labels {:app.kubernetes.part-of "cloud"}}
:metadata {:name "cloud-backup", :namespace "nextcloud", :labels {:app.kubernetes.part-of "cloud"}}
:spec
{:schedule "10 23 * * *"
:successfulJobsHistoryLimit 1

View file

@ -23,7 +23,7 @@
(deftest should-generate-secret
(is (= {:apiVersion "v1"
:kind "Secret"
:metadata {:name "cloud-secret"}
:metadata {:name "cloud-secret", :namespace "nextcloud"}
:type "Opaque"
:data
{:nextcloud-admin-user "Y2xvdWRhZG1pbg=="
@ -77,7 +77,8 @@
(is (= {:apiVersion "v1"
:kind "PersistentVolumeClaim"
:metadata {:name "cloud-pvc"
:labels {:app.kubernetes.io/application "cloud"}}
:namespace "nextcloud"
:labels {:app.kubernetes.io/application "cloud"}}
:spec {:storageClassName "local-path"
:accessModes ["ReadWriteOnce"]
:resources {:requests {:storage "50Gi"}}}}
@ -86,7 +87,7 @@
(deftest should-generate-deployment
(is (= {:apiVersion "apps/v1"
:kind "Deployment"
:metadata {:name "cloud-deployment"}
:metadata {:name "cloud-deployment", :namespace "nextcloud"}
:spec
{:selector {:matchLabels #:app.kubernetes.io{:name "cloud-pod", :application "cloud"}}
:strategy {:type "Recreate"}
@ -94,7 +95,7 @@
{:metadata {:labels {:app "cloud-app", :app.kubernetes.io/name "cloud-pod", :app.kubernetes.io/application "cloud", :redeploy "v3"}}
:spec
{:containers
[{:image "domaindrivenarchitecture/c4k-cloud:7.0.0"
[{:image "domaindrivenarchitecture/c4k-cloud:8.0.0"
:name "cloud-app"
:imagePullPolicy "IfNotPresent"
:ports [{:containerPort 80}]