link:example$deps.edn[role=include]
Crux nodes can be embedded within your JVM application, or they can be started standalone through a pre-built Crux JAR, via Docker, or using Clojure CLI tooling.
This guide will show you how to set up an in-memory node using the crux-core
module.
You can then proceed to add further modules (eg for persistence) as required - see the documentation of the individual modules for more information.
Crux depends on Java 8+.
link:example$deps.edn[role=include]
link:example$maven.xml[role=include]
First, add the crux-core
module as a project dependency.
We can then start up an in-memory Crux node with:
(require '[crux.api :as crux])
(crux/start-node {})
link:example$src/docs/Install.java[role=include]
link:example$src/docs/Install.java[role=include]
You can start a standalone Crux node, accessible through HTTP, using a pre-built Crux JAR.
Crux pre-built JARs can be found on the relevant GitHub releases page - we’ll use crux-in-memory.jar
.
Start it in the usual way, with java -jar crux-in-memory.jar
.
This will open an HTTP port with a console UI on port 3000 - open http://localhost:3000 in your favourite browser.
You can also build custom Crux JARs with your choice of modules - see the Crux build blog for more details.
You can also start a standalone Crux node using Docker, using:
docker run -p 3000:3000 juxt/crux-in-memory:20.09-1.11.0
Again, this opens up an HTTP server at http://localhost:3000.
Likewise, you can build custom Crux Docker images - see the Crux build blog for more details.
Similarly, to start Crux using Clojure’s CLI tooling:
{:deps {org.clojure/clojure {:mvn/version "1.10.1"}
juxt/crux-core {:mvn/version "20.09-1.11.0-beta"}
juxt/crux-http-server {:mvn/version "20.09-1.11.0-alpha"}}}
{:crux.http-server/server {:port 3000}}
Then, start the node with clojure -m crux.main
.
You can get a listing of CLI flags using clojure -m crux.main -h
.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close