5 ms·
Examples of Clojure projects that compile to native: - babashka (https://github.com/babashka/babashka https://github.com/babashka/babashka) - clj-kondo (https
by Borkdude 4y ago
Examples of Clojure projects that compile to native:
- babashka (https://github.com/babashka/babashka https://github.com/babashka/babashka)
- clj-kondo (https://github.com/clj-kondo/clj-kondo https://github.com/clj-kondo/clj-kondo)
- jet (https://github.com/borkdude/jet https://github.com/borkdude/jet)
SCI (https://github.com/babashka/sci https://github.com/babashka/sci) is a Clojure interpreter that allows you to evaluate Clojure code even inside of the final native binary and is used in all of the above projects.
Feel free to bug me with questions in the graalvm channel on Clojurians Slack.
- christophilus 4y agoI want to slap a bunch of side projects on a small VPS. With Go, this is no problem. Scp the binary (which includes an embedded SQLite), configure it to run as a systemd service, add it to my reverse proxy rules. I’d love to use Clojure for this, but it doesn’t seem well suited to running in a small, shared environment. Or is it now that there’s AOT?
- lf-non 4y agoPerhaps fennel+openresty is a better fit for that kind of use case.
- melony 4y agoDepends on how much value you place on performance. For long running processes like web servers, the JVM still reigns supreme.
- stingraycharles 4y agoYou should be fine, but it depends on your definition of “small VPS”. Generally, assume that each process will need about 512MB of memory. You’ll definitely want to restrict the JVM by memory, either by explicit flags (-Xmx ) or by running them in a cgroup or container.
- lvh 4y agoPretty similar with Clojure, though because it's not the default mode of operation, more stuff will break. Still, we do this all the time and it's mostly fine. That said, seems like you should be able to do something pretty similar fairly easily with jars and the JVM (you may not want to run lots of JVMs in the method you're describing, since if you're calling these processes in a one-shot, CGI-style fashion, the JVMs startup time and memory requirements is going to be annoying.) GP also linked babashka which may be closer to your interests, as its an interpreter for small scripts like these, but also comes with a mechanism (pods) for loading dependencies (like SQLite).
- nathell 4y agoI'm running a side project in Clojure (a guess-the-number-of-covid-cases lottery, https://koronalotek.pl https://koronalotek.pl) on a small VPS (Scaleway DEV1-S), and it is no problem either. It runs happily in the 2 GB RAM that the server has; I just installed the JVM, configured a nginx reverse proxy, and am using the standard cli-tools in a screen session to run it.
- naruhodo 4y agoHere, have some PCP![1] The first one's free! > An easy to use, drop-in Clojure replacement for php scripts > Allow multiple websites to be hosted on a single $5 VPS > The utility is a simple binary, built with GraalVM, that allows you to work effectively with pcp. Note that not all of PCP is AOT compiled. Just the command line utility. There's a daemon as well. [1] <https://github.com/alekcz/pcp https://github.com/alekcz/pcp>
- mark_l_watson 4y agoThanks for the info! BTW, I enjoyed your ClojureScript+Node.js talk a few weeks ago.