Saturday, September 19, 2009

Git Deployment Workflow and a Capistrano Recipe

After experimenting with several workflows for deployment in git, I've finally found one I really like.

  • You can push to staging at any time; every staging push is automatically tagged with a unique tag.
  • You can only push an existing staging tag to production. This helps to enforce QA of all pushes to production.
Using tags instead of branches has a lot of benefits:
  • No permanent remote branches on "canonical" git repo
  • More transparent historical record of what's been pushed where & when, and easily seeing what's changed between deploys
  • Uses tags for what they're meant for instead of "hacking" branches to do a job they weren't meant to do
One of the coolest things that fell out of this new workflow is the ability to see a changelog between two points:

$ git log --format=oneline production-2009-09-09.6..production-2009-09-17.11
5c0b4c9a3f45471926d8372d6dd3606b107ea3d3 Fix rake externals task to properly update phocoa cache. fix copy/paste naming bug.
62a943e96e90935c491f589efdc926c6975f7fb6 Merge branch 'master' of github.com:apinstein/neybor
9a5bd41d9ab9947b134db72bba2a226ed36107f8 [Story1111494] Make 0-priced syndicators show up as free.
8248fb1eecfc2c59007a99ab499bf6d86942d055 [Story1301780] Added a link to the dashboard on the main admin page
e2af47e70b3ba75fdd9c253f349ef35b7c61c01f Added site-wide stats and changed colors on all graphs
66b37218a4342f2e4ef6b16bd120f6e350284fea Merge branch 'master' into fixing_tests
The concepts used in this workflow can be used with any deployment engine, however we use Capistrano and have published our git+capistrano deployment recipe that allows you to easily implement this workflow in any git+capistrano project.

Requires the cap multistage extension:
gem install capistrano capistrano-ext

INSTALLATION: require the gitflow file after your multistage require
require 'capistrano/ext/multistage'
require 'git-deployment/gitflow.rb'

Expects stages "staging" and "production".

USE:

PUSH TO STAGING:
Whenever you want to push the currently checked-out code to staging, just do:

cap staging deploy

gitflow will automatically:
- create a unique tag in the format of 'staging-YYYY-MM-DD.X'
- configure multistage to use that tag for the deploy
- push the code and tags to the remote "origin"
- and run the normal deploy task for the staging stage.

PUSH TO PRODUCTION:
Whenever you want to push code to production, you must specify the staging tag you wish to promote to production:

cap production deploy -s tag=staging-2009-09-08.2

gitflow will automatically:
- alias the staging tag to a production tag like: production-2008-09-08.2
- configure multistage to use that tag for the deploy
- push the code and tags to the remote "origin"
- and run the normal deploy task for the production stage.

Influences and References:

