Skip to content
New issue

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

Upgrade deps #110

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ Your path to get running depends on what you need to do:

By default, Vase uses an in-memory Datomic database, using the
[publicly available
Datomic-free](https://clojars.org/com.datomic/datomic-free) version
located in Clojars.
Datomic Peer](https://central.sonatype.com/artifact/com.datomic/peer)
located in Maven Central.

## Run Vase Standalone

Expand Down
14 changes: 7 additions & 7 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{:paths ["src"]
:deps {com.datomic/datomic-free {:mvn/version "0.9.5697"}
com.datomic/client-cloud {:mvn/version "0.8.63"}
:deps {com.datomic/peer {:mvn/version "1.0.7187"}
com.datomic/client-cloud {:mvn/version "1.0.130"}

io.rkn/conformity {:mvn/version "0.5.1"}
io.rkn/conformity {:mvn/version "0.5.4"}

;; Pedestal
io.pedestal/pedestal.service {:mvn/version "0.5.4"}
io.pedestal/pedestal.jetty {:mvn/version "0.5.4"}
;; Pedestal
io.pedestal/pedestal.service {:mvn/version "0.6.3"}
io.pedestal/pedestal.jetty {:mvn/version "0.6.3"}

com.cognitect/fern {:mvn/version "0.1.5"}}
com.cognitect/fern {:mvn/version "0.1.6"}}
:aliases {:repl {:extra-paths ["test" "test/resources"]}}}
58 changes: 11 additions & 47 deletions docs/your_first_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ It also important to note that the terms *service*, *server*,

## Setting Up

Note that the template project uses Datomic Free and therefore offers
only an in-memory store. Later, you can change to a persistent store.
You'll have get a Datomic license (free versions are available),
launch a Datomic transactor, make minor changes to your project.clj
or build.boot, and update the `:datomic-uri` value in your EDN
descriptor file. This is explained below, as well as
Note that the template project uses Datomic and offers both an
in-memory store and a persistent store. To make it persistent, you'll
have to launch a Datomic transactor and update the `:datomic-uri`
value in your EDN descriptor file. This is explained below, as well as
in [the Datomic docs](http://docs.datomic.com).

Create a new project from the Vase leiningen template:
Expand Down Expand Up @@ -733,47 +731,13 @@ An example of simple constants follows - observe our last change to the schema b

## Be Persistent

So far, we've used an in-memory URI for Datomic. That means just what it sounds like:
values are only stored in memory. To make it persistent, you need to pick
a [storage engine](http://docs.datomic.com/storage.html#storage-services) and update the
`:datomic-uri` value. For your initial efforts,
Datomic's [dev storage protocol](http://docs.datomic.com/dev-setup.html) may suffice.

By default, Vase uses the free version of Datomic. In order to configure dev or
other persistent stores, you will need to first
[obtain a Datomic Starter or Datomic Pro license](http://www.datomic.com/get-datomic.html)
and install the software on your machine.

You'll also need to reference datomic-pro in your dependencies.

You will then need to change your project's dependencies to reference the
correct version of Datomic (in the project's `project.clj` or `build.boot`
file). This is slightly subtle because the template actually did not add any
direct reference to Datomic in your project. Instead, it included a dependency
on Vase which, in turn, depends on datamic-free.

So, you will need to add an explicit dependency on datamic-pro, and neutralize Vase's
inclusion of datomic-free:

Look for the existing Vase dependency, e.g.,
```
[com.cognitect/pedestal.vase "0.9.1-SNAPSHOT"]
```

and change it to

```
[com.datomic/datomic-pro "0.9.NNNN" :exclusions [[com.fasterxml.jackson.core/jackson-core]
[com.fasterxml.jackson.core/jackson-databind]
[joda-time]]]

[com.cognitect/pedestal.vase "0.9.1-SNAPSHOT" :exclusions [com.datomic/datomic-free]]
```

where `NNNN` is the version of Datomic you've installed.

You can see an example of this in the samples at
[../samples/petstore-full/project.clj-with-datomic-pro](../samples/petstore-full/project.clj-with-datomic-pro).
So far, we've used an in-memory URI for Datomic. That means just what
it sounds like: values are only stored in memory. To make it
persistent, you need to pick a [storage
engine](http://docs.datomic.com/storage.html#storage-services), launch
a transactor, and update the `:datomic-uri` value. For your initial
efforts, Datomic's [dev storage
protocol](http://docs.datomic.com/dev-setup.html) may suffice.

## Wrapping Up

Expand Down
50 changes: 24 additions & 26 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,36 @@
:description "Vase: Pedestal API Container"
:url "https://github.com/cognitect-labs/vase"
:dependencies [;; Platform
[org.clojure/clojure "1.10.1"]
[org.clojure/clojure "1.11.4"]

;; Datomic
[com.datomic/datomic-free "0.9.5697" :exclusions [[org.slf4j/slf4j-api]
[org.slf4j/slf4j-nop]
[org.eclipse.jetty/jetty-util]
[org.eclipse.jetty/jetty-client]]]
[com.datomic/client-cloud "0.8.78" :exclusions [commons-logging]]
[io.rkn/conformity "0.5.1" :exclusions [com.datomic/datomic-free]]
[com.datomic/peer "1.0.7187" :exclusions [[org.slf4j/slf4j-api]
[org.slf4j/slf4j-nop]
[org.eclipse.jetty/jetty-util]
[org.eclipse.jetty/jetty-client]]]
[com.datomic/client-cloud "1.0.130" :exclusions [commons-logging com.cognitect/transit-clj]]
[io.rkn/conformity "0.5.4" :exclusions [com.datomic/datomic-free]]

;; Pedestal
[io.pedestal/pedestal.service "0.5.7"]
[io.pedestal/pedestal.jetty "0.5.7"]
[io.pedestal/pedestal.service "0.6.3"]
[io.pedestal/pedestal.jetty "0.6.3"]

;; Pin Jetty versions to avoid conflict between Datomic and Pedestal
[org.eclipse.jetty/jetty-client "9.4.18.v20190429"]
[org.eclipse.jetty/jetty-client "9.4.55.v20240627"]

;; Pin core.async to avoid conflict between Datomic and Pedestal
[org.clojure/core.async "0.4.490"]

;; Pin joda-time to avoid conflict between Datomic and Pedestal
[joda-time "2.9.9"]
[org.clojure/core.async "1.6.681"]

;; Configuration
[com.cognitect/fern "0.1.5"]
[com.cognitect/fern "0.1.6" :exclusions [fipp]]
[fipp/fipp "0.6.26"]

;; Replace Java EE module for JDK 11
[javax.xml.bind/jaxb-api "2.3.0"]
[javax.xml.bind/jaxb-api "2.4.0-b180830.0359"]

;; Cleanup
[commons-codec "1.12"]
[cheshire "5.8.1"]]
[commons-codec "1.16.0"]
[cheshire "5.11.0"]]

:main ^:skip-aot com.cognitect.vase.main
:pedantic? :warn
Expand All @@ -57,17 +55,17 @@
"resources"
"test/resources"]
:dependencies [[org.clojure/tools.trace "0.7.10"]
[org.clojure/tools.namespace "0.3.0" :exclusions [[org.clojure/tools.reader]]]
[org.clojure/tools.reader "1.3.2"]
[org.clojure/tools.namespace "1.5.0" :exclusions [[org.clojure/tools.reader]]]
[org.clojure/tools.reader "1.3.6"]
[org.clojure/test.check "0.9.0"]
;; Logging
[org.slf4j/slf4j-api "1.7.26"]
[ch.qos.logback/logback-classic "1.2.3" :exclusions [[org.slf4j/slf4j-api]]]
[org.slf4j/jul-to-slf4j "1.7.26"]
[org.slf4j/jcl-over-slf4j "1.7.26"]
[org.slf4j/log4j-over-slf4j "1.7.26"]]}
[org.slf4j/slf4j-api "1.7.36"]
[ch.qos.logback/logback-classic "1.4.6" :exclusions [[org.slf4j/slf4j-api]]]
[org.slf4j/jul-to-slf4j "1.7.36"]
[org.slf4j/jcl-over-slf4j "1.7.36"]
[org.slf4j/log4j-over-slf4j "1.7.36"]]}
:test {:dependencies [[org.clojure/test.check "0.9.0"]
[io.pedestal/pedestal.service-tools "0.5.7" :exclusions [[org.slf4j/log4j-over-slf4j]
[io.pedestal/pedestal.service-tools "0.6.3" :exclusions [[org.slf4j/log4j-over-slf4j]
[org.slf4j/jul-to-slf4j]
[org.slf4j/jcl-over-slf4j]]]]
:resource-paths ["resources"
Expand Down
13 changes: 4 additions & 9 deletions samples/petstore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,11 @@ Vase.

# Datomic Setup

This sample uses Datomic with an in-memory database. Since Vase
already depends on "datomic-free," you don't need to add anything
specific for the in-memory case.
This sample uses Datomic with an in-memory database.

If you want to use on-disk storage with Datomic Pro, two steps are
needed:

1. In `project.clj`, uncomment the dependency for `com.datomic/datomic-pro`
2. Change the connection defined in `resources/petstore.fern` as
described in comments in that file.
If you want to use on-disk storage with Datomic Pro, you need to
change the connection defined in `resources/petstore.fern` as
described in comments in that file.

```clojure
:vase.descriptor/datomic-uri "datomic:dev://localhost:4334/pet-store"
Expand Down
1 change: 1 addition & 0 deletions src/com/cognitect/vase/edn.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(ns com.cognitect.vase.edn
(:refer-clojure :exclude [read])
(:require [clojure.edn :as edn]
[clojure.java.io :as io]
[clojure.string :as cstr])
Expand Down
6 changes: 3 additions & 3 deletions src/com/cognitect/vase/interceptor.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
(:require [io.pedestal.interceptor.helpers :as helpers :refer [defon-request]]
[io.pedestal.interceptor :as i]
[clojure.stacktrace :as ctrace]
[clj-time.core :as clj-time]
[com.cognitect.vase.util :as util]))
[com.cognitect.vase.util :as util])
(:import (java.time Instant)))

(def request-id-header "vaserequest-id")

(def attach-received-time
(i/-interceptor
{:name ::attach-received-time
:doc "Attaches a timestamp to every request."
:enter (fn [ctx] (assoc-in ctx [:request :received-time] (clj-time/now)))}))
:enter (fn [ctx] (assoc-in ctx [:request :received-time] (Instant/now)))}))

(def attach-request-id
(i/-interceptor
Expand Down