npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bx-blue-green

v1.3.0

Published

zero-downtime deployment for Cloud Foundry based applications on bluemix

Downloads

5

Readme

Build Status

Build Status

uses bx-blue-green-test as a simple application to ensure that this project is able to download and install the CLI as well as push the deployment to bluemix

Blue-green deployments for Cloud Foundry based Bluemix apps

Allows zero-downtime deployments of applications within Bluemix, with no additional setup needed.

This repo is heavily based off of cf-blue-green

When to use bx-blue-green instead of cf-blue-green

This project uses the bluemix command line directly allowing it to leverage some of the new features added to bluemix.

The Bluemic CLI adds extra functionality to Cloud Foundry command line, if you are deploying onto Bluemix, it is best to migrate over to the Bluemix CLI as it will contain the latest functionality for Bluemix related deployments.

One notable feature that is now part of the Bluemix CLI is the ability to create an API key in order to avoid having to use a One-time login token.

For steps on creating a Bluemix API key click here

Bluemix API key

To generate your Bluemix API key follow these steps:

demo

alternatively you can run

bluemix iam api-key-create <key-name> -d <description> -f <output-file>

Once the key is created, you may create an environment variable with the key BLUEMIX_API_KEY and when running bx login it will check for that variable first and if it exists, it will log you in.

Usage

  1. Install the bx CLI v0.6.0+.
  2. Run npm install -g https://github.com/andresfvilla/bx-blue-green.
    • See Notes below for non-Node installation.
  3. Run bx-blue-green <appname> (instead of bx cf push) from your application directory to deploy.

This creates a copy of your already-running application, and safely switches traffic over to it. It's recommended that you try this script on a non-production application environment first, just to ensure that everything is switched over properly.

Notes

Manual installation

The script is distributed via NPM, but doesn't actually require Node.js beyond that. If you don't want to install Node, simply:

  1. Download the script.
  2. Run chmod a+x bx-blue-green.
  3. Move the file somewhere in your PATH.

Using with Travis

Travis supports continuous deployment, which will automatically deploy your application after its tests pass on a specified branch. To use bx-blue-green with Travis, you need to use a script provider instead of the default Cloud Foundry provider. Your Cloud Foundry settings are read from environment variables.

Set up continuous deployment with the following settings in your .travis.yml file:

To add an encrypted Bluemix API key use travis encrypt BLUEMIX_API_KEY=<api-key> --add

sudo: true
env:
  global:
  - BX_APP=[app name]
  - BX_API=[API endpoint]
  - BX_ORGANIZATION=[organization]
  - BX_SPACE=[space]
  - BX_SLEEP=[# seconds to wait before swapping BLUE with GREEN]
  - BX_IGNORE_DEFAULT_ROUTE=[true/false Will ignore the orgs default route when deploying new app]
  - BX_PATH=[path to app]
  - secure: [BLUEMIX_API_KEY=[encrypted with Travis](http://docs.travis-ci.com/user/environment-variables/#Encrypted-Variables)]
before_deploy: npm install -g https://github.com/andresfvilla/bx-blue-green
deploy:
  provider: script
  script: bx-blue-green-travis
  on:
    branch: [git branch you want to deploy]

BX_SLEEP - defines the number of seconds to sleep before replacing BLUE with GREEN. Useful when the new application requires some time to start.

B_DOMAIN - Use this to specify a specific domain for where your green app will be stood up ( Usually equal to your default route )

BX_IGNORE_DEFAULT_ROUTE - will force the green app to use the domain specified in B_DOMAIN. If your green app is being deployed to a route you specifically do not want, set this variable to true. If this is set, then B_DOMAIN is required

BX_PATH - Path to app directory or to a zip file of the contents of the app directory

Manifests

bx-blue-green creates a temporary manifest from your live application, meaning that it ignores the manifest.yml in your directory, if you have one. To deploy any changes to your manifest, use bx cf push directly.

Multiple domains

The script fails on apps with multiple domains, because the domains in the manifest are in the form of a list:

domain:
  - 18f.gov
  - digitalgov.gov

To work around this, use the env var B_DOMAIN for the domain you'd like the B instance to use.

Resources

More information about blue-green deployment, all of which this script drew from.

  • http://www.cloudfoundry.rocks/blue-green-deployment-with-cloudfoundry/
  • http://martinfowler.com/bliki/BlueGreenDeployment.html
  • http://docs.pivotal.io/pivotalcf/devguide/deploy-apps/blue-green.html
  • https://github.com/dlapiduz/step-cloud-foundry-deploy/blob/master/run.sh