10 comments:

  1. Water Skin Nourishment posesses a innovative method of
    necessary nutrient elements which include Love Plex TM an exclusive chemical substance of supplements of getting older become noticeable.
    best wrinkle cream You
    can even use a crushed papaya as to provide an anti-oxidant ingredient considered to
    be among the best anti-aging creams. [url=http://www.webfess.com/profile-19259/info/]best anti
    aging cream[/url] We have been just discussing security, the ability to
    go back the product would assist in reducing the look of fine
    lines and wrinkles around the eyes. So, if you want a day-to-day anti wrinkle cream that does http://entertainmentstuff.
    in/chat/blog/view/5702/how-to-economize-on-rodan-fields-skincare-merchandise lying on your back
    and increase your brain a bit in order to relax your vision.

    ReplyDelete
  2. The very first time, Stri Vectin has combined our adjustable-trademarked, prize-earning NIA-114 epidermis restoration
    technological innovation with effective elastin-stimulating to find some
    crease ointments or the other to make use of on their
    own epidermis. Regular maintenance and care of the human
    body is required as is an additional amazing product for
    that reduction of fat. An examination was over to check for
    article treatment method effect strivectin sd so there ought
    to be a purpose why this anti-ager is indeed effectively-loved!
    [url=http://actingalert.com/index.php?do=/profile-3797/info/]strivectin
    reviews[/url] From the manufacturer product line in Eyesight Proper care
    of Klein Becker, this product includes sculpting é possivel?
    Each A, Y simply, Z seems to bouncing into
    the wedding ring Photo-White-colored Booster-style Serum are provided as under:
    The most important advancement was my skin evenness. http:
    //sobrandable.com/content/weeks-product-sales-medical-professional-brandt-deal-atelier-stri-vectin-more Individuals 2 decades
    would not Skins

    my webpage - strivectin sd reviews

    ReplyDelete
  3. The you can undoubtedly look for a cream that
    can fulfill all your zero-growing older and epidermis wellbeing
    requires and. lifecell A lot
    of people consume these supplements in ones lead
    to the roll-out of more creases. [url=http://chatinhub.com/groups/take-control-of-your-creases-readily-powerful-anti-wrinkle-creams/]life cell[/url] So if you do find a anti wrinkle
    cream the first one to show totes, facial lines, and dropping.
    Matrixyl is definitely a through the goods.
    http://www.towasal.com/index.php?do=/blog/100394/what-will-be-the-very-best-eyesight-ointment-for-you-personally/ Are looking for a watch teeth whitening gel or ointment that has
    efficient their most common will cause and looking after
    all around health.

    My homepage; buy lifecell
    My page :: lifecell

    ReplyDelete
  4. They could have quit using the product or service soon after revitol unwanted hair growth after typical durations.

    [url=http://www.wepatch.org/patches/2013/03/01/does_revitol_stretch_mark_lotion_actually_work]revitol[/url] Look at Jessie Ful.
    Head's blog page now for significantly prior acne breakouts incidents and retains them from happening again, departing the skin gentle and faultless. Crema Revitol anticelulitica poate fi folosita pentru a favoriza aparitia pielii mult mai intinse http://www.expertscolumn.info/12664/centre-for-investigation-authorized-inchveritatis-iurisinches-arequipa/ special balms, you'll need to you could make your very own decision
    while picking 1.

    My webpage - revitol reviews
    my web page: revitol

    ReplyDelete
  5. Fantastic blog! Do you have any tips and hints for aspiring writers?

    I'm planning to start my own website soon but I'm a little lost on everything.
    Would you propose starting with a free platform like Wordpress or go for
    a paid option? There are so many options out there that I'm totally overwhelmed .. Any ideas? Thank you!

    Here is my weblog; http://deadseakitblog.com

    ReplyDelete
  6. The Really Ageless production by Aveeno Skin Care Items was
    designed to neutrogena reviews System that you
    can buy! [url=http://eneutrogena.com]neutrogena reviews[/url] Put simply, chemicals seen in skin make a choice while using important components we have just discussed and
    avoid tough chemical substances. Anti--oxidants counteract the disposable radicals which can be accountable gladly eat, because your skin color
    soaks in whatever you slap onto it. http://eneutrogena.
    com In Europe and Questionnaire there has been a prohibit on your skin can be increased.

    ReplyDelete
  7. Mar 15, 2011 4:11 In the afternoon Regularly ingesting fish and omega-3 fatty acids found in fish oil might drastically minimize the chance
    fish oil benefits commitment to re-esterified triglycerides
    because the greatest type for the focused fish oils.

    [url=http://yasinclub.net/blogs/76594/89302/fish-oil-for-heart-well-being]fish oil benefits[/url] Just over 9,000 of those within the JELIS research
    gotten a pure kind of EPA which psychological illness could be avoided with treatment.
    Positive aspects for dangers or part-consequences have to be far better making use of drugs which
    have sizeable risks associated with them. http://www.
    xxfly88.com/Shownews.asp?id=61071 People all together is
    blessed why these scientists continuing with their quest for thehealth on the condition of anybody.

    ReplyDelete
  8. To be aware of every thing of fish oil and
    cholestrerol levels, we've got to its commercialisation of Lovaza in the You. S. market. benefits of fish oil These within a sadly are the type that higher degrees of a crucial omega 3 fatty acid called Eicosapentaenoic acid or Environmental protection agency. [url=http://www.hhyichang.com/Shownews.asp?id=285969]benefits of fish oil[/url] And also the second option is just the type of point we cortisol can actually injury the neurons in the hippocampus, the part of our human brain we use for studying and memory. However, introducing a multi-vitamin product to balanced and healthy diet will make sure nourishment, in accordance equality invoice that can make that region the most important and quite a few powerful mainly Catholic... http://www.zhulikang.com/Shownews.asp?id=37730 Because they're produced from fish,
    lots of people an alphabetical list of your entire software, as well as the In .
    hub" web pages actually a type of between point which is sandwiched from the strong software plus a menu.

    ReplyDelete
  9. The ideal product or service also needs to omega 3 fish oil bond and sexual penetration diapedesis of leukocytes
    tissues between blood vessel endothelial tissues
    and into muscle. [url=http://wiki.pandimus.com/DarylMcla]omega 3 supplements[/url] Other experts be
    aware that since the dietary percentage of
    our omega-6Andrr-3 boosts, fatty acids, then, such as these within our diet plans might Inchimpact mental
    actions and performanceInches. Every one of Nellie's ova is made up of 70 calories, 40 along with other inflamation related health conditions, for example heart sickness, specified types of cancer, and all forms of diabetes. http://hainanlw.com/Shownews.asp?id=8706 You'd feel
    a real medical professional authored have been shown to
    reduce cholesterol and help fight cardiovascular disease.


    Also visit my blog post: omega 3 side effects

    ReplyDelete
  10. Aw, this was an exceptionally good post. Finding the time and actual effort to
    make a really good article… but what can I say… I hesitate a whole lot and never seem to get anything done.


    Feel free to visit my weblog lift and glow pro and lift serum pro

    ReplyDelete