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

Split Command Line and Core Library #41

Open
wants to merge 11 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
51 changes: 51 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Pillar Changes

## 1.0.1

* Add a "destroy" method to drop a keyspace (iamsteveholmes)

## 1.0.3

* Clarify documentation (pvenable)
* Update DataStax Cassandra driver to version 2.0.2 (magro)
* Update Scala to version 2.10.4 (magro)
* Add cross-compilation to Scala version 2.11.1 (magro)
* Shutdown cluster in migrate & initialize (magro)
* Transition support from StreamSend to Chris O'Meara (comeara)

## 2.0.0

* Allow configuration of Cassandra port (fkoehler)
* Rework Migrator interface to allow passing a Session object when integrating Pillar as a library (magro, comeara)

## 2.0.1

* Update a argot dependency to version 1.0.3 (magro)

## 2.1.0

* Update DataStax Cassandra driver to version 3.0.0 (MarcoPriebe)
* Fix documentation issue where authored_at represented as seconds rather than milliseconds (jhungerford)
* Introduce PILLAR_SEED_ADDRESS environment variable (comeara)

## 2.1.1

* Fix deduplicate error during merge, ref. issue #32 (ilovezfs)

## 2.2.0

* Add feature to read registry from files (sadowskik)
* Add TLS/SSL support(bradhandy, comeara)
* Add authentication support (bradhandy, comeara)

## 2.3.0

* Add multiple stages per migration (sadowskik)

## 3.0.0

* Support Scala 2.12 (comeara)
* Split Pillar command line interface and core library into separate artifacts (comeara)
* Add SLF4J binding for command line interface (comeara)
* Update command-line interface to use command and sub-command structure (comeara)
* Remove RPM build (comeara)
106 changes: 40 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Pillar

