GithubHelp home page GithubHelp logo

isabella232 / cf-cassandra-spring-example-app Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vmware-archive/cf-cassandra-spring-example-app

0.0 0.0 0.0 43 KB

License: Apache License 2.0

Java 100.00%

cf-cassandra-spring-example-app's Introduction

Example Cassandra Application

This simple application illustrates the use of the Pivotal Cassandra data service in a Java Spring application running on Pivotal Cloud Foundry.

Installation

Running locally

To run the application locally, you need first to create a keyspace in your cassandra.

$> cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.2.3 | CQL spec 3.3.1 | Native protocol v4]
Use HELP for help.

cqlsh> CREATE KEYSPACE example WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };

The default keyspace name is example. You can change it in the application.properties file.

Running on Cloud Foundry

Create a Cassandra service instance

Find your Cassandra service via cf marketplace.

$ cf marketplace
Getting services from marketplace in org testing / space testing as me...
OK

service       plans          description
p-cassandra   multi-tenant   Cassandra service powered by DataStax Enterprise

Our service is called p-cassandra. To create an instance of this service, use:

$ cf create-service p-cassandra multi-tenant cf-cassandra-example-service

Push the Example Application

First, you need to build the app. Ensure that you have got JDK v8 installed and your JAVA_HOME path correctly set.

On OSX you can set your JAVA_HOME path as follows

$ export JAVA_HOME=`/usr/libexec/java_home`
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home
brew install gradle
gradle assemble

The example application comes with a Cloud Foundry manifest.yml file, which provides all of the defaults necessary for an easy cf push.

To push the application, just run:

$ cf push

Usage

You can now read, write and delete "users" by GETting, POSTing and DELETEing to /users.

$ curl -X GET  http://cassandra-example-app.example.com/users
$ curl -H "Content-Type: application/json" -X POST -d '{"username":"foobar", "fname": "foo", "lname": "bar"}' http://cassandra-example-app.example.com/users

Be sure to replace example.com with the actual domain of your Pivotal Cloud Foundry installation.

cf-cassandra-spring-example-app's People

Contributors

benlaplanche avatar jamiemonserrate avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.