Git Product home page Git Product logo

parity's Introduction

Parity

Shell commands for development, staging, and production parity for Heroku apps.

Install

On OS X, this installs everything you need:

brew tap thoughtbot/formulae
brew install parity

On other systems you can:

  1. Download the package for your system from the releases page
  2. Extract the tarball and place it so that /bin is in your PATH

Parity requires these command-line programs:

git
heroku
pg_restore

On OS X, these programs are installed as Homebrew package dependencies of the parity Homebrew package.

Usage

Backup a database:

production backup
staging backup

Restore a production or staging database backup into development:

development restore production
development restore staging

Restore a production database backup into staging:

staging restore production

Push your local development database backup up to staging:

staging restore development

Deploy from master, and migrate and restart the dynos if necessary:

production deploy
staging deploy

Open a console:

production console
staging console

Migrate a database and restart the dynos:

production migrate
staging migrate

Tail a log:

production tail
staging tail

Use redis-cli with your REDIS_URL add-on:

production redis-cli
staging redis-cli

The scripts also pass through, so you can do anything with them that you can do with heroku ______ --remote staging or heroku ______ --remote production:

watch production ps
staging open

Convention

Parity expects:

  • A staging remote pointing to the staging Heroku app.
  • A production remote pointing to the production Heroku app.
  • There is a config/database.yml file that can be parsed as YAML for ['development']['database'].
  • The Heroku apps are named like app-staging and app-production where app is equal to basename $PWD.

Customization

If you have Heroku environments beyond staging and production (such as a feature environment for each developer), you can add a binstub to the bin folder of your application. Custom environments share behavior with staging: they can be backed up and can restore from production.

Using feature environments requires including Parity as a gem in your application's Gemfile.

gem "parity"

Here's an example binstub for a 'feature-geoff' environment, hosted at myapp-feature-geoff.herokuapp.com.

#!/usr/bin/env ruby

require "parity"

if ARGV.empty?
  puts Parity::Usage.new
else
  Parity::Environment.new("feature-geoff", ARGV).run
end

Contributing

Please see CONTRIBUTING.md for details.

Releasing

See guidelines in RELEASING.md for details

License

Parity is © 2013-2015 thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About thoughtbot

thoughtbot

Parity is maintained and funded by thoughtbot, inc. The names and logos for thoughtbot are trademarks of thoughtbot, inc.

We are passionate about open source software. See our other projects. We are available for hire.

parity's People

Contributors

geoffharcourt avatar bernerdschaefer avatar croaky avatar andrewhr avatar gabebw avatar georgebrock avatar jberlinsky avatar joelq avatar rikkipitt avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  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.