Dedicate Redis services for your Cloud Foundry
Keep your Cloud Foundry services simple - run one service per server and delegate the creation and deletion to BOSH.
This is a simple
cf CLI plugin to create and delete dedicated redis services, and bind them into existing Cloud Foundry applications.
Example create/bind/delete scenario:
$ cf prepare-redis $ cf create-redis $ cf bind-redis-env-var myapp $ cf delete-redis
The redis servers are run outside of the Cloud Foundry deployment and are bound to Cloud Foundry applications via environment variables (until the new Service Connector is supported). It is currently
You must use the same BOSH for deploying redis as you use to deploy Cloud Foundry (unless your DNS is configured to be shared across the two BOSH).
It is also requried that you have login access to the same BOSH being used to deploy your Cloud Foundry.
Confirm this by running:
$ bosh status $ bosh deployments
The former will confirm you are targeting a bosh. The latter will display the deployments. One of which should be your Cloud Foundry.
Install via RubyGems:
$ gem install bosh_cli "~> 1.5.0.pre" --source https://s3.amazonaws.com/bosh-jenkins-gems/ $ gem install redis-cf-plugin
bosh_cli gem is currently only available from S3, rather than RubyGem itself. So it needs to be installed first.
Each time you install the latest
redis-cf-plugin you will want to re-upload the latest available redis release to your bosh. If no newer release is available then nothing good nor bad will occur.
$ cf prepare-redis Uploading new redis release to bosh...
To create/provision a new redis service you run the following command. By default, it will select the smallest known instance size.
$ cf create-redis myapp-redis $ cf create-redis myapp-redis --size small $ cf create-redis myapp-redis --size medium $ cf create-redis myapp-redis --size large $ cf create-redis myapp-redis --size xlarge
To see the list of available instance sizes or to edit the list of available instance size, see the section "Customizing" below.
To bind the redis service to an existing Cloud Foundry application (regardless if its running or not) via a simple URI passed as an environment variable, you run the following command. By default, the environment variable is
$ cf bind-redis-env-var myapp-redis myapp $ cf bind-redis-env-var myapp-redis myapp --env-var REDISTOGO
Currently there is no way to load the redis service into Cloud Foundry as a "provisioned service instance". This will be implemented soon (in association with the Service Connector API).
TODO - how to show available instance sizes TODO - how to edit available instance sizes (via the bosh deployment file templates)
Releasing new plugin gem versions
There are three reasons to release new versions of this plugin.
- Package the latest redis-boshrelease bosh release (which describes how the redis service is implemented)
- New features or bug fixes to the plugin
- Fix regressions caused by newer versions of the
cfCLI or newer Cloud Foundry releases
To package the latest "final release" of the redis bosh release into this source repository, run the following command:
$ cd /path/to/releases $ git clone https://github.com/cloudfoundry-community/redis-boshrelease.git $ cd - $ rake bosh:release:import[/path/to/releases/redis-boshrelease] # for zsh shell quotes are required around rake arguments: $ rake bosh:release:import'[/path/to/releases/redis-boshrelease]'
Note: only the latest "final release" will be packaged. See https://github.com/cloudfoundry-community/redis-boshrelease#readme for information on creating new bosh releases.
To install and test the plugin:
$ rake install $ cf
To release a new version of the plugin as a RubyGem:
redis-cf-plugin.gemspecto update the major or minor or patch version.
- Run the release command:
$ rake release
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request