{"action":"created","comment":{"url":"https://api.github.com/repos/18F/C2/pulls/comments/35457115","id":35457115,"diff_hunk":"@@ -0,0 +1,57 @@\n+#!/bin/sh\n+\n+# Blue-green deployment script. Usage:\n+#\n+#   ./script/deploy <appname>\n+#\n+# Based on\n+#   http://www.cloudfoundry.rocks/blue-green-deployment-with-cloudfoundry/\n+#   http://docs.pivotal.io/pivotalcf/devguide/deploy-apps/blue-green.html\n+#   https://github.com/dlapiduz/step-cloud-foundry-deploy/blob/master/run.sh\n+\n+set -e\n+set -o pipefail\n+set -x\n+\n+BLUE=$1\n+GREEN=\"${BLUE}-B\"\n+\n+\n+finally ()\n+{\n+  # we don't want to keep the sensitive information around\n+  rm $MANIFEST\n+}\n+\n+on_fail () {\n+  finally\n+  echo \"DEPLOY FAILED - you may need to check 'cf apps' and 'cf routes' and do manual cleanup\"\n+}\n+\n+\n+# pull the up-to-date manifest from the BLUE (existing) application\n+MANIFEST=$(mktemp -t \"${BLUE}_manifest\")\n+cf create-app-manifest $BLUE -p $MANIFEST\n+\n+# set up try/catch\n+# http://stackoverflow.com/a/185900/358804\n+trap on_fail ERR\n+\n+DOMAIN=$(cat $MANIFEST | grep domain: | awk '{print $2}')\n+\n+# create the GREEN application\n+cf push $GREEN -f $MANIFEST -n $GREEN\n+# ensure it starts\n+curl --fail -I \"https://${GREEN}.${DOMAIN}\"\n+\n+# add the \"green\" application to the \"blue\" load balancer\n+cf map-route $GREEN $DOMAIN -n $BLUE\n+\n+# cleanup\n+# TODO consider 'stop'-ing the BLUE instead of deleting it, so that depedencies are cached for next time","path":"script/deploy","position":51,"original_position":51,"commit_id":"a23f78044914fab3877435c2d11debf3617f4958","original_commit_id":"a23f78044914fab3877435c2d11debf3617f4958","user":{"login":"dlapiduz","id":4604,"avatar_url":"https://avatars.githubusercontent.com/u/4604?v=3","gravatar_id":"","url":"https://api.github.com/users/dlapiduz","html_url":"https://github.com/dlapiduz","followers_url":"https://api.github.com/users/dlapiduz/followers","following_url":"https://api.github.com/users/dlapiduz/following{/other_user}","gists_url":"https://api.github.com/users/dlapiduz/gists{/gist_id}","starred_url":"https://api.github.com/users/dlapiduz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlapiduz/subscriptions","organizations_url":"https://api.github.com/users/dlapiduz/orgs","repos_url":"https://api.github.com/users/dlapiduz/repos","events_url":"https://api.github.com/users/dlapiduz/events{/privacy}","received_events_url":"https://api.github.com/users/dlapiduz/received_events","type":"User","site_admin":false},"body":"That is exactly why you do blue green... this is not really blue/green but I like that apps are rebuilt","created_at":"2015-07-24T19:21:15Z","updated_at":"2015-07-24T19:21:15Z","html_url":"https://github.com/18F/C2/pull/500#discussion_r35457115","pull_request_url":"https://api.github.com/repos/18F/C2/pulls/500","_links":{"self":{"href":"https://api.github.com/repos/18F/C2/pulls/comments/35457115"},"html":{"href":"https://github.com/18F/C2/pull/500#discussion_r35457115"},"pull_request":{"href":"https://api.github.com/repos/18F/C2/pulls/500"}}},"pull_request":{"url":"https://api.github.com/repos/18F/C2/pulls/500","id":40616445,"html_url":"https://github.com/18F/C2/pull/500","diff_url":"https://github.com/18F/C2/pull/500.diff","patch_url":"https://github.com/18F/C2/pull/500.patch","issue_url":"https://api.github.com/repos/18F/C2/issues/500","number":500,"state":"open","locked":false,"title":"[Delivers #96622322] add zero-downtime deployment script","user":{"login":"afeld","id":86842,"avatar_url":"https://avatars.githubusercontent.com/u/86842?v=3","gravatar_id":"","url":"https://api.github.com/users/afeld","html_url":"https://github.com/afeld","followers_url":"https://api.github.com/users/afeld/followers","following_url":"https://api.github.com/users/afeld/following{/other_user}","gists_url":"https://api.github.com/users/afeld/gists{/gist_id}","starred_url":"https://api.github.com/users/afeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afeld/subscriptions","organizations_url":"https://api.github.com/users/afeld/orgs","repos_url":"https://api.github.com/users/afeld/repos","events_url":"https://api.github.com/users/afeld/events{/privacy}","received_events_url":"https://api.github.com/users/afeld/received_events","type":"User","site_admin":false},"body":"* [x] Finish testing the app switchover\r\n* [x] Call from the `release` script","created_at":"2015-07-22T21:56:15Z","updated_at":"2015-07-24T19:21:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ec7a7d4a12bad0739a1f4c9b988e2d105f01c09c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/18F/C2/pulls/500/commits","review_comments_url":"https://api.github.com/repos/18F/C2/pulls/500/comments","review_comment_url":"https://api.github.com/repos/18F/C2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/18F/C2/issues/500/comments","statuses_url":"https://api.github.com/repos/18F/C2/statuses/a23f78044914fab3877435c2d11debf3617f4958","head":{"label":"18F:96622322_zero_downtime","ref":"96622322_zero_downtime","sha":"a23f78044914fab3877435c2d11debf3617f4958","user":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"repo":{"id":18201810,"name":"C2","full_name":"18F/C2","owner":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/18F/C2","description":"an approval process automation tool","fork":false,"url":"https://api.github.com/repos/18F/C2","forks_url":"https://api.github.com/repos/18F/C2/forks","keys_url":"https://api.github.com/repos/18F/C2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/18F/C2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/18F/C2/teams","hooks_url":"https://api.github.com/repos/18F/C2/hooks","issue_events_url":"https://api.github.com/repos/18F/C2/issues/events{/number}","events_url":"https://api.github.com/repos/18F/C2/events","assignees_url":"https://api.github.com/repos/18F/C2/assignees{/user}","branches_url":"https://api.github.com/repos/18F/C2/branches{/branch}","tags_url":"https://api.github.com/repos/18F/C2/tags","blobs_url":"https://api.github.com/repos/18F/C2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/18F/C2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/18F/C2/git/refs{/sha}","trees_url":"https://api.github.com/repos/18F/C2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/18F/C2/statuses/{sha}","languages_url":"https://api.github.com/repos/18F/C2/languages","stargazers_url":"https://api.github.com/repos/18F/C2/stargazers","contributors_url":"https://api.github.com/repos/18F/C2/contributors","subscribers_url":"https://api.github.com/repos/18F/C2/subscribers","subscription_url":"https://api.github.com/repos/18F/C2/subscription","commits_url":"https://api.github.com/repos/18F/C2/commits{/sha}","git_commits_url":"https://api.github.com/repos/18F/C2/git/commits{/sha}","comments_url":"https://api.github.com/repos/18F/C2/comments{/number}","issue_comment_url":"https://api.github.com/repos/18F/C2/issues/comments{/number}","contents_url":"https://api.github.com/repos/18F/C2/contents/{+path}","compare_url":"https://api.github.com/repos/18F/C2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/18F/C2/merges","archive_url":"https://api.github.com/repos/18F/C2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/18F/C2/downloads","issues_url":"https://api.github.com/repos/18F/C2/issues{/number}","pulls_url":"https://api.github.com/repos/18F/C2/pulls{/number}","milestones_url":"https://api.github.com/repos/18F/C2/milestones{/number}","notifications_url":"https://api.github.com/repos/18F/C2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/18F/C2/labels{/name}","releases_url":"https://api.github.com/repos/18F/C2/releases{/id}","created_at":"2014-03-28T05:15:23Z","updated_at":"2015-07-17T03:25:35Z","pushed_at":"2015-07-24T17:56:24Z","git_url":"git://github.com/18F/C2.git","ssh_url":"git@github.com:18F/C2.git","clone_url":"https://github.com/18F/C2.git","svn_url":"https://github.com/18F/C2","homepage":"https://cap.18f.gov","size":84737,"stargazers_count":15,"watchers_count":15,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":23,"forks":12,"open_issues":23,"watchers":15,"default_branch":"master"}},"base":{"label":"18F:master","ref":"master","sha":"508d7fa9ae3818367bbaeb1ccde45fafc3ac5e1e","user":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"repo":{"id":18201810,"name":"C2","full_name":"18F/C2","owner":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/18F/C2","description":"an approval process automation tool","fork":false,"url":"https://api.github.com/repos/18F/C2","forks_url":"https://api.github.com/repos/18F/C2/forks","keys_url":"https://api.github.com/repos/18F/C2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/18F/C2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/18F/C2/teams","hooks_url":"https://api.github.com/repos/18F/C2/hooks","issue_events_url":"https://api.github.com/repos/18F/C2/issues/events{/number}","events_url":"https://api.github.com/repos/18F/C2/events","assignees_url":"https://api.github.com/repos/18F/C2/assignees{/user}","branches_url":"https://api.github.com/repos/18F/C2/branches{/branch}","tags_url":"https://api.github.com/repos/18F/C2/tags","blobs_url":"https://api.github.com/repos/18F/C2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/18F/C2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/18F/C2/git/refs{/sha}","trees_url":"https://api.github.com/repos/18F/C2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/18F/C2/statuses/{sha}","languages_url":"https://api.github.com/repos/18F/C2/languages","stargazers_url":"https://api.github.com/repos/18F/C2/stargazers","contributors_url":"https://api.github.com/repos/18F/C2/contributors","subscribers_url":"https://api.github.com/repos/18F/C2/subscribers","subscription_url":"https://api.github.com/repos/18F/C2/subscription","commits_url":"https://api.github.com/repos/18F/C2/commits{/sha}","git_commits_url":"https://api.github.com/repos/18F/C2/git/commits{/sha}","comments_url":"https://api.github.com/repos/18F/C2/comments{/number}","issue_comment_url":"https://api.github.com/repos/18F/C2/issues/comments{/number}","contents_url":"https://api.github.com/repos/18F/C2/contents/{+path}","compare_url":"https://api.github.com/repos/18F/C2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/18F/C2/merges","archive_url":"https://api.github.com/repos/18F/C2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/18F/C2/downloads","issues_url":"https://api.github.com/repos/18F/C2/issues{/number}","pulls_url":"https://api.github.com/repos/18F/C2/pulls{/number}","milestones_url":"https://api.github.com/repos/18F/C2/milestones{/number}","notifications_url":"https://api.github.com/repos/18F/C2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/18F/C2/labels{/name}","releases_url":"https://api.github.com/repos/18F/C2/releases{/id}","created_at":"2014-03-28T05:15:23Z","updated_at":"2015-07-17T03:25:35Z","pushed_at":"2015-07-24T17:56:24Z","git_url":"git://github.com/18F/C2.git","ssh_url":"git@github.com:18F/C2.git","clone_url":"https://github.com/18F/C2.git","svn_url":"https://github.com/18F/C2","homepage":"https://cap.18f.gov","size":84737,"stargazers_count":15,"watchers_count":15,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":23,"forks":12,"open_issues":23,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/18F/C2/pulls/500"},"html":{"href":"https://github.com/18F/C2/pull/500"},"issue":{"href":"https://api.github.com/repos/18F/C2/issues/500"},"comments":{"href":"https://api.github.com/repos/18F/C2/issues/500/comments"},"review_comments":{"href":"https://api.github.com/repos/18F/C2/pulls/500/comments"},"review_comment":{"href":"https://api.github.com/repos/18F/C2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/18F/C2/pulls/500/commits"},"statuses":{"href":"https://api.github.com/repos/18F/C2/statuses/a23f78044914fab3877435c2d11debf3617f4958"}}}}