Compare commits

...

3 commits

Author SHA1 Message Date
74beafdcfe Update build 2024-08-08 11:38:34 +02:00
fd8b1facb8 Update deps 2024-08-08 11:38:26 +02:00
9f2ee663bd Split Config and Auth 2024-08-08 11:38:16 +02:00
4 changed files with 35 additions and 30 deletions

View file

@ -23,7 +23,7 @@ def initialize(project):
"release_primary_build_file": "project.clj", "release_primary_build_file": "project.clj",
"release_secondary_build_files": [ "release_secondary_build_files": [
"package.json", "package.json",
], ],
"release_artifact_server_url": "https://repo.prod.meissa.de", "release_artifact_server_url": "https://repo.prod.meissa.de",
"release_organisation": "meissa", "release_organisation": "meissa",
"release_repository_name": name, "release_repository_name": name,
@ -100,6 +100,12 @@ def package_frontend(project):
@task @task
def package_uberjar(project): def package_uberjar(project):
run("mkdir -p target/uberjar", shell=True, check=True)
run(
"lein uberjar",
shell=True,
check=True,
)
run( run(
"sha256sum target/uberjar/c4k-keycloak-standalone.jar > target/uberjar/" + project.name + "-standalone.jar.sha256", "sha256sum target/uberjar/c4k-keycloak-standalone.jar > target/uberjar/" + project.name + "-standalone.jar.sha256",
shell=True, shell=True,
@ -126,13 +132,10 @@ def package_native(project):
"--no-server " + "--no-server " +
"--no-fallback " + "--no-fallback " +
"--features=clj_easy.graal_build_time.InitClojureClasses " + "--features=clj_easy.graal_build_time.InitClojureClasses " +
"-jar target/uberjar/" + project.name + "-standalone.jar " + f"-jar target/uberjar/{project.name}-standalone.jar " +
"-march=compatibility " +
"-H:+UnlockExperimentalVMOptions " +
"-H:IncludeResources=.*.yaml " + "-H:IncludeResources=.*.yaml " +
"-H:IncludeResources=logback.xml " +
"-H:Log=registerResource:verbose " + "-H:Log=registerResource:verbose " +
"-H:Name=target/graalvm/" + project.name + "", f"-H:Name=target/graalvm/{project.name}",
shell=True, shell=True,
check=True, check=True,
) )
@ -150,11 +153,7 @@ def package_native(project):
@task @task
def inst(project): def inst(project):
run( package_uberjar(project)
"lein uberjar",
shell=True,
check=True,
)
package_native(project) package_native(project)
run( run(
"sudo install -m=755 target/uberjar/" + project.name + "-standalone.jar /usr/local/bin/" + project.name + "-standalone.jar", "sudo install -m=755 target/uberjar/" + project.name + "-standalone.jar /usr/local/bin/" + project.name + "-standalone.jar",
@ -175,11 +174,6 @@ def upload_clj(project):
@task @task
def lint(project): def lint(project):
#run(
# "lein eastwood",
# shell=True,
# check=True,
#)
run( run(
"lein ancient check", "lein ancient check",
shell=True, shell=True,

View file

@ -3,9 +3,9 @@
: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.3"] :dependencies [[org.clojure/clojure "1.11.4"]
[org.clojure/tools.reader "1.4.2"] [org.clojure/tools.reader "1.4.2"]
[org.domaindrivenarchitecture/c4k-common-clj "6.4.1"]] [org.domaindrivenarchitecture/c4k-common-clj "8.0.0"]]
:target-path "target/%s/" :target-path "target/%s/"
:source-paths ["src/main/cljc" :source-paths ["src/main/cljc"
"src/main/clj"] "src/main/clj"]
@ -24,7 +24,7 @@
:dependencies [[org.clojure/tools.cli "1.1.230"] :dependencies [[org.clojure/tools.cli "1.1.230"]
[ch.qos.logback/logback-classic "1.5.6" [ch.qos.logback/logback-classic "1.5.6"
:exclusions [com.sun.mail/javax.mail]] :exclusions [com.sun.mail/javax.mail]]
[org.slf4j/jcl-over-slf4j "2.0.13"] [org.slf4j/jcl-over-slf4j "2.0.14"]
[com.github.clj-easy/graal-build-time "1.0.5"]]}} [com.github.clj-easy/graal-build-time "1.0.5"]]}}
:release-tasks [["test"] :release-tasks [["test"]
["vcs" "assert-committed"] ["vcs" "assert-committed"]

View file

@ -7,10 +7,11 @@
(set! *warn-on-reflection* true) (set! *warn-on-reflection* true)
(defn -main [& cmd-args] (defn -main [& cmd-args]
(uberjar/main-common (uberjar/main-cm
"c4k-keycloak" "c4k-keycloak"
core/config? core/config?
core/auth? core/auth?
core/config-defaults core/config-defaults
core/k8s-objects core/config-objects
core/auth-objects
cmd-args)) cmd-args))

View file

@ -30,18 +30,28 @@
::postgres/postgres-db-user ::postgres/postgres-db-password] ::postgres/postgres-db-user ::postgres/postgres-db-password]
:opt-un [::mon/mon-auth])) :opt-un [::mon/mon-auth]))
(defn-spec k8s-objects cp/map-or-seq? (defn-spec config-objects cp/map-or-seq?
[config config?]
(map yaml/to-string
(filter
#(not (nil? %))
(cm/concat-vec
(ns/generate config)
(postgres/generate-config config)
[(kc/generate-service config)
(kc/generate-deployment config)]
(kc/generate-ingress config)
(when (contains? config :mon-cfg)
(mon/generate-config))))))
(defn-spec auth-objects cp/map-or-seq?
[config config? [config config?
auth auth?] auth auth?]
(map yaml/to-string (map yaml/to-string
(filter (filter
#(not (nil? %)) #(not (nil? %))
(cm/concat-vec (cm/concat-vec
(ns/generate config) (postgres/generate-auth config auth)
(postgres/generate config auth) [(kc/generate-secret config auth)]
[(kc/generate-secret config auth) (when (and (contains? auth :mon-auth) (contains? config :mon-cfg))
(kc/generate-service config) (mon/generate-auth (:mon-config config) (:mon-auth auth)))))))
(kc/generate-deployment config)]
(kc/generate-ingress config)
(when (:contains? config :mon-cfg)
(mon/generate (:mon-cfg config) (:mon-auth auth)))))))