Skip to content

Commit

Permalink
Merge pull request #550 from samply/release-v0.13.3
Browse files Browse the repository at this point in the history
Release v0.13.3
  • Loading branch information
alexanderkiel authored Nov 26, 2021
2 parents 281ca0f + 7b26c57 commit fd53506
Show file tree
Hide file tree
Showing 35 changed files with 591 additions and 167 deletions.
2 changes: 1 addition & 1 deletion .clj-kondo/config.edn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{:lint-as
{blaze.async.comp/do-sync clojure.core/let}
{blaze.test-util/with-system clojure.core/with-open}

:linters
{:unsorted-required-namespaces
Expand Down
4 changes: 4 additions & 0 deletions .github/distributed-test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ services:
DB_CASSANDRA_MAX_CONCURRENT_REQUESTS: "128"
DB_RESOURCE_CACHE_SIZE: "1000"
LOG_LEVEL: "debug"
ports:
- "8081:8081"
volumes:
- "./blaze.keystore.jks:/app/blaze.keystore.jks:ro"
- "./kafka.truststore.jks:/app/kafka.truststore.jks:ro"
Expand Down Expand Up @@ -109,6 +111,8 @@ services:
DB_CASSANDRA_MAX_CONCURRENT_REQUESTS: "128"
DB_RESOURCE_CACHE_SIZE: "1000"
LOG_LEVEL: "debug"
ports:
- "8082:8081"
volumes:
- "./blaze.keystore.jks:/app/blaze.keystore.jks:ro"
- "./kafka.truststore.jks:/app/kafka.truststore.jks:ro"
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
- rocksdb
- scheduler
- search-param-registry
- server
- thread-pool-executor-collector

java-version:
Expand Down Expand Up @@ -133,6 +134,7 @@ jobs:
- rocksdb
- scheduler
- search-param-registry
- server
- thread-pool-executor-collector

runs-on: ubuntu-20.04
Expand Down Expand Up @@ -326,7 +328,7 @@ jobs:
run: docker pull ghcr.io/samply/blaze:sha-${{ github.sha }}

- name: Run Blaze
run: docker run --name blaze -d -e JAVA_TOOL_OPTIONS=-Xmx2g -p 8080:8080 -v blaze-data:/app/data ghcr.io/samply/blaze:sha-${{ github.sha }}
run: docker run --name blaze -d -e JAVA_TOOL_OPTIONS=-Xmx2g -p 8080:8080 -p 8081:8081 -v blaze-data:/app/data ghcr.io/samply/blaze:sha-${{ github.sha }}

- name: Sleep 60 Seconds
run: sleep 60
Expand Down Expand Up @@ -448,6 +450,9 @@ jobs:
- name: OPTIONS
run: curl -f -XOPTIONS http://localhost:8080/fhir/metadata

- name: Prometheus Metrics
run: curl -f http://localhost:8081/metrics

jepsen-test:
needs: build
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -713,6 +718,12 @@ jobs:
- name: OPTIONS
run: curl -f -XOPTIONS http://localhost:8080/fhir/metadata

- name: Prometheus Metrics - Blaze 1
run: curl -f http://localhost:8081/metrics

- name: Prometheus Metrics - Blaze 2
run: curl -f http://localhost:8082/metrics

- name: Docker Stats
run: docker stats --no-stream

Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## v0.13.3

### Bugfixes

* Fix Failing Metrics Endpoint ([#547](https://github.com/samply/blaze/pull/547))

### Security

* Fix CVE-2021-37137 in Package io.netty:netty-codec ([#548](https://github.com/samply/blaze/pull/548))

The full changelog can be found [here](https://github.com/samply/blaze/milestone/18?closed=1).

## v0.13.2

### Security
Expand Down
16 changes: 4 additions & 12 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
blaze/rocksdb
{:local/root "modules/rocksdb"}

blaze/server
{:local/root "modules/server"}

blaze/structure-definition
{:local/root "modules/structure-definition"}

Expand All @@ -40,19 +43,8 @@
org.clojure/tools.reader
{:mvn/version "1.3.6"}

org.eclipse.jetty/jetty-server
{:mvn/version "9.4.44.v20210927"}

org.slf4j/slf4j-nop
{:mvn/version "1.7.32"}

ring/ring-jetty-adapter
{:mvn/version "1.9.4"
:exclusions
[clj-time/clj-time
commons-fileupload/commons-fileupload
crypto-equality/crypto-equality
crypto-random/crypto-random]}}
{:mvn/version "1.7.32"}}

:aliases
{:depstar
Expand Down
4 changes: 2 additions & 2 deletions docs/deployment/docker-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Blaze should log something like this:
2021-06-27T11:02:37.834Z ee086ef908c1 main INFO [blaze.core:64] - JVM version: 16.0.2
2021-06-27T11:02:37.834Z ee086ef908c1 main INFO [blaze.core:65] - Maximum available memory: 1738 MiB
2021-06-27T11:02:37.835Z ee086ef908c1 main INFO [blaze.core:66] - Number of available processors: 8
2021-06-27T11:02:37.836Z ee086ef908c1 main INFO [blaze.core:67] - Successfully started Blaze version 0.13.2 in 8.2 seconds
2021-06-27T11:02:37.836Z ee086ef908c1 main INFO [blaze.core:67] - Successfully started Blaze version 0.13.3 in 8.2 seconds
```

In order to test connectivity, query the health endpoint:
Expand All @@ -47,7 +47,7 @@ that should return:
```json
{
"name": "Blaze",
"version": "0.13.2"
"version": "0.13.3"
}
```

Expand Down
12 changes: 6 additions & 6 deletions docs/deployment/manual-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

The installation works under Windows, Linux and macOS. The only dependency is an installed OpenJDK 11. Blaze is tested with [AdoptOpenJDK][1].

Blaze runs on the JVM and comes as single JAR file. Download the most recent version [here](https://github.com/samply/blaze/releases/tag/v0.13.1). Look for `blaze-0.13.2-standalone.jar`.
Blaze runs on the JVM and comes as single JAR file. Download the most recent version [here](https://github.com/samply/blaze/releases/tag/v0.13.1). Look for `blaze-0.13.3-standalone.jar`.

After the download, you can start blaze with the following command (Linux, macOS):

```sh
java -jar blaze-0.13.2-standalone.jar -m blaze.core
java -jar blaze-0.13.3-standalone.jar -m blaze.core
```

Blaze will run with an in-memory, volatile database for testing and demo purposes.
Expand All @@ -17,14 +17,14 @@ Blaze can be run with durable storage by setting the environment variables `STOR
Under Linux/macOS:

```sh
STORAGE=standalone java -jar blaze-0.13.2-standalone.jar -m blaze.core
STORAGE=standalone java -jar blaze-0.13.3-standalone.jar -m blaze.core
```

Under Windows, you need to set the Environment variables in the PowerShell before starting Blaze:

```powershell
$Env:STORAGE="standalone"
java -jar blaze-0.13.2-standalone.jar -m blaze.core
java -jar blaze-0.13.3-standalone.jar -m blaze.core
```

This will create three directories called `index`, `transaction` and `resource` inside the current working directory, one for each database part used.
Expand All @@ -42,7 +42,7 @@ The output should look like this:
2021-06-27T11:02:37.834Z ee086ef908c1 main INFO [blaze.core:64] - JVM version: 16.0.2
2021-06-27T11:02:37.834Z ee086ef908c1 main INFO [blaze.core:65] - Maximum available memory: 1738 MiB
2021-06-27T11:02:37.835Z ee086ef908c1 main INFO [blaze.core:66] - Number of available processors: 8
2021-06-27T11:02:37.836Z ee086ef908c1 main INFO [blaze.core:67] - Successfully started Blaze version 0.13.2 in 8.2 seconds
2021-06-27T11:02:37.836Z ee086ef908c1 main INFO [blaze.core:67] - Successfully started Blaze version 0.13.3 in 8.2 seconds
```

In order to test connectivity, query the health endpoint:
Expand All @@ -62,7 +62,7 @@ that should return:
```json
{
"name": "Blaze",
"version": "0.13.2"
"version": "0.13.3"
}
```

Expand Down
12 changes: 8 additions & 4 deletions modules/anomaly/src/blaze/anomaly.clj
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,14 @@
(busy (.getMessage e)))
ExceptionInfo
(-anomaly [e]
(let [data (.getData e)]
(if (anomaly? data)
data
(fault (.getMessage e)))))
(cond->
(merge
(cond-> {::anom/category ::anom/fault}
(.getMessage e)
(assoc ::anom/message (.getMessage e)))
(.getData e))
(.getCause e)
(assoc :blaze.anomaly/cause (-anomaly (.getCause e)))))
Throwable
(-anomaly [e]
(fault (.getMessage e)))
Expand Down
22 changes: 18 additions & 4 deletions modules/anomaly/test/blaze/anomaly_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,28 @@

(testing "ExceptionInfo"
(testing "without an anomaly in data"
(given (ba/anomaly (ex-info "msg-184349" {}))
(given (ba/anomaly (ex-info "msg-184349" {::foo ::bar}))
::anom/category := ::anom/fault
::anom/message := "msg-184349"))
::anom/message := "msg-184349"
::foo := ::bar))

(testing "with an anomaly in data"
(given (ba/anomaly (ex-info "msg-184349" (ba/incorrect "msg-184433")))
::anom/category := ::anom/incorrect
::anom/message := "msg-184433")))
::anom/message := "msg-184433"))

(testing "without message"
(is (= ::none ((ba/anomaly (ex-info nil {})) ::anom/message ::none))))

(testing "with cause"
(given (ba/anomaly (ex-info "msg-181247" {} (Exception. "msg-181120")))
::anom/message := "msg-181247"
[:blaze.anomaly/cause ::anom/message] := "msg-181120")

(testing "and nil message"
(given (ba/anomaly (ex-info "msg-181247" {} (Exception.)))
::anom/message := "msg-181247"
[:blaze.anomaly/cause #(% ::anom/message ::none)] := ::none))))

(testing "Exception"
(given (ba/anomaly (Exception. "msg-120840"))
Expand All @@ -203,7 +217,7 @@
(deftest try-one-test
(testing "without message"
(is (= (ba/try-one Exception ::anom/fault (throw (Exception.)))
{::anom/category ::anom/fault})))
{::anom/category ::anom/fault})))

(testing "with message"
(given (ba/try-one Exception ::anom/fault (throw (Exception. "msg-134156")))
Expand Down
6 changes: 5 additions & 1 deletion modules/cassandra/deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
{:mvn/version "0.3.3"}

com.datastax.oss/java-driver-core
{:mvn/version "4.13.0"}}
{:mvn/version "4.13.0"}

;; curreny version of transitive dependency of com.datastax.oss/java-driver-core
io.netty/netty-handler
{:mvn/version "4.1.70.Final"}}

:aliases
{:test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns blaze.handler.metrics
(ns blaze.metrics.handler
(:require
[blaze.metrics.spec]
[clojure.spec.alpha :as s]
Expand All @@ -7,11 +7,11 @@
[taoensso.timbre :as log]))


(defmethod ig/pre-init-spec :blaze.handler/metrics [_]
(defmethod ig/pre-init-spec :blaze.metrics/handler [_]
(s/keys :req-un [:blaze.metrics/registry]))


(defmethod ig/init-key :blaze.handler/metrics
(defmethod ig/init-key :blaze.metrics/handler
[_ {:keys [registry]}]
(log/info "Init metrics handler")
(fn [_]
Expand Down
4 changes: 2 additions & 2 deletions modules/metrics/src/blaze/metrics/registry.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


(defmethod ig/pre-init-spec :blaze.metrics/registry [_]
(s/keys :req-un [:blaze.metrics/collectors]))
(s/keys :opt-un [:blaze.metrics/collectors]))


(defn- register-collectors! [registry collectors]
Expand All @@ -29,7 +29,7 @@


(defmethod ig/init-key :blaze.metrics/registry
[_ {:keys [collectors]}]
[_ {:keys [collectors] :or {collectors []}}]
(log/info "Init metrics registry")
(doto (CollectorRegistry. true)
(.register (StandardExports.))
Expand Down
6 changes: 5 additions & 1 deletion modules/metrics/src/blaze/metrics/spec.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
(s/coll-of :blaze.metrics/collector))


(defn registry? [x]
(instance? CollectorRegistry x))


(s/def :blaze.metrics/registry
#(instance? CollectorRegistry %))
registry?)


(s/def :blaze.metrics/metric
Expand Down
60 changes: 60 additions & 0 deletions modules/metrics/test/blaze/metrics/handler_test.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
(ns blaze.metrics.handler-test
(:require
[blaze.metrics.handler]
[blaze.metrics.registry]
[blaze.metrics.spec :as spec]
[blaze.test-util :refer [given-thrown with-system]]
[clojure.spec.alpha :as s]
[clojure.spec.test.alpha :as st]
[clojure.string :as str]
[clojure.test :as test :refer [deftest testing]]
[integrant.core :as ig]
[juxt.iota :refer [given]]
[taoensso.timbre :as log]))


(st/instrument)
(log/set-level! :trace)


(defn- fixture [f]
(st/instrument)
(f)
(st/unstrument))


(test/use-fixtures :each fixture)


(deftest init-test
(testing "nil config"
(given-thrown (ig/init {:blaze.metrics/handler nil})
:key := :blaze.metrics/handler
:reason := ::ig/build-failed-spec
[:explain ::s/problems 0 :pred] := `map?))

(testing "missing config"
(given-thrown (ig/init {:blaze.metrics/handler {}})
:key := :blaze.metrics/handler
:reason := ::ig/build-failed-spec
[:explain ::s/problems 0 :pred] := `(fn ~'[%] (contains? ~'% :registry))))

(testing "invalid registry"
(given-thrown (ig/init {:blaze.metrics/handler {:registry ::invalid}})
:key := :blaze.metrics/handler
:reason := ::ig/build-failed-spec
[:explain ::s/problems 0 :pred] := `spec/registry?
[:explain ::s/problems 0 :val] := ::invalid)))


(def system
{:blaze.metrics/handler {:registry (ig/ref :blaze.metrics/registry)}
:blaze.metrics/registry {}})


(deftest handler-test
(with-system [{:blaze.metrics/keys [handler]} system]
(given (handler nil)
:status := 200
[:headers "Content-Type"] := "text/plain; version=0.0.4; charset=utf-8"
:body :? #(str/starts-with? % "# HELP"))))
Loading

0 comments on commit fd53506

Please sign in to comment.