- deps.edn
-
juxt/crux-core {:mvn/version "{crux_version}-beta"}
- pom.xml
-
<dependency> <groupId>juxt</groupId> <artifactId>crux-core</artifactId> <version>{crux_version}-beta</version> </dependency>
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+.
juxt/crux-core {:mvn/version "{crux_version}-beta"}
<dependency>
<groupId>juxt</groupId>
<artifactId>crux-core</artifactId>
<version>{crux_version}-beta</version>
</dependency>
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]
link:example$src/docs/Install.kt[role=include]
link:example$src/docs/Install.kt[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.12.1
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 "{crux_version}-beta"}
juxt/crux-http-server {:mvn/version "{crux_version}-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? These fine people already did:
James Henderson, Daniel Mason, Alistair & Andrea CrottiEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close