heroku_tools


Nameheroku_tools JSON
Version 0.3.3 PyPI version JSON
download
home_pagehttps://github.com/yunojuno/heroku-tools
SummaryCommand line application for managing Heroku applications.
upload_time2017-05-17 14:00:34
maintainer
docs_urlNone
authorHugo Rodger-Brown
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements click dateutils mock PyYAML requests sarge
Travis-CI
coveralls test coverage
            Heroku Tools
============

Opinionated tools for managing Heroku applications, based on the workflow used by YunoJuno, outlined in `this blog post <http://tech.yunojuno.com/deploying-django-apps-to-heroku-3>`_.

.. image:: https://travis-ci.org/yunojuno/heroku-tools.svg?branch=master
    :target: https://travis-ci.org/yunojuno/heroku-tools
.. image:: https://badge.fury.io/py/heroku-tools.svg
    :target: https://badge.fury.io/py/heroku-tools

Background
----------

We (YunoJuno) have been deploying our application to Heroku for the past three years, and we've evolved a set of Fabric scripts to help us with this process. This project is extracted out of that work. It includes CLI applications for deploying apps to Heroku and managing configuration via remote config vars.

It is **opinionated**, and enforces a specific workflow, and can (currently) be used for deploying only Django applications.

Workflow
--------

The workflow that this application supports is based on `gitflow <http://nvie.com/posts/a-successful-git-branching-model/>`_, and works in the following way.

The project has two permanent git branches - ``master`` and ``dev`` (as per gitflow), and three Heroku environments: **live**, **uat** and **dev**.

The dev branch is deployed to the **dev** environment, and is where integration testing is done. Developers working locally on feature branches do their own testing locally, and when they are finished, submit pull requests for merging their branch back into dev. When this is done, dev is pushed.

When a release is due, dev is merged into master, and the master branch is pushed to **uat** and **live** environments. The only difference between these two is that **uat** is not public, and so is used for final testing (e.g. User Acceptance Testing). This may map to "pre-production" or "staging" in other projects.

(Following this model, code is pushed 'up' through the environments from **dev** to **uat** to **live**. At the same time, data is migrated down through the environments from **live** to **uat** to **dev**. The **uat** environment is where the latest code meets the latest data - hence it being used for testing. This project will also contain data migration and anonymisation scripts once ported over.)

Heroku Deployments
------------------

Deploying an application to Heroku is often described as being as simple as a single ``git push``, which is technically correct. That will update your application. However, in most real-world scenarios this is wholly inadequate.

In most cases it looks more like this:

1. See what's in the proposed deployment (``git log``)
2. Turn on the app maintenance page
3. Push up the code
4. Run collectstatic ^^
5. Run post-deployment tasks - eg: database migrations
6. Turn off maintenance page
7. Write a release note
8. Inform others of the deployment

This project encapsulates these steps.

^^ Collectstatic will run automatically as part of the default Herkou Django buildpack, but if you are pushing content to CDN this may not be the desired behaviour, and you may wish to run ``collectstatic`` explicitly post-deployment.

.. code:: shell

    $ heroku-tools deploy dev
    $ heroku-tools deploy dev --branch feature/xxx

The command to apply Migrations is specified via the configuration file as a post_deploy action. This is a change compared to version of Heroku-tools < 0.3

Deployments
-----------

**UPDATE** This project has been scaled back in ambition - the deploy function is no longer generic, and is specifically written for Django.

This project contains a ``deploy`` command line application that reinforces this workflow. It takes a number of options (run ``deploy --help`` for the full list), but by default it will enforce the workflow described above. A deployment the the dev environment will push the dev branch, uat will push master, etc. It will run a diff against the remote Heroku repo to determine the list of commits (and changed files) that will be pushed, and infer from that whether to run the migrations and collectstatic.

The workflow specifics are configured in application / environment files:

.. code:: YAML

    application:

        # the name of the Heroku application
        name: live_app
        # the default branch to push to this application
        branch: master
        # use the heroku pipeline:promote feature
        pipeline: True
        # the upstream application to promote
        upstream: staging_app
        # add a tag to the commit using the release version from Heroku
        add_tag: False
        # add a tag, and write a release note into the tag message (experimental)
        add_rich_tag: False

    # Heroku application environment settings managed by the conf command
    settings:

        DJANGO_DEBUG: True
        DJANGO_SECRET_KEY: foobar
        DJANGO_SETTINGS_MODULE: my_app.settings
        DATABASE_URL: postgres://postgres:postres@heroku.com/my_app

Configuration
-------------

