Giter Club home page Giter Club logo

heroku-deploy-rails's Introduction

heroku-deploy-rails

heroku-deploy-rails is a short shell script that I use to deploy my Rails projects to Heroku.

Installation

Copy deploy.sh into your Rails project, and commit it. Then rename the git remote for your production app to "production":

$ git remote rename heroku production

The reason you need to do this is that deploy.sh will only make backups of your Postgres database when deploying to a remote called "production". If you'd rather call your remote something else, just edit the script.

You'll also want to enable backups on your app, if you haven't already.

$ heroku addons:add pgbackups:auto-month

If you haven't already added a second heroku app to serve as your staging environment, I'd heartily recommend it (but it is optional as far as deploy.sh goes).

Why not just run git push?

It automates two things for me:

  1. It takes a backup of the production database before the deployment.
  2. It runs migrations after the code has been pushed.

It also shows you which commits you're about to deploy, and gives you the option to confirm/abort.

Why not use [insert name of existing project here]?

All the Heroku deployment tools that I've seen to date are written in Ruby. There's nothing wrong with writing jobs that are best handled by a shell script in Ruby, unless you want to hang around while it starts up and want to trawl through a load of unnecessary boilerplate to discover what's really going on.

Some of them are written in Rake. WTF? That's not what Rake is for; it's for resolving dependencies. It's a build tool. Yes, that's right - the clue is in the name - Rake is like Make, which explains why it doesn't support command line arguments or switches. But whatever. If you like smashing yourself in the face with a blunt instrument, be my guest. ;-)

Shell scripting. You've got to love it. Mr Tomayko knows what he's about, so if you don't believe me, believe him instead.

heroku-deploy-rails's People

Contributors

gma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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