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 #1 from USGS-EROS/develop
Browse files Browse the repository at this point in the history
3.4.0 release
  • Loading branch information
davidvhill authored Jun 22, 2018
2 parents a38511c + 5862187 commit a0eb2a2
Show file tree
Hide file tree
Showing 31 changed files with 2,037 additions and 2 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/
25 changes: 25 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
language: clojure

jdk:
- openjdk8

services:
- docker

sudo: required

before_install:
- sudo sysctl -w vm.max_map_count=262144
- make deps-up-d
- sudo apt-get update -qq

deploy:
- provider: script
script: make uberjar && make docker-build && make docker-tag && make docker-push
on:
all_branches: true

notifications:
slack:
rooms:
- lcmap:UTqlh9PfPVomfpli10WKyZoh#cicd
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM openjdk:alpine
MAINTAINER USGS LCMAP http://eros.usgs.gov

ARG version
ENV jarfile lcmap-nemo-$version-standalone.jar
ENV HTTP_PORT 5757

RUN mkdir /app
WORKDIR /app
COPY target/$jarfile $jarfile
COPY resources/log4j.properties log4j.properties

ENTRYPOINT java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -server -XX:+UseG1GC -jar $jarfile
49 changes: 49 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
VERSION :=`./bin/version`
IMAGE := usgseros/lcmap-nemo
BRANCH := $(or $(TRAVIS_BRANCH),`git rev-parse --abbrev-ref HEAD | tr / -`)
BUILD_TAG := $(IMAGE):build
TAG := $(shell if [ "$(BRANCH)" = "master" ];\
then echo "$(IMAGE):$(VERSION)";\
else echo "$(IMAGE):$(VERSION)-$(BRANCH)";\
fi)

deps-up:
docker-compose -f resources/docker-compose.yml up nemo-cassandra

deps-up-d:
docker-compose -f resources/docker-compose.yml up -d nemo-cassandra

deps-down:
docker-compose -f resources/docker-compose.yml down nemo-cassandra

uberjar:
lein uberjar

clean:
lein clean

test:
lein test

docker-build:
@docker build --build-arg version=$(VERSION) -t $(BUILD_TAG) --rm=true --compress $(PWD)

docker-tag:
@docker tag $(BUILD_TAG) $(TAG)

docker-login:
@$(if $(and $(DOCKER_USER), $(DOCKER_PASS)), docker login -u $(DOCKER_USER) -p $(DOCKER_PASS), docker login)

docker-push: docker-login
docker push $(TAG)

all: clean test uberjar docker-build docker-tag docker-push

debug:
@echo "VERSION: $(VERSION)"
@echo "IMAGE: $(IMAGE)"
@echo "BRANCH: $(BRANCH)"
@echo "BUILD_TAG: $(BUILD_TAG)"
@echo "TAG: $(TAG)"


2 changes: 0 additions & 2 deletions README.md

This file was deleted.

89 changes: 89 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
.. image:: https://travis-ci.org/USGS-EROS/lcmap-nemo.svg?branch=develop
:target: https://travis-ci.org/USGS-EROS/lcmap-nemo

==========
lcmap-nemo
==========
Read Apache Cassandra partitions over HTTP.

On DockerHub
------------

https://hub.docker.com/r/usgseros/lcmap-nemo

Features
--------
* Represents Apache Cassandra partitions as JSON over HTTP
* Works with all supported Cassandra data types
* Simple configuration: keyspace, table list, credentials, hosts and ports
* Dynamic discoverability: tables, partition keys and data
* Built on Clojure 1.9, http-kit, Ring & Compojure

Dynamic Discoverability
-----------------------
Nemo resources create a traversable tree which allows clients
to discover tables, partition keys & partition data.

+-----------------------------+-------------------------------------+
| Resource | Result |
+=============================+=====================================+
|.. code-block:: ReST | .. code-block:: javascript |
| | |
| / | { "tables": ["table1", "table2"] }|
+-----------------------------+-------------------------------------+
|.. code-block:: ReST | .. code-block:: javascript |
| | |
| /table1 | { |
| | { "key1": 0, "key2": "value1" },|
| | { "key1": 1, "key2": "value2" } |
| | } |
+-----------------------------+-------------------------------------+
|.. code-block:: ReST | .. code-block:: javascript |
| | |
| /table1?key1=0&key2=value1| [{ <partition data> }] |
+-----------------------------+-------------------------------------+

Documentation (WIP)
-------------------
* `Changelog <docs/changelog.rst/>`_
* `Running <docs/running.rst/>`_
* `Developing <docs/developing.rst/>`_
* `HTTP requests & responses <docs/http.rst/>`_
* `Notes <docs/notes.rst/>`_

Versioning
----------
Nemo follows semantic versioning: http://semver.org/

Major & minor version octets match CQL major & minor versions.

The third octet is reserved for Nemo releases against Cassandra.

See https://cassandra.apache.org/doc/latest/cql/changes.html#id2.

License
-------
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to http://unlicense.org.
2 changes: 2 additions & 0 deletions bin/version
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
echo `head -n1 project.clj | grep -oP "[\d+]\.[\d+]\.[\d+](-SNAPSHOT)?(-RC[\d+])?"`
27 changes: 27 additions & 0 deletions dev/user.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
(ns user
"Developer namespace."
(:require [clojure.edn :as edn]
[clojure.stacktrace :as stacktrace]
[lcmap.nemo.config :as config]
[lcmap.nemo.db :as db]
[lcmap.nemo.http :as http]
[lcmap.nemo.jmx :as jmx]
[lcmap.nemo.setup :as setup]
[lcmap.nemo.util :as util]
[mount.core :as mount])
(:use [clojure.repl]
[clojure.tools.namespace.repl :only (refresh)])
(:import [org.joda.time DateTime]))


;;
;; Starting a REPL will automatically setup and start the system.
;;

(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)))
6 changes: 6 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Changelog
=========

3.4.0
------
Initial release, supporting CQL 3.4.
82 changes: 82 additions & 0 deletions docs/developing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
Developing Nemo
===============

Get the Code
------------
.. code-block:: bash
git clone https://github.com/usgs-eros/lcmap-nemo
All releases are merged to master and tagged.

If fixes to a previous version are necessary the tag should be checked out
from master into a topic branch, then merged to a release branch matching the
new version. The release branch should then be merged into master and tagged as before.

Launch Cassandra
-------------------
.. code-block:: bash
make deps-up
Set up Development Database
---------------------------
.. code-block:: bash
# 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)
Launch Nemo
-----------
.. code-block:: bash
# run Nemo from lein
lein run
# run Nemo from repl (starts automatically)
lein repl
user=> (mount/stop)
user=> (mount/start)
The repl will automatically import most Nemo namespaces using short aliases, and
will also attempt to launch Nemo at repl startup.
See `user.clj <../dev/user.clj/>`_
Test Nemo
---------
.. code-block:: bash
# uses the test profile in project.clj
# warnings and stack traces are expected as long as all tests pass
make tests
Build Nemo
----------
.. code-block:: bash
# may also use make uberjar
user@machine:~/lcmap-nemo$ lein uberjar
Compiling lcmap.nemo.config
Compiling lcmap.nemo.http
Compiling lcmap.nemo.util
Compiling lcmap.nemo.jmx
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
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.
To deploy manually, see the `Makefile <../Makefile/>`_.
Loading

0 comments on commit a0eb2a2

Please sign in to comment.