/openshift-cartridge-nats

Custom cartridge for OpenShift providing NATS.

Primary LanguageShellMIT LicenseMIT

NATS cartridge for OpenShift

This is a custom OpenShift cartridge for NATS, a open-source, high-performance, lightweight cloud native messaging system

Usage

Open your application in the web console, go to "See the list of cartridges you can add", paste the URL below in "Install your own cartridge" textbox at the bottom of the page and click "Next".

https://raw.githubusercontent.com/fh1ch/openshift-cartridge-nats/master/metadata/manifest.yml

Then you can use NATS_URL environment variable to connect from an application running in the main web cartridge.

For instance, here's how you'd do it in a Node.js application using node-nats:

var nats = require('nats');
...
var nc = nats.connect({
  url: process.env.NATS_URL
});

Using the command line

Make sure you have rhc installed (see here).

If you want to add a NATS instance based on this cartridge to an existing application:

rhc cartridge-add https://raw.githubusercontent.com/fh1ch/openshift-cartridge-nats/master/metadata/manifest.yml \
  --app appname

...where appname is the name of your application.

To create an app based on the standard Node.js v0.10 cartridge and this one, run:

rhc app create appname \
  nodejs-0.10 \
  https://raw.githubusercontent.com/fh1ch/openshift-cartridge-nats/master/metadata/manifest.yml

License

The MIT License

Copyright (c) 2016 Fabio Huser fabio@fh1.ch