Skip to content
This repository has been archived by the owner on Feb 12, 2020. It is now read-only.

Commit

Permalink
Merge pull request #4 from USGS-EROS/develop
Browse files Browse the repository at this point in the history
3.4.1 release
  • Loading branch information
davidvhill authored Aug 28, 2018
2 parents a0eb2a2 + 79fcd3d commit 8672484
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 34 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
VERSION :=`./bin/version`
IMAGE := usgseros/lcmap-nemo
BRANCH := $(or $(TRAVIS_BRANCH),`git rev-parse --abbrev-ref HEAD | tr / -`)
BRANCH := $(or $(TRAVIS_BRANCH),`git rev-parse --abbrev-ref HEAD`)
BRANCH := $(shell echo $(BRANCH) | tr / -)
BUILD_TAG := $(IMAGE):build
TAG := $(shell if [ "$(BRANCH)" = "master" ];\
then echo "$(IMAGE):$(VERSION)";\
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ to discover tables, partition keys & partition data.
| /table1?key1=0&key2=value1| [{ <partition data> }] |
+-----------------------------+-------------------------------------+

Documentation (WIP)
Documentation
-------------------
* `Changelog <docs/changelog.rst/>`_
* `Running <docs/running.rst/>`_
Expand Down
22 changes: 17 additions & 5 deletions dev/user.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,26 @@
(:import [org.joda.time DateTime]))


;;
;; Starting a REPL will automatically setup and start the system.
;;
(defn init
[]
(setup/init))

(try
(defn start
[]
(try
(print "starting mount components...")
(mount/start)
(print "...ready!")
(catch RuntimeException ex
(print "There was a problem automatically setting up and running nemo.")
(stacktrace/print-cause-trace ex)))
(stacktrace/print-cause-trace ex))))

(defn stop
[]
(try
(print "stopping mount components...")
(mount/stop)
(print "... stopped!")
(catch RuntimeException ex
(print "There was a problem automatically tearing down nemo.")
(stacktrace/print-cause-trace ex))))
8 changes: 7 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

3.4.1
-----
- Improves user.clj namespace init, start and stop for dev environment
- Correctly use :db-port to connect to Cassandra
- Update docs to include use of DB_CONNECT_TIMEOUT_MILLIS & DB_READ_TIMEOUT_MILLIS