The ``config`` command line application incorporates our `configuration management process <http://tech.yunojuno.com/managing-multiple-heroku-configurations>`_. It sets application environment variables from the settings block in the ``application.conf`` file. Before applying the settings to the Heroku application it will run a diff against the current value of each setting in the local file. It prints out the diff, so that you can see which settings will be applied, and prompts the user to confirm that the settings should be applied before pushing to Heroku.

Status
------

In development. Please don't use right now.

            

Raw data

            {
    "maintainer": "", 
    "docs_url": null, 
    "requires_python": "", 
    "maintainer_email": "", 
    "cheesecake_code_kwalitee_id": null, 
    "keywords": "", 
    "upload_time": "2017-05-17 14:00:34", 
    "requirements": [
        {
            "name": "click", 
            "specs": [
                [
                    "==", 
                    "6.6"
                ]
            ]
        }, 
        {
            "name": "dateutils", 
            "specs": [
                [
                    "==", 
                    "0.6.6"
                ]
            ]
        }, 
        {
            "name": "mock", 
            "specs": [
                [
                    "==", 
                    "2.0.0"
                ]
            ]
        }, 
        {
            "name": "PyYAML", 
            "specs": [
                [
                    "==", 
                    "3.12"
                ]
            ]
        }, 
        {
            "name": "requests", 
            "specs": [
                [
                    "==", 
                    "2.11.1"
                ]
            ]
        }, 
        {
            "name": "sarge", 
            "specs": [
                [
                    "==", 
                    "0.1.4"
                ]
            ]
        }
    ], 
    "author": "Hugo Rodger-Brown", 
    "home_page": "https://github.com/yunojuno/heroku-tools", 
    "github_user": "yunojuno", 
    "download_url": "https://pypi.python.org/packages/0f/d6/e409c1e5fb31c39a961d90f2dece0ff68b932878a802084dce657bf32f6c/heroku-tools-0.3.3.tar.gz", 
    "platform": "", 
    "version": "0.3.3", 
    "cheesecake_documentation_id": null, 
    "description": "Heroku Tools\n============\n\nOpinionated tools for managing Heroku applications, based on the workflow used by YunoJuno, outlined in `this blog post <http://tech.yunojuno.com/deploying-django-apps-to-heroku-3>`_.\n\n.. image:: https://travis-ci.org/yunojuno/heroku-tools.svg?branch=master\n    :target: https://travis-ci.org/yunojuno/heroku-tools\n.. image:: https://badge.fury.io/py/heroku-tools.svg\n    :target: https://badge.fury.io/py/heroku-tools\n\nBackground\n----------\n\nWe (YunoJuno) have been deploying our application to Heroku for the past three years, and we've evolved a set of Fabric scripts to help us with this process. This project is extracted out of that work. It includes CLI applications for deploying apps to Heroku and managing configuration via remote config vars.\n\nIt is **opinionated**, and enforces a specific workflow, and can (currently) be used for deploying only Django applications.\n\nWorkflow\n--------\n\nThe workflow that this application supports is based on `gitflow <http://nvie.com/posts/a-successful-git-branching-model/>`_, and works in the following way.\n\nThe project has two permanent git branches - ``master`` and ``dev`` (as per gitflow), and three Heroku environments: **live**, **uat** and **dev**.\n\nThe dev branch is deployed to the **dev** environment, and is where integration testing is done. Developers working locally on feature branches do their own testing locally, and when they are finished, submit pull requests for merging their branch back into dev. When this is done, dev is pushed.\n\nWhen a release is due, dev is merged into master, and the master branch is pushed to **uat** and **live** environments. The only difference between these two is that **uat** is not public, and so is used for final testing (e.g. User Acceptance Testing). This may map to \"pre-production\" or \"staging\" in other projects.\n\n(Following this model, code is pushed 'up' through the environments from **dev** to **uat** to **live**. At the same time, data is migrated down through the environments from **live** to **uat** to **dev**. The **uat** environment is where the latest code meets the latest data - hence it being used for testing. This project will also contain data migration and anonymisation scripts once ported over.)\n\nHeroku Deployments\n------------------\n\nDeploying an application to Heroku is often described as being as simple as a single ``git push``, which is technically correct. That will update your application. However, in most real-world scenarios this is wholly inadequate.\n\nIn most cases it looks more like this:\n\n1. See what's in the proposed deployment (``git log``)\n2. Turn on the app maintenance page\n3. Push up the code\n4. Run collectstatic ^^\n5. Run post-deployment tasks - eg: database migrations\n6. Turn off maintenance page\n7. Write a release note\n8. Inform others of the deployment\n\nThis project encapsulates these steps.\n\n^^ Collectstatic will run automatically as part of the default Herkou Django buildpack, but if you are pushing content to CDN this may not be the desired behaviour, and you may wish to run ``collectstatic`` explicitly post-deployment.\n\n.. code:: shell\n\n    $ heroku-tools deploy dev\n    $ heroku-tools deploy dev --branch feature/xxx\n\nThe command to apply Migrations is specified via the configuration file as a post_deploy action. This is a change compared to version of Heroku-tools < 0.3\n\nDeployments\n-----------\n\n**UPDATE** This project has been scaled back in ambition - the deploy function is no longer generic, and is specifically written for Django.\n\nThis project contains a ``deploy`` command line application that reinforces this workflow. It takes a number of options (run ``deploy --help`` for the full list), but by default it will enforce the workflow described above. A deployment the the dev environment will push the dev branch, uat will push master, etc. It will run a diff against the remote Heroku repo to determine the list of commits (and changed files) that will be pushed, and infer from that whether to run the migrations and collectstatic.\n\nThe workflow specifics are configured in application / environment files:\n\n.. code:: YAML\n\n    application:\n\n        # the name of the Heroku application\n        name: live_app\n        # the default branch to push to this application\n        branch: master\n        # use the heroku pipeline:promote feature\n        pipeline: True\n        # the upstream application to promote\n        upstream: staging_app\n        # add a tag to the commit using the release version from Heroku\n        add_tag: False\n        # add a tag, and write a release note into the tag message (experimental)\n        add_rich_tag: False\n\n    # Heroku application environment settings managed by the conf command\n    settings:\n\n        DJANGO_DEBUG: True\n        DJANGO_SECRET_KEY: foobar\n        DJANGO_SETTINGS_MODULE: my_app.settings\n        DATABASE_URL: postgres://postgres:postres@heroku.com/my_app\n\nConfiguration\n-------------\n\nThe ``config`` command line application incorporates our `configuration management process <http://tech.yunojuno.com/managing-multiple-heroku-configurations>`_. It sets application environment variables from the settings block in the ``application.conf`` file. Before applying the settings to the Heroku application it will run a diff against the current value of each setting in the local file. It prints out the diff, so that you can see which settings will be applied, and prompts the user to confirm that the settings should be applied before pushing to Heroku.\n\nStatus\n------\n\nIn development. Please don't use right now.\n", 
    "tox": true, 
    "lcname": "heroku_tools", 
    "bugtrack_url": null, 
    "github": true, 
    "coveralls": true, 
    "name": "heroku_tools", 
    "license": "MIT", 
    "travis_ci": true, 
    "github_project": "heroku-tools", 
    "summary": "Command line application for managing Heroku applications.", 
    "split_keywords": [], 
    "author_email": "hugo@yunojuno.com", 
    "urls": [
        {
            "has_sig": false, 
            "upload_time": "2017-05-17T14:00:34", 
            "comment_text": "", 
            "python_version": "source", 
            "url": "https://pypi.python.org/packages/0f/d6/e409c1e5fb31c39a961d90f2dece0ff68b932878a802084dce657bf32f6c/heroku-tools-0.3.3.tar.gz", 
            "md5_digest": "843ab62ce1b5e8edf0593e11a7175dd9", 
            "downloads": 0, 
            "filename": "heroku-tools-0.3.3.tar.gz", 
            "packagetype": "sdist", 
            "path": "0f/d6/e409c1e5fb31c39a961d90f2dece0ff68b932878a802084dce657bf32f6c/heroku-tools-0.3.3.tar.gz", 
            "size": 16683
        }, 
        {
            "has_sig": false, 
            "upload_time": "2017-05-17T14:00:35", 
            "comment_text": "", 
            "python_version": "2.7", 
            "url": "https://pypi.python.org/packages/a1/7e/449e254e48b231535206910d5ef818dd8c65100711b9a684885830559c0e/heroku_tools-0.3.3-py2-none-any.whl", 
            "md5_digest": "1d748e9d01949b38f56fa940824a84ee", 
            "downloads": 0, 
            "filename": "heroku_tools-0.3.3-py2-none-any.whl", 
            "packagetype": "bdist_wheel", 
            "path": "a1/7e/449e254e48b231535206910d5ef818dd8c65100711b9a684885830559c0e/heroku_tools-0.3.3-py2-none-any.whl", 
            "size": 22196
        }
    ], 
    "_id": null, 
    "cheesecake_installability_id": null
}