first working version
This commit is contained in:
parent
23619a7a61
commit
655a84a5fc
28 changed files with 44 additions and 157 deletions
|
@ -47,7 +47,7 @@ test-schema:
|
|||
stage: build_and_test
|
||||
script:
|
||||
- lein uberjar
|
||||
- java -jar target/uberjar/c4k-cloud-standalone.jar valid-config.edn valid-auth.edn | kubeconform --kubernetes-version 1.19.0 --strict --skip Certificate -
|
||||
- java -jar target/uberjar/c4k-nextcloud-standalone.jar valid-config.edn valid-auth.edn | kubeconform --kubernetes-version 1.19.0 --strict --skip Certificate -
|
||||
artifacts:
|
||||
paths:
|
||||
- target/uberjar
|
||||
|
@ -68,9 +68,9 @@ test-schema:
|
|||
script:
|
||||
- mkdir -p target/frontend-build
|
||||
- shadow-cljs release frontend
|
||||
- cp public/js/main.js target/frontend-build/c4k-cloud.js
|
||||
- sha256sum target/frontend-build/c4k-cloud.js > target/frontend-build/c4k-cloud.js.sha256
|
||||
- sha512sum target/frontend-build/c4k-cloud.js > target/frontend-build/c4k-cloud.js.sha512
|
||||
- cp public/js/main.js target/frontend-build/c4k-nextcloud.js
|
||||
- sha256sum target/frontend-build/c4k-nextcloud.js > target/frontend-build/c4k-nextcloud.js.sha256
|
||||
- sha512sum target/frontend-build/c4k-nextcloud.js > target/frontend-build/c4k-nextcloud.js.sha512
|
||||
artifacts:
|
||||
paths:
|
||||
- target/frontend-build
|
||||
|
@ -79,8 +79,8 @@ package-uberjar:
|
|||
<<: *clj
|
||||
stage: package
|
||||
script:
|
||||
- sha256sum target/uberjar/c4k-cloud-standalone.jar > target/uberjar/c4k-cloud-standalone.jar.sha256
|
||||
- sha512sum target/uberjar/c4k-cloud-standalone.jar > target/uberjar/c4k-cloud-standalone.jar.sha512
|
||||
- sha256sum target/uberjar/c4k-nextcloud-standalone.jar > target/uberjar/c4k-nextcloud-standalone.jar.sha256
|
||||
- sha512sum target/uberjar/c4k-nextcloud-standalone.jar > target/uberjar/c4k-nextcloud-standalone.jar.sha512
|
||||
artifacts:
|
||||
paths:
|
||||
- target/uberjar
|
||||
|
@ -117,20 +117,20 @@ release:
|
|||
- apk --no-cache add curl
|
||||
- |
|
||||
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
|
||||
--assets-link "{\"name\":\"c4k-cloud-standalone.jar\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-cloud-standalone.jar\"}" \
|
||||
--assets-link "{\"name\":\"c4k-cloud-standalone.jar.sha256\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-cloud-standalone.jar.sha256\"}" \
|
||||
--assets-link "{\"name\":\"c4k-cloud-standalone.jar.sha512\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-cloud-standalone.jar.sha512\"}" \
|
||||
--assets-link "{\"name\":\"c4k-cloud.js\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-cloud.js\"}" \
|
||||
--assets-link "{\"name\":\"c4k-cloud.js.sha256\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-cloud.js.sha256\"}" \
|
||||
--assets-link "{\"name\":\"c4k-cloud.js.sha512\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-cloud.js.sha512\"}" \
|
||||
--assets-link "{\"name\":\"c4k-nextcloud-standalone.jar\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-nextcloud-standalone.jar\"}" \
|
||||
--assets-link "{\"name\":\"c4k-nextcloud-standalone.jar.sha256\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-nextcloud-standalone.jar.sha256\"}" \
|
||||
--assets-link "{\"name\":\"c4k-nextcloud-standalone.jar.sha512\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-nextcloud-standalone.jar.sha512\"}" \
|
||||
--assets-link "{\"name\":\"c4k-nextcloud.js\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-nextcloud.js\"}" \
|
||||
--assets-link "{\"name\":\"c4k-nextcloud.js.sha256\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-nextcloud.js.sha256\"}" \
|
||||
--assets-link "{\"name\":\"c4k-nextcloud.js.sha512\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-nextcloud.js.sha512\"}" \
|
||||
|
||||
cloud-image-test-publish:
|
||||
nextcloud-image-test-publish:
|
||||
image: domaindrivenarchitecture/devops-build:latest
|
||||
stage: image
|
||||
rules:
|
||||
- if: '$CI_COMMIT_TAG != null'
|
||||
script:
|
||||
- cd infrastructure/docker-cloud && pyb image test publish
|
||||
- cd infrastructure/docker-nextcloud && pyb image test publish
|
||||
|
||||
backup-image-test-publish:
|
||||
image: domaindrivenarchitecture/devops-build:latest
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
{
|
||||
"name": "c4k-cloud",
|
||||
"name": "c4k-nextcloud",
|
||||
"description": "Generate c4k yaml for a nextcloud deployment.",
|
||||
"author": "meissa GmbH",
|
||||
"version": "0.1.3-SNAPSHOT",
|
||||
"homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud#readme",
|
||||
"repository": "https://www.npmjs.com/package/c4k-nextcloud",
|
||||
"license": "APACHE2",
|
||||
"main": "c4k-cloud.js",
|
||||
"main": "c4k-nextcloud.js",
|
||||
"bin": {
|
||||
"c4k-cloud": "./c4k-cloud.js"
|
||||
"c4k-nextcloud": "./c4k-nextcloud.js"
|
||||
},
|
||||
"keywords": [
|
||||
"cljs",
|
||||
"cloud",
|
||||
"nextcloud",
|
||||
"k8s",
|
||||
"c4k",
|
||||
"deployment",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(defproject meissa/meissa-cloud "1.0.2-SNAPSHOT"
|
||||
(defproject org.domaindrivenarchitecture/c4k-nextcloud "1.0.2-SNAPSHOT"
|
||||
:description "nextcloud c4k-installation package"
|
||||
:url "https://domaindrivenarchitecture.org"
|
||||
:license {:name "Apache License, Version 2.0"
|
||||
|
@ -35,7 +35,7 @@
|
|||
"native-image"
|
||||
"--report-unsupported-elements-at-runtime"
|
||||
"--initialize-at-build-time"
|
||||
"-jar" "target/uberjar/c4k-jira-standalone.jar"
|
||||
"-jar" "target/uberjar/c4k-nextcloud-standalone.jar"
|
||||
"-H:ResourceConfigurationFiles=graalvm-resource-config.json"
|
||||
"-H:Log=registerResource"
|
||||
"-H:Name=target/graalvm/${:name}"]})
|
|
@ -14,24 +14,24 @@
|
|||
<div class="container jumbotron">
|
||||
<form class="needs-validation" id="form">
|
||||
<label for="fqdn" class="form-label">Your fqdn:</label>
|
||||
<input class="form-control" type="text" name="fqdn" id="fqdn" value="cloud-neu.prod.meissa-gmbh.de">
|
||||
<input class="form-control" type="text" name="fqdn" id="fqdn" value="jira-neu.prod.meissa-gmbh.de">
|
||||
<div class="invalid-feedback">
|
||||
<pre id="fqdn-validation"></pre>
|
||||
</div>
|
||||
<label for="cloud-data-volume-path" class="form-label">(Optional) Your cloud-data-volume-path:</label>
|
||||
<input class="form-control" type="text" name="cloud-data-volume-path" id="cloud-data-volume-path" value="/var/cloud">
|
||||
<label for="jira-data-volume-path" class="form-label">(Optional) Your jira-data-volume-path:</label>
|
||||
<input class="form-control" type="text" name="jira-data-volume-path" id="jira-data-volume-path" value="/var/jira">
|
||||
<div class="invalid-feedback">
|
||||
<pre id="cloud-data-volume-path-validation"></pre>
|
||||
<pre id="jira-data-volume-path-validation"></pre>
|
||||
</div>
|
||||
<label for="postgres-data-volume-path" class="form-label">(Optional) Your postgres-data-volume-path:</label>
|
||||
<input class="form-control" type="text" name="postgres-data-volume-path" id="postgres-data-volume-path" value="/var/postgres">
|
||||
<div class="invalid-feedback">
|
||||
<pre id="postgres-data-volume-path"></pre>
|
||||
<pre id="postgres-data-volume-path-validation"></pre>
|
||||
</div>
|
||||
<label for="restic-repository" class="form-label">(Optional) Your restic-repository:</label>
|
||||
<input class="form-control" type="text" name="restic-repository" id="restic-repository" value="restic-repository">
|
||||
<div class="invalid-feedback">
|
||||
<pre id="restic-repository"></pre>
|
||||
<pre id="restic-repository-validation"></pre>
|
||||
</div>
|
||||
<br>
|
||||
<label for="issuer" class="form-label">(Optional) Your issuer prod/staging:</label>
|
||||
|
@ -42,8 +42,8 @@
|
|||
<br><br>
|
||||
<label for="auth" class="form-label">Your auth.edn:</label>
|
||||
<textarea name="auth" id="auth" class="form-control" rows="5">
|
||||
{:postgres-db-user "cloud"
|
||||
:postgres-db-password "cloud-db-password"
|
||||
{:postgres-db-user "jira"
|
||||
:postgres-db-password "jira-db-password"
|
||||
:aws-access-key-id "aws-id"
|
||||
:aws-secret-access-key "aws-secret"
|
||||
:restic-password "restic-password"}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"src/test/resources"]
|
||||
:dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "0.2.8"]]
|
||||
:builds {:frontend {:target :browser
|
||||
:modules {:main {:init-fn dda.c4k-cloud.browser/init}}
|
||||
:modules {:main {:init-fn dda.c4k-nextcloud.browser/init}}
|
||||
:release {}
|
||||
:compiler-options {:optimizations :advanced}}
|
||||
:test {:target :node-test
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
|
||||
(def config? (s/keys :req-un [::nextcloud/fqdn]
|
||||
:opt-un [::nextcloud/issuer ::nextcloud/nextcloud-data-volume-path
|
||||
::postgres/postgres-data-volume-path ::restic-repository]))
|
||||
::postgres/postgres-data-volume-path ::restic-repository
|
||||
::nextcloud/storage-size]))
|
||||
|
||||
(def auth? (s/keys :req-un [::postgres/postgres-db-user ::postgres/postgres-db-password
|
||||
::aws-access-key-id ::aws-secret-access-key
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
(defn generate-deployment [config]
|
||||
(let [{:keys [fqdn]} config]
|
||||
(-> (yaml/from-string (yaml/load-resource "nextcloud/deployment.yaml"))
|
||||
(cm/replace-named-value "FQDN" fqdn))))
|
||||
(cm/replace-all-matching-values-by-new-value "fqdn" fqdn))))
|
||||
|
||||
(defn generate-ingress [config]
|
||||
(let [{:keys [fqdn issuer]
|
||||
|
@ -45,10 +45,11 @@
|
|||
(cm/replace-all-matching-values-by-new-value "fqdn" fqdn))))
|
||||
|
||||
(defn generate-persistent-volume [config]
|
||||
(let [{:keys [nextcloud-data-volume-path]} config]
|
||||
(let [{:keys [nextcloud-data-volume-path storage-size]} config]
|
||||
(->
|
||||
(yaml/from-string (yaml/load-resource "nextcloud/persistent-volume.yaml"))
|
||||
(assoc-in [:spec :hostPath :path] nextcloud-data-volume-path))))
|
||||
(assoc-in [:spec :hostPath :path] nextcloud-data-volume-path)
|
||||
(assoc-in [:spec :capacity :storage] (str storage-size "Gi")))))
|
||||
|
||||
(defn generate-pvc []
|
||||
(yaml/from-string (yaml/load-resource "nextcloud/pvc.yaml")))
|
||||
|
|
|
@ -25,7 +25,7 @@ spec:
|
|||
- name: NEXTCLOUD_ADMIN_PASSWORD_FILE
|
||||
value: /var/run/secrets/cloud-secrets/nextcloud-admin-password
|
||||
- name: NEXTCLOUD_TRUSTED_DOMAINS
|
||||
value: "{{fqdn}}"
|
||||
value: fqdn
|
||||
- name: POSTGRES_USER_FILE
|
||||
value: /var/run/secrets/cloud-secrets/postgres-user
|
||||
- name: POSTGRES_PASSWORD_FILE
|
||||
|
@ -34,7 +34,7 @@ spec:
|
|||
value: /var/run/secrets/cloud-secrets/postgres-db
|
||||
- name: POSTGRES_HOST
|
||||
value: "postgresql-service:5432"
|
||||
volumeMounts:
|
||||
volumeMounts:
|
||||
- name: cloud-data-volume
|
||||
mountPath: /var/www/html
|
||||
- name: cloud-secret-volume
|
|
@ -10,6 +10,6 @@ spec:
|
|||
accessModes:
|
||||
- ReadWriteOnce
|
||||
capacity:
|
||||
storage: {{storage-size}}Gi #??? 30Gi?
|
||||
storage: 200Gi
|
||||
hostPath:
|
||||
path: "/var/cloud"
|
|
@ -10,7 +10,7 @@ spec:
|
|||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{storage-size}}Gi #??? 30Gi?
|
||||
storage: 200Gi
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cloud
|
|
@ -4,6 +4,6 @@ metadata:
|
|||
name: cloud-service
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/name: cloud #???
|
||||
app.kubernetes.io/name: cloud
|
||||
ports:
|
||||
- port: 80
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
mkdir -p /var/postgres
|
||||
install -d -m 0777 -o {{user}} -g {{user}} /var/postgres
|
|
@ -1,10 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: postgres-config
|
||||
labels:
|
||||
app: postgres
|
||||
data:
|
||||
postgresql.conf: |
|
||||
max_connections = 1000
|
||||
shared_buffers = 512MB
|
|
@ -1,49 +0,0 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: postgresql
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: postgresql
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: postgresql
|
||||
spec:
|
||||
containers:
|
||||
- image: postgres
|
||||
name: postgresql
|
||||
env:
|
||||
- name: POSTGRES_USER_FILE
|
||||
value: /var/run/secrets/postgres-secrets/postgres-user
|
||||
- name: POSTGRES_DB_FILE
|
||||
value: /var/run/secrets/postgres-secrets/postgres-db
|
||||
- name: POSTGRES_PASSWORD_FILE
|
||||
value: /var/run/secrets/postgres-secrets/postgres-password
|
||||
ports:
|
||||
- containerPort: 5432
|
||||
name: postgresql
|
||||
cmd:
|
||||
volumeMounts:
|
||||
- name: postgresql
|
||||
mountPath: /var/lib/postgresql/data
|
||||
- name: postgres-secret-volume
|
||||
mountPath: /var/run/secrets/postgres-secrets
|
||||
readOnly: true
|
||||
- name: postgres-config-volume
|
||||
mountPath: /etc/postgresql/postgresql.conf
|
||||
subPath: postgresql.conf
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: postgresql
|
||||
persistentVolumeClaim:
|
||||
claimName: postgres-claim
|
||||
- name: postgres-secret-volume
|
||||
secret:
|
||||
secretName: postgres-secret
|
||||
- name: postgres-config-volume
|
||||
configMap:
|
||||
name: postgres-config
|
|
@ -1,15 +0,0 @@
|
|||
kind: PersistentVolume
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: postgres-pv-volume
|
||||
labels:
|
||||
type: local
|
||||
app: postgresql
|
||||
spec:
|
||||
storageClassName: manual
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
capacity:
|
||||
storage: 10Gi
|
||||
hostPath:
|
||||
path: "/var/postgres"
|
|
@ -1,16 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: postgres-claim
|
||||
labels:
|
||||
app: postgresql
|
||||
spec:
|
||||
storageClassName: manual
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
selector:
|
||||
matchLabels:
|
||||
app: postgresql
|
|
@ -1,9 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: postgres-secret
|
||||
type: Opaque
|
||||
stringData:
|
||||
postgres-db: cloud
|
||||
postgres-user: {{db-user-name}}
|
||||
postgres-password: {{db-user-password}}
|
|
@ -1,10 +0,0 @@
|
|||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: postgresql-service
|
||||
spec:
|
||||
selector:
|
||||
app: postgresql
|
||||
ports:
|
||||
- port: 5432
|
|
@ -1,3 +0,0 @@
|
|||
{:existing [{:node-name "cloud"
|
||||
:node-ip "168.119.190.126"}]
|
||||
:provisioning-user {:login "root"}}
|
|
@ -1,5 +1,5 @@
|
|||
{:postgres-db-user "cloud"
|
||||
:postgres-db-password "cloud-db-password"
|
||||
{:postgres-db-user "nextcloud"
|
||||
:postgres-db-password "nextcloud-db-password"
|
||||
:aws-access-key-id "aws-id"
|
||||
:aws-secret-access-key "aws-secret"
|
||||
:restic-password "restic-password"}
|
|
@ -1,4 +1,5 @@
|
|||
{:fqdn "cloud-neu.prod.meissa-gmbh.de"
|
||||
:cloud-data-volume-path "/var/cloud"
|
||||
:nextcloud-data-volume-path "/var/nextcloud"
|
||||
:postgres-data-volume-path "/var/postgres"
|
||||
:storage-size 300
|
||||
:restic-repository "restic-repository"}
|
Loading…
Reference in a new issue