3.4.0
------
-----
Initial release, supporting CQL 3.4.
20 changes: 10 additions & 10 deletions docs/developing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ Set up Development Database
# development database is configured in project.clj :repl profile
# may override with profiles.clj
lein repl
user=> (require '[lcmap.nemo.setup :as setup])
user=> (setup/init)
user=> (init)
Launch Nemo
-----------
Expand All @@ -36,13 +35,14 @@ Launch Nemo
# run Nemo from lein
lein run
# run Nemo from repl (starts automatically)
# run Nemo from repl
lein repl
user=> (mount/stop)
user=> (mount/start)
user=> (start)
The repl will automatically import most Nemo namespaces using short aliases, and
will also attempt to launch Nemo at repl startup.
# stop Nemo if necessary
user=> (stop)
The repl will automatically import most Nemo namespaces using short aliases

See `user.clj <../dev/user.clj/>`_

Expand All @@ -68,15 +68,15 @@ Build Nemo
Compiling lcmap.nemo.tables
Compiling lcmap.nemo.db
Compiling lcmap.nemo.main
Created /home/user/lcmap-nemo/target/nemo-1.0.0-SNAPSHOT.jar
Created /home/user/lcmap-nemo/target/nemo-1.0.0-SNAPSHOT-standalone.jar
Created /home/user/lcmap-nemo/target/nemo-3.4.1-SNAPSHOT.jar
Created /home/user/lcmap-nemo/target/nemo-3.4.1-SNAPSHOT-standalone.jar
Run Nemo
--------
See `Running <running.rst/>`_

Deploy to Dockerhub
-------------------
Travis-ci automatically builds each commit and pushes a built Docker image to Dockerhub tagged with the version and branchname.
Travis-CI automatically builds each commit and pushes a built Docker image to Dockerhub tagged with the version and branchname.

To deploy manually, see the `Makefile <../Makefile/>`_.
8 changes: 6 additions & 2 deletions docs/running.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ From a jarfile:
export DB_PASS=cassandra_pw
export DB_KEYSPACE=target_keyspace
export DB_TABLES=table1,table2,table3
export DB_CONNECT_TIMEOUT_MILLIS=30000
export DB_READ_TIMEOUT_MILLIS=600000
# use make uberjar or lein uberjar to build
java -jar lcmap-nemo-3.4.0-standalone.jar
java -jar lcmap-nemo-3.4.1-standalone.jar
From Docker:
Expand All @@ -32,4 +34,6 @@ From Docker:
-e DB_PASS=cassandra_pw \
-e DB_KEYSPACE=target_keyspace \
-e DB_TABLES=table1,table2,table3 \
usgseros/lcmap-nemo:3.4.0
-e DB_CONNECT_TIMEOUT_MILLIS=30000 \
-e DB_READ_TIMEOUT_MILLIS=600000 \
usgseros/lcmap-nemo:3.4.1
4 changes: 2 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(defproject lcmap-nemo "3.4.0"
:description "Cassandra table HTTP Adapter"
(defproject lcmap-nemo "3.4.1"
:description "Cassandra HTTP Partition Server"
:url "http://github.com/usgs-eros/lcmap-nemo"
:license {:name "Unlicense"
:url ""}
Expand Down
23 changes: 13 additions & 10 deletions src/lcmap/nemo/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
Values are obtained from ENV variables and/or profiles.clj. These are:
| ENV | Description |
| -------------- | ----------------------------------------|
| `HTTP_PORT` | HTTP listener port |
| `DB_HOST` | Cassandra node |
| `DB_USER` | Cassandra username |
| `DB_PASS` | Cassandra password |
| `DB_PORT` | Cassandra cluster port |
| `DB_KEYSPACE` | Cassandra keyspace name |
| `DB_TABLES` | Cassandra tables to expose as resources |
| ENV | Description |
| --------------------------- | ----------------------------------------|
| `DB_HOST` | Cassandra node |
| `DB_USER` | Cassandra username |
| `DB_PASS` | Cassandra password |
| `DB_PORT` | Cassandra cluster port |
| `DB_KEYSPACE` | Cassandra keyspace name |
| `DB_TABLES` | Cassandra tables to expose as resources |
| `DB_CONNECT_TIMEOUT_MILLIS` | Cassandra connection timeout |
| `DB_READ_TIMEOUT_MILLIS` | Cassandra read timeout |
| `HTTP_PORT` | HTTP listener port |
"
(:require [clojure.tools.logging :as log]
[environ.core :refer [env]]
Expand All @@ -38,7 +40,7 @@
{:db-host (-> env :db-host)
:db-user (-> env :db-user)
:db-pass (-> env :db-pass)
:db-port (-> env :db-port)
:db-port (-> env :db-port util/numberize)
:db-keyspace (-> env :db-keyspace)
:db-tables (-> env :db-tables string->vector)
:db-connect-timeout-millis (util/numberize
Expand Down Expand Up @@ -80,6 +82,7 @@
"alia shaped configuration"
[e]
{:contact-points (-> e :db-host string->vector)
:port (:db-port e)
:credentials {:user (:db-user e) :password (:db-pass e)}
:query-options {:consistency (:consistency e)}
:load-balancing-policy (:load-balancing-policy e)
Expand Down
2 changes: 1 addition & 1 deletion src/lcmap/nemo/main.clj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
(lcmap.nemo.util/add-shutdown-hook)
(log/debug "nemo start")
(log/debug "environment" (config/sanitize (config/checked-environment)))
;; Remember, only mount states defined that are defined
;; Remember, only mount states that are defined
;; in required namespaces are started.
(mount.core/start)
(catch RuntimeException ex
Expand Down
5 changes: 4 additions & 1 deletion test/lcmap/nemo/config_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

(deftest alia-test
(testing "testing alia configuration"
(let [env {:db-host "host1,host2"
(let [env {:db-host " host1, host2 "
:db-port 9999
:db-user "user"
:db-pass "pass"
:consistency "1"
:load-balancing-policy "lbp"}
cfg (alia env)]

(is (= ["host1" "host2"] (:contact-points cfg)))
(is (= 9999 (:port cfg)))
(is (= {:user "user" :password "pass"} (:credentials cfg)))
(is (= {:consistency "1"} (:query-options cfg)))
(is (= "lbp" (:load-balancing-policy cfg))))))

0 comments on commit 8672484

Please sign in to comment.