Merge branch 'master' of ssh://repo.prod.meissa.de:2222/meissa/c4k-nextcloud
This commit is contained in:
commit
96343b9af5
18 changed files with 61 additions and 43 deletions
18
build.py
18
build.py
|
@ -41,18 +41,18 @@ def initialize(project):
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def test_clj(project):
|
def test_clj():
|
||||||
run("lein test", shell=True, check=True)
|
run("lein test", shell=True, check=True)
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def test_cljs(project):
|
def test_cljs():
|
||||||
run("shadow-cljs compile test", shell=True, check=True)
|
run("shadow-cljs compile test", shell=True, check=True)
|
||||||
run("node target/node-tests.js", shell=True, check=True)
|
run("node target/node-tests.js", shell=True, check=True)
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def test_schema(project):
|
def test_schema():
|
||||||
run("lein uberjar", shell=True, check=True)
|
run("lein uberjar", shell=True, check=True)
|
||||||
run(
|
run(
|
||||||
"java -jar target/uberjar/c4k-nextcloud-standalone.jar "
|
"java -jar target/uberjar/c4k-nextcloud-standalone.jar "
|
||||||
|
@ -63,6 +63,11 @@ def test_schema(project):
|
||||||
check=True,
|
check=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@task
|
||||||
|
def test():
|
||||||
|
test_clj()
|
||||||
|
test_cljs()
|
||||||
|
test_schema()
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def report_frontend(project):
|
def report_frontend(project):
|
||||||
|
@ -97,6 +102,7 @@ def package_frontend(project):
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def package_uberjar(project):
|
def package_uberjar(project):
|
||||||
|
run("lein uberjar", shell=True, check=True)
|
||||||
run(
|
run(
|
||||||
"sha256sum target/uberjar/c4k-nextcloud-standalone.jar > target/uberjar/c4k-nextcloud-standalone.jar.sha256",
|
"sha256sum target/uberjar/c4k-nextcloud-standalone.jar > target/uberjar/c4k-nextcloud-standalone.jar.sha256",
|
||||||
shell=True,
|
shell=True,
|
||||||
|
@ -221,7 +227,7 @@ def release(project):
|
||||||
def linttest(project, release_type):
|
def linttest(project, release_type):
|
||||||
build = get_devops_build(project)
|
build = get_devops_build(project)
|
||||||
build.update_release_type(release_type)
|
build.update_release_type(release_type)
|
||||||
test_clj(project)
|
test_clj()
|
||||||
test_cljs(project)
|
test_cljs()
|
||||||
test_schema(project)
|
test_schema()
|
||||||
lint(project)
|
lint(project)
|
||||||
|
|
|
@ -10,37 +10,37 @@
|
||||||
## Manual init the restic repository for the first time
|
## Manual init the restic repository for the first time
|
||||||
|
|
||||||
1. Scale backup-restore deployment up:
|
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
|
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:
|
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
|
## Manual backup the restic repository for the first time
|
||||||
|
|
||||||
1. Scale Cloud deployment down:
|
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:
|
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
|
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:
|
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:
|
1. Scale Cloud deployment up:
|
||||||
`kubectl scale deployment cloud-deployment --replicas=1`
|
`kubectl -n nextcloud scale deployment cloud-deployment --replicas=1`
|
||||||
|
|
||||||
|
|
||||||
## Manual restore
|
## Manual restore
|
||||||
|
|
||||||
1. Scale Cloud deployment down:
|
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:
|
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
|
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:
|
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:
|
5. Scale Cloud deployment up:
|
||||||
`kubectl scale deployment cloud-deployment --replicas=1`
|
`kubectl -n nextcloud scale deployment cloud-deployment --replicas=1`
|
||||||
|
|
|
@ -6,7 +6,7 @@ from ddadevops import *
|
||||||
name = "c4k-cloud"
|
name = "c4k-cloud"
|
||||||
MODULE = "backup"
|
MODULE = "backup"
|
||||||
PROJECT_ROOT_PATH = "../.."
|
PROJECT_ROOT_PATH = "../.."
|
||||||
version = "8.0.1-dev"
|
version = "8.0.8-dev"
|
||||||
|
|
||||||
|
|
||||||
@init
|
@init
|
||||||
|
|
|
@ -6,7 +6,7 @@ from ddadevops import *
|
||||||
name = 'c4k-cloud'
|
name = 'c4k-cloud'
|
||||||
MODULE = 'not_set'
|
MODULE = 'not_set'
|
||||||
PROJECT_ROOT_PATH = '../..'
|
PROJECT_ROOT_PATH = '../..'
|
||||||
version = "8.0.1-dev"
|
version = "8.0.8-dev"
|
||||||
|
|
||||||
@init
|
@init
|
||||||
def initialize(project):
|
def initialize(project):
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "c4k-nextcloud",
|
"name": "c4k-nextcloud",
|
||||||
"description": "Generate c4k yaml for a nextcloud deployment.",
|
"description": "Generate c4k yaml for a nextcloud deployment.",
|
||||||
"author": "meissa GmbH",
|
"author": "meissa GmbH",
|
||||||
"version": "8.0.1-SNAPSHOT",
|
"version": "8.0.8-SNAPSHOT",
|
||||||
"homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud#readme",
|
"homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud#readme",
|
||||||
"repository": "https://www.npmjs.com/package/c4k-nextcloud",
|
"repository": "https://www.npmjs.com/package/c4k-nextcloud",
|
||||||
"license": "APACHE2",
|
"license": "APACHE2",
|
||||||
|
|
10
project.clj
10
project.clj
|
@ -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"
|
:description "nextcloud c4k-installation package"
|
||||||
:url "https://domaindrivenarchitecture.org"
|
:url "https://domaindrivenarchitecture.org"
|
||||||
:license {:name "Apache License, Version 2.0"
|
:license {:name "Apache License, Version 2.0"
|
||||||
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
|
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
|
||||||
:dependencies [[org.clojure/clojure "1.11.1"]
|
:dependencies [[org.clojure/clojure "1.11.2"]
|
||||||
[org.clojure/tools.reader "1.4.0"]
|
[org.clojure/tools.reader "1.4.1"]
|
||||||
[org.domaindrivenarchitecture/c4k-common-clj "6.1.3"]
|
[org.domaindrivenarchitecture/c4k-common-clj "6.2.2"]
|
||||||
[hickory "0.7.1" :exclusions [viebel/codox-klipse-theme]]]
|
[hickory "0.7.1" :exclusions [viebel/codox-klipse-theme]]]
|
||||||
:target-path "target/%s/"
|
:target-path "target/%s/"
|
||||||
:source-paths ["src/main/cljc"
|
:source-paths ["src/main/cljc"
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
:main dda.c4k-nextcloud.uberjar
|
:main dda.c4k-nextcloud.uberjar
|
||||||
:uberjar-name "c4k-nextcloud-standalone.jar"
|
:uberjar-name "c4k-nextcloud-standalone.jar"
|
||||||
:dependencies [[org.clojure/tools.cli "1.1.230"]
|
: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]]
|
:exclusions [com.sun.mail/javax.mail]]
|
||||||
[org.slf4j/jcl-over-slf4j "2.0.12"]
|
[org.slf4j/jcl-over-slf4j "2.0.12"]
|
||||||
[com.github.clj-easy/graal-build-time "1.0.5"]]}}
|
[com.github.clj-easy/graal-build-time "1.0.5"]]}}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"src/test/cljc"
|
"src/test/cljc"
|
||||||
"src/test/cljs"
|
"src/test/cljs"
|
||||||
"src/test/resources"]
|
"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"]]
|
[hickory "0.7.1"]]
|
||||||
:builds {:frontend {:target :browser
|
:builds {:frontend {:target :browser
|
||||||
:modules {:main {:init-fn dda.c4k-nextcloud.browser/init}}
|
:modules {:main {:init-fn dda.c4k-nextcloud.browser/init}}
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
[dda.c4k-common.postgres :as postgres]
|
[dda.c4k-common.postgres :as postgres]
|
||||||
[dda.c4k-nextcloud.nextcloud :as nextcloud]
|
[dda.c4k-nextcloud.nextcloud :as nextcloud]
|
||||||
[dda.c4k-nextcloud.backup :as backup]
|
[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)
|
(def default-storage-class :local-path)
|
||||||
|
|
||||||
|
@ -23,17 +24,18 @@
|
||||||
(filter
|
(filter
|
||||||
#(not (nil? %))
|
#(not (nil? %))
|
||||||
(cm/concat-vec
|
(cm/concat-vec
|
||||||
[(postgres/generate-config {:postgres-size :8gb :db-name "nextcloud"})
|
(ns/generate (merge {:namespace "nextcloud"} config))
|
||||||
(postgres/generate-secret auth)
|
(postgres/generate {:postgres-size :8gb
|
||||||
(postgres/generate-pvc {:pv-storage-size-gb 50
|
:db-name "nextcloud"
|
||||||
:pvc-storage-class-name default-storage-class})
|
:pv-storage-size-gb 50
|
||||||
(postgres/generate-deployment)
|
:pvc-storage-class-name default-storage-class
|
||||||
(postgres/generate-service)
|
:namespace "nextcloud"}
|
||||||
(nextcloud/generate-secret auth)
|
auth)
|
||||||
|
[(nextcloud/generate-secret auth)
|
||||||
(nextcloud/generate-pvc (merge nextcloud-default-storage-config config))
|
(nextcloud/generate-pvc (merge nextcloud-default-storage-config config))
|
||||||
(nextcloud/generate-deployment config)
|
(nextcloud/generate-deployment config)
|
||||||
(nextcloud/generate-service)]
|
(nextcloud/generate-service)]
|
||||||
(nextcloud/generate-ingress-and-cert config)
|
(nextcloud/generate-ingress-and-cert (merge {:namespace "nextcloud"} config))
|
||||||
(when (:contains? config :restic-repository)
|
(when (:contains? config :restic-repository)
|
||||||
[(backup/generate-config config)
|
[(backup/generate-config config)
|
||||||
(backup/generate-secret auth)
|
(backup/generate-secret auth)
|
||||||
|
|
|
@ -2,6 +2,7 @@ apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: backup-restore
|
name: backup-restore
|
||||||
|
namespace: nextcloud
|
||||||
spec:
|
spec:
|
||||||
replicas: 0
|
replicas: 0
|
||||||
selector:
|
selector:
|
||||||
|
|
|
@ -2,6 +2,7 @@ apiVersion: v1
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
metadata:
|
metadata:
|
||||||
name: backup-config
|
name: backup-config
|
||||||
|
namespace: nextcloud
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: backup
|
app.kubernetes.io/name: backup
|
||||||
app.kubernetes.io/part-of: cloud
|
app.kubernetes.io/part-of: cloud
|
||||||
|
|
|
@ -2,6 +2,7 @@ apiVersion: batch/v1
|
||||||
kind: CronJob
|
kind: CronJob
|
||||||
metadata:
|
metadata:
|
||||||
name: cloud-backup
|
name: cloud-backup
|
||||||
|
namespace: nextcloud
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.part-of: cloud
|
app.kubernetes.part-of: cloud
|
||||||
spec:
|
spec:
|
||||||
|
|
|
@ -2,6 +2,7 @@ apiVersion: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
metadata:
|
metadata:
|
||||||
name: backup-secret
|
name: backup-secret
|
||||||
|
namespace: nextcloud
|
||||||
type: Opaque
|
type: Opaque
|
||||||
data:
|
data:
|
||||||
aws-access-key-id: "aws-access-key-id"
|
aws-access-key-id: "aws-access-key-id"
|
||||||
|
|
|
@ -2,6 +2,7 @@ apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: cloud-deployment
|
name: cloud-deployment
|
||||||
|
namespace: nextcloud
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
|
|
|
@ -2,6 +2,7 @@ apiVersion: v1
|
||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
metadata:
|
metadata:
|
||||||
name: cloud-pvc
|
name: cloud-pvc
|
||||||
|
namespace: nextcloud
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/application: cloud
|
app.kubernetes.io/application: cloud
|
||||||
spec:
|
spec:
|
||||||
|
|
|
@ -2,6 +2,7 @@ apiVersion: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
metadata:
|
metadata:
|
||||||
name: cloud-secret
|
name: cloud-secret
|
||||||
|
namespace: nextcloud
|
||||||
type: Opaque
|
type: Opaque
|
||||||
data:
|
data:
|
||||||
nextcloud-admin-user: "admin-user"
|
nextcloud-admin-user: "admin-user"
|
||||||
|
|
|
@ -2,6 +2,7 @@ apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: cloud-service
|
name: cloud-service
|
||||||
|
namespace: nextcloud
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: cloud-service
|
app.kubernetes.io/name: cloud-service
|
||||||
app.kubernetes.io/application: cloud
|
app.kubernetes.io/application: cloud
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
(deftest should-generate-secret
|
(deftest should-generate-secret
|
||||||
(is (= {:apiVersion "v1"
|
(is (= {:apiVersion "v1"
|
||||||
:kind "Secret"
|
:kind "Secret"
|
||||||
:metadata {:name "backup-secret"}
|
:metadata {:name "backup-secret", :namespace "nextcloud"}
|
||||||
:type "Opaque"
|
:type "Opaque"
|
||||||
:data
|
:data
|
||||||
{:aws-access-key-id "YXdzLWlk", :aws-secret-access-key "YXdzLXNlY3JldA==", :restic-password "cmVzdGljLXB3"}}
|
{:aws-access-key-id "YXdzLWlk", :aws-secret-access-key "YXdzLXNlY3JldA==", :restic-password "cmVzdGljLXB3"}}
|
||||||
|
@ -18,6 +18,7 @@
|
||||||
(is (= {:apiVersion "v1"
|
(is (= {:apiVersion "v1"
|
||||||
:kind "ConfigMap"
|
:kind "ConfigMap"
|
||||||
:metadata {:name "backup-config"
|
:metadata {:name "backup-config"
|
||||||
|
:namespace "nextcloud"
|
||||||
:labels {:app.kubernetes.io/name "backup"
|
:labels {:app.kubernetes.io/name "backup"
|
||||||
:app.kubernetes.io/part-of "cloud"}}
|
:app.kubernetes.io/part-of "cloud"}}
|
||||||
:data
|
:data
|
||||||
|
@ -27,7 +28,7 @@
|
||||||
(deftest should-generate-cron
|
(deftest should-generate-cron
|
||||||
(is (= {:apiVersion "batch/v1"
|
(is (= {:apiVersion "batch/v1"
|
||||||
:kind "CronJob"
|
: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
|
:spec
|
||||||
{:schedule "10 23 * * *"
|
{:schedule "10 23 * * *"
|
||||||
:successfulJobsHistoryLimit 1
|
:successfulJobsHistoryLimit 1
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
(deftest should-generate-secret
|
(deftest should-generate-secret
|
||||||
(is (= {:apiVersion "v1"
|
(is (= {:apiVersion "v1"
|
||||||
:kind "Secret"
|
:kind "Secret"
|
||||||
:metadata {:name "cloud-secret"}
|
:metadata {:name "cloud-secret", :namespace "nextcloud"}
|
||||||
:type "Opaque"
|
:type "Opaque"
|
||||||
:data
|
:data
|
||||||
{:nextcloud-admin-user "Y2xvdWRhZG1pbg=="
|
{:nextcloud-admin-user "Y2xvdWRhZG1pbg=="
|
||||||
|
@ -77,6 +77,7 @@
|
||||||
(is (= {:apiVersion "v1"
|
(is (= {:apiVersion "v1"
|
||||||
:kind "PersistentVolumeClaim"
|
:kind "PersistentVolumeClaim"
|
||||||
:metadata {:name "cloud-pvc"
|
:metadata {:name "cloud-pvc"
|
||||||
|
:namespace "nextcloud"
|
||||||
:labels {:app.kubernetes.io/application "cloud"}}
|
:labels {:app.kubernetes.io/application "cloud"}}
|
||||||
:spec {:storageClassName "local-path"
|
:spec {:storageClassName "local-path"
|
||||||
:accessModes ["ReadWriteOnce"]
|
:accessModes ["ReadWriteOnce"]
|
||||||
|
@ -86,7 +87,7 @@
|
||||||
(deftest should-generate-deployment
|
(deftest should-generate-deployment
|
||||||
(is (= {:apiVersion "apps/v1"
|
(is (= {:apiVersion "apps/v1"
|
||||||
:kind "Deployment"
|
:kind "Deployment"
|
||||||
:metadata {:name "cloud-deployment"}
|
:metadata {:name "cloud-deployment", :namespace "nextcloud"}
|
||||||
:spec
|
:spec
|
||||||
{:selector {:matchLabels #:app.kubernetes.io{:name "cloud-pod", :application "cloud"}}
|
{:selector {:matchLabels #:app.kubernetes.io{:name "cloud-pod", :application "cloud"}}
|
||||||
:strategy {:type "Recreate"}
|
: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"}}
|
{:metadata {:labels {:app "cloud-app", :app.kubernetes.io/name "cloud-pod", :app.kubernetes.io/application "cloud", :redeploy "v3"}}
|
||||||
:spec
|
:spec
|
||||||
{:containers
|
{:containers
|
||||||
[{:image "domaindrivenarchitecture/c4k-cloud:7.0.0"
|
[{:image "domaindrivenarchitecture/c4k-cloud:8.0.0"
|
||||||
:name "cloud-app"
|
:name "cloud-app"
|
||||||
:imagePullPolicy "IfNotPresent"
|
:imagePullPolicy "IfNotPresent"
|
||||||
:ports [{:containerPort 80}]
|
:ports [{:containerPort 80}]
|
||||||
|
|
Loading…
Reference in a new issue