GithubHelp home page GithubHelp logo

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

View Code? Open in Web Editor NEW

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

0.0 0.0 0.0 18 KB

An example app using the Cassandra Service Broker

Ruby 97.24% Shell 2.76%

cf-cassandra-example-app's Introduction

Example Cassandra Application Build Status

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

Installation

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   default   Cassandra service

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

$ cf create-service p-cassandra default cassandra

Push the Example Application

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

$ cf push
Using manifest file cf-cassandra-example-app/manifest.yml

Creating app cassandra-example-app in org testing / space testing as me...
OK

Using route cassandra-example-app.example.com
Binding cassandra-example-app.example.com to cassandra-example-app...
OK

Uploading cassandra-example-app...
Uploading from: cf-cassandra-example-app
...
Showing health and status for app cassandra-example-app in org testing / space testing as me...
OK

requested state: started
instances: 0/1
usage: 256M x 1 instances
urls: cassandra-example-app.10.244.0.34.xip.io

     state     since                    cpu    memory          disk
#0   running   2014-04-10 01:42:43 PM   0.0%   75.5M of 256M   0 of 1G

If you now curl the application, you'll see that the application has detected that it's not bound to a cassandra instance.

$ curl http://cassandra-example-app.example.com/

      You must bind a Cassandra service instance to this application.

      You can run the following commands to create an instance and bind to it:

        $ cf create-service cassandra default cassandra-instance
        $ cf bind-service app-name cassandra-instance

Bind the Instance

Now, simply bind the cassandra instance to our application.

$ cf bind-service cassandra-example-app cassandra

Usage

You can now read and write records by GETting and POSTing to /table/key. Be sure to create the table, first. In the example below, we create a table named entries, add a key/value pair named foo with a value of bar, and retrieve the value back from foo.

$ curl -X POST http://cassandra-example-app.example.com/entries
$ curl -X POST http://cassandra-example-app.example.com/entries/foo/bar
$ curl -X GET  http://cassandra-example-app.example.com/entries/foo
bar

Of course, be sure to replace example.com with the actual domain of your Pivotal Cloud Foundry installation.

cf-cassandra-example-app's People

Contributors

aramprice avatar callisto13 avatar cghsystems 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.