Skip to content

Instantly share code, notes, and snippets.

@nheath
Created July 7, 2015 16:34
Show Gist options
  • Select an option

  • Save nheath/ee6aaa509b44e7909c96 to your computer and use it in GitHub Desktop.

Select an option

Save nheath/ee6aaa509b44e7909c96 to your computer and use it in GitHub Desktop.

Revisions

  1. Nick Heath created this gist Jul 7, 2015.
    16 changes: 16 additions & 0 deletions gistfile1.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    @task(default=True)
    def deploy(source):
    execute('unique_id')
    dest = '/opt/app/{0}'.format(env['unique_id'])

    # both of these tasks are decorated with @parallel
    execute('sync', source=source, dest='~/app')
    execute('install', source="~/app", dest=dest)

    # apply following steps serially to each env.host
    host = env.host
    meta = get_metadata('ip', host)
    execute('elb_remove', hosts=host, region=meta['region'], instanceid=meta['id'])
    execute('deploy_symlink', hosts=host, source=dest, target='/opt/app')
    execute('service_restart', hosts=host, service="app")
    execute('elb_add', hosts=host, region=meta['region'], instanceid=meta['id'])