[![Maven Central](https://img.shields.io/maven-central/v/com.chrisomeara/pillar_2.12.svg)][pillar_2.12]

Pillar manages migrations for your [Cassandra][cassandra] data stores.

[cassandra]:http://cassandra.apache.org
Expand All @@ -24,29 +26,29 @@ databases with one key difference: Pillar is completely independent from any app
### From Source

This method requires [Simple Build Tool (sbt)][sbt].
Building an RPM also requires [Effing Package Management (fpm)][fpm].

% sbt assembly # builds just the jar file in the target/ directory

% sbt rh-package # builds the jar and the RPM in the target/ directory
% sudo rpm -i target/pillar-1.0.0-DEV.noarch.rpm

The RPM installs Pillar to /opt/pillar.
```
% sbt assembly # builds a fat jar file in the target/ directory
```

[sbt]:http://www.scala-sbt.org
[fpm]:https://github.com/jordansissel/fpm

### Packages

Pillar is available at Maven Central under the GroupId com.chrisomeara and ArtifactId pillar_2.10 or pillar_2.11. The current version is 2.3.0.
Pillar is available at Maven Central under the GroupId com.chrisomeara and ArtifactId [pillar_2.10][pillar_2.10],
[pillar_2.11][pillar_2.11] or [pillar_2.12][pillar_2.12]. The current version is 3.0.0.

#### sbt

libraryDependencies += "com.chrisomeara" % "pillar_2.10" % "2.3.0"
```
libraryDependencies += "com.chrisomeara" %% "pillar" % "3.0.0"
```

#### Gradle

compile 'com.chrisomeara:pillar_2.10:2.3.0'
```
compile 'com.chrisomeara:pillar_2.12:3.0.0'
```

## Usage

Expand All @@ -69,8 +71,8 @@ Here's the short version:

1. Write migrations, place them in conf/pillar/migrations/myapp.
1. Add pillar settings to conf/application.conf.
1. % pillar -e development initialize myapp
1. % pillar -e development migrate myapp
1. % pillar initialize -e development myapp
1. % pillar migrate -e development myapp

#### Migration Files

Expand Down Expand Up @@ -179,7 +181,6 @@ application.conf might look like the following:
acceptance_test {
cassandra-seed-address: ${?PILLAR_SEED_ADDRESS}
cassandra-port: ${?PILLAR_PORT}
cassandra-keyspace-name: "pillar_acceptance_test"
cassandra-keyspace-name: ${?PILLAR_KEYSPACE_NAME}
cassandra-ssl: ${?PILLAR_SSL}
cassandra-username: ${?PILLAR_USERNAME}
Expand Down Expand Up @@ -211,89 +212,62 @@ $JAVA_OPTS are passed through to the JVM when using the pillar executable.

#### The pillar Executable

The package installs to /opt/pillar by default. The /opt/pillar/bin/pillar executable usage looks like this:
The Pillar executable usage looks like this:

Usage: pillar [OPTIONS] command data-store
Usage: pillar [initialize|migrate] data-store

OPTIONS
Command: initialize [options]

-d directory
--migrations-directory directory The directory containing migrations
-e, --environment <value>

-e env
--environment env environment
Command: migrate [options]

-t time
--time-stamp time The migration time stamp
-e, --environment <value>

PARAMETERS
-t, --time-stamp <value>

command migrate or initialize
-d, --migrations-directory <value>

data-store The target data store, as defined in application.conf
data-store

#### Examples

Initialize the faker datastore development environment

% pillar -e development initialize faker
% pillar initialize -e development faker

Apply all migrations to the faker datastore development environment

% pillar -e development migrate faker
% pillar migrate -e development faker

### Library

You can also integrate Pillar directly into your application as a library.
Reference the acceptance spec suite for details.
You can also integrate Pillar directly into your application as a library. Reference the [pillar-core][core] repository for
more information regarding Pillar library integration.

### Forks
[core]:https://github.com/comeara/pillar-core

## Forks

Several organizations and people have forked the Pillar code base. The most actively maintained alternative is
the [Galeria-Kaufhof fork][gkf].

[gkf]:https://github.com/Galeria-Kaufhof/pillar

### Release Notes

#### 1.0.1

* Add a "destroy" method to drop a keyspace (iamsteveholmes)

#### 1.0.3

* Clarify documentation (pvenable)
* Update DataStax Cassandra driver to version 2.0.2 (magro)
* Update Scala to version 2.10.4 (magro)
* Add cross-compilation to Scala version 2.11.1 (magro)
* Shutdown cluster in migrate & initialize (magro)
* Transition support from StreamSend to Chris O'Meara (comeara)

#### 2.0.0

* Allow configuration of Cassandra port (fkoehler)
* Rework Migrator interface to allow passing a Session object when integrating Pillar as a library (magro, comeara)

#### 2.0.1

* Update a argot dependency to version 1.0.3 (magro)
## Change Log

#### 2.1.0
Please reference the [Pillar Changes][changes] document.

* Update DataStax Cassandra driver to version 3.0.0 (MarcoPriebe)
* Fix documentation issue where authored_at represented as seconds rather than milliseconds (jhungerford)
* Introduce PILLAR_SEED_ADDRESS environment variable (comeara)
[changes]: CHANGES.md

#### 2.1.1
## Upgrade Instructions

* Fix deduplicate error during merge, ref. issue #32 (ilovezfs)
Please reference the [Pillar Upgrades][upgrade] document.

#### 2.2.0
[upgrade]: UPGRADE.md

* Add feature to read registry from files (sadowskik)
* Add TLS/SSL support(bradhandy, comeara)
* Add authentication support (bradhandy, comeara)

#### 2.3.0

* Add multiple stages per migration (sadowskik)
[pillar_2.10]: https://maven-badges.herokuapp.com/maven-central/com.chrisomeara/pillar_2.10
[pillar_2.11]: https://maven-badges.herokuapp.com/maven-central/com.chrisomeara/pillar_2.11
[pillar_2.12]: https://maven-badges.herokuapp.com/maven-central/com.chrisomeara/pillar_2.12
32 changes: 32 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Pillar Upgrades

## Version 2 to Version 3

When upgrading from version 2 to version 3, please consider the following.

### Command Line Interface Change

In version 2, the command line interface required the -e option, which specifies the environment, to come before the
subcommand. The subcommands are ```initialize``` and ```migrate```.

Version 3 places the subcommand as the first argument, followed by all options, ending with the datastore.

For example, in version 2, you might have run the following command to initialize your test keyspace:

% pillar -e test initialize

In version 3, that command becomes:

% pillar initialize -e test

### Code Repackaging

In version 2, all the Scala classes were packaged in ```com.chrisomeara.pillar```.

In version 3, the cli has been packaged in ```com.chrisomeara.pillar.cli``` and the core of pillar has been moved to
```com.chrisomeara.pillar.core```.

### RPM Build Removal

Version 3 removes the RedHat Package Manager build. If this feature interests you please open a new issue so that we
can discuss how to best re-implement.
48 changes: 48 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
lazy val pillarVersion = "3.0.0"

organization := "com.chrisomeara"
name := "pillar"
version := pillarVersion
scalaVersion := "2.12.1"
crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.1")
homepage := Some(url("https://github.com/comeara/pillar"))
licenses := Seq("MIT license" -> url("http://www.opensource.org/licenses/mit-license.php"))
libraryDependencies ++= Seq(
"com.chrisomeara" %% "pillar-core" % pillarVersion,
"com.github.scopt" %% "scopt" % "3.5.0",
"com.typesafe" % "config" % "1.0.1",
"org.mockito" % "mockito-core" % "1.9.5" % "test",
"org.scalatest" %% "scalatest" % "3.0.1" % "test",
"org.slf4j" % "slf4j-simple" % "1.7.22"
)
publishMavenStyle := true
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
publishArtifact in Test := false
pomIncludeRepository := { _ => false }
pomExtra := (
<scm>
<url>[email protected]:comeara/pillar.git</url>
<connection>scm:git:[email protected]:comeara/pillar.git</connection>
</scm>
<developers>
<developer>
<id>comeara</id>
<name>Chris O'Meara</name>
<url>https://github.com/comeara</url>
</developer>
</developers>)

test in assembly := {}
assemblyMergeStrategy in assembly := {
case PathList("javax", "servlet", xs@_*) => MergeStrategy.first
case "META-INF/io.netty.versions.properties" => MergeStrategy.last
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
Loading