We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cljdoc is launched in production within its docker container via clojure.
clojure
Instead, launch cljdoc from a stand alone jar via java.
java
Faster startup time in production, but perhaps more interesting, faster times when using running cljdoc locally via docker.
I did a wee adhoc test from the command line (not involving docker). I wait about 15s until first log line output when launching via:
clojure -M -m cljdoc.server.system
Versus about 5s to first log line output when launching via a prebuilt stand-alone jar which in my local test was via:
java -jar target/cljdoc-1.2.3-leetest-standalone.jar
This jar was built via the following quickly-hacked-together build.clj:
build.clj
(ns build (:require [clojure.tools.build.api :as b])) (def lib 'cljdoc/cljdoc) (def version "1.2.3-leetest") (def class-dir "target/classes") (def basis (b/create-basis {:project "deps.edn" :aliases [:cli]})) (def uber-file (format "target/%s-%s-standalone.jar" (name lib) version)) (defn clean [_] (b/delete {:path "target"})) (defn uber [_] (clean nil) (b/copy-dir {:src-dirs ["src" "resources" "resources-compiled"] :target-dir class-dir}) (b/compile-clj {:basis basis :src-dirs ["src"] :class-dir class-dir}) (b/uber {:class-dir class-dir :uber-file uber-file :basis basis :main 'cljdoc.server.system}))
We currently support running cljdoc locally via the production cljdoc docker image.
This can use a different main entry point than the production server launch does, for example for ingesting local docs.
As far I understand things, a jar only easily supports a single main entry point.
So, if we entertained this change, we'd likely move to a single main entry point.
I'm sure I haven't thought of a thing or two, happy to hear what you, dear reader, think.
The text was updated successfully, but these errors were encountered:
Or... maybe look at jlink and CDS for launch speed.
This would add some complexity to the docker build so we'd have to measure the benefit.
Sorry, something went wrong.
Of interest, you can invoke multiple different mains from a jar by using -cp instead of -jar.
-cp
-jar
Nic example from @seancorfield on slack:
(~/clojure/mains)-(!2016)-> cat src/multi/another.clj (ns multi.another (:gen-class)) (defn -main "I don't do a whole lot ... yet." [& args] (println "I'm another main!")) Thu Feb 09 11:18:09 (~/clojure/mains)-(!2017)-> cat src/multi/mains.clj (ns multi.mains (:gen-class)) (defn greet "Callable entry point to the application." [data] (println (str "Hello, " (or (:name data) "World") "!"))) (defn -main "I don't do a whole lot ... yet." [& args] (greet {:name (first args)})) Thu Feb 09 11:18:12 (~/clojure/mains)-(!2018)-> java -jar target/net.clojars.multi/mains-0.1.0-SNAPSHOT.jar Hello, World! Thu Feb 09 11:18:22 (~/clojure/mains)-(!2019)-> java -jar target/net.clojars.multi/mains-0.1.0-SNAPSHOT.jar argument Hello, argument! Thu Feb 09 11:18:28 (~/clojure/mains)-(!2020)-> java -cp target/net.clojars.multi/mains-0.1.0-SNAPSHOT.jar multi.mains Hello, World! Thu Feb 09 11:18:48 (~/clojure/mains)-(!2021)-> java -cp target/net.clojars.multi/mains-0.1.0-SNAPSHOT.jar multi.mains argument Hello, argument! Thu Feb 09 11:18:52 (~/clojure/mains)-(!2022)-> java -cp target/net.clojars.multi/mains-0.1.0-SNAPSHOT.jar multi.another I'm another main! Thu Feb 09 11:19:02 (~/clojure/mains)-(!2023)->
No branches or pull requests
Currently
Cljdoc is launched in production within its docker container via
clojure
.Idea
Instead, launch cljdoc from a stand alone jar via
java
.Why?
Faster startup time in production, but perhaps more interesting, faster times when using running cljdoc locally via docker.
I did a wee adhoc test from the command line (not involving docker).
I wait about 15s until first log line output when launching via:
Versus about 5s to first log line output when launching via a prebuilt stand-alone jar which in my local test was via:
This jar was built via the following quickly-hacked-together
build.clj
:Impacts
We currently support running cljdoc locally via the production cljdoc docker image.
This can use a different main entry point than the production server launch does, for example for ingesting local docs.
As far I understand things, a jar only easily supports a single main entry point.
So, if we entertained this change, we'd likely move to a single main entry point.
Whatcha think?
I'm sure I haven't thought of a thing or two, happy to hear what you, dear reader, think.
The text was updated successfully, but these errors were encountered: