{"action":"created","comment":{"url":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/comments/46990823","id":46990823,"diff_hunk":"@@ -27,8 +35,39 @@ resource \"null_resource\" \"cockroach-provisioner\" {\n   }\n \n   provisioner \"file\" {\n-    source = \"launch.sh\"\n-    destination = \"/home/ubuntu/launch.sh\"\n+    source = \"download_binary.sh\"\n+    destination = \"/home/ubuntu/download_binary.sh\"\n+  }\n+\n+  # This writes the filled-in supervisor template. It would be nice if we could\n+  # use rendered templates in the file provisioner.\n+  provisioner \"remote-exec\" {\n+    inline = <<FILE\n+echo '${template_file.supervisor.rendered}' > supervisor.conf\n+FILE\n+  }\n+\n+  provisioner \"remote-exec\" {\n+    inline = [\n+      \"sudo apt-get -qqy update\",\n+      \"sudo apt-get -qqy install supervisor\",\n+      \"sudo service supervisor stop\",\n+      \"bash download_binary.sh cockroach\",\n+      \"mkdir -p logs\",\n+      \"if [ ! -e supervisor.pid ]; then supervisord -c supervisor.conf; fi\",\n+      \"supervisorctl -c supervisor.conf start cockroach\",\n+    ]\n+  }\n+}\n+\n+# The initializer is only run on the first instance and should be run only once.","path":"terraform/aws/main.tf","position":53,"original_position":53,"commit_id":"e18d28f48eff0912f7a3f0c89bd2c913f3467e01","original_commit_id":"e18d28f48eff0912f7a3f0c89bd2c913f3467e01","user":{"login":"bdarnell","id":160562,"avatar_url":"https://avatars.githubusercontent.com/u/160562?v=3","gravatar_id":"","url":"https://api.github.com/users/bdarnell","html_url":"https://github.com/bdarnell","followers_url":"https://api.github.com/users/bdarnell/followers","following_url":"https://api.github.com/users/bdarnell/following{/other_user}","gists_url":"https://api.github.com/users/bdarnell/gists{/gist_id}","starred_url":"https://api.github.com/users/bdarnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdarnell/subscriptions","organizations_url":"https://api.github.com/users/bdarnell/orgs","repos_url":"https://api.github.com/users/bdarnell/repos","events_url":"https://api.github.com/users/bdarnell/events{/privacy}","received_events_url":"https://api.github.com/users/bdarnell/received_events","type":"User","site_admin":false},"body":"Then how does it get run the first time? ","created_at":"2015-12-08T18:16:10Z","updated_at":"2015-12-08T18:16:10Z","html_url":"https://github.com/cockroachdb/cockroach-prod/pull/54#discussion_r46990823","pull_request_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/54","_links":{"self":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/comments/46990823"},"html":{"href":"https://github.com/cockroachdb/cockroach-prod/pull/54#discussion_r46990823"},"pull_request":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/54"}}},"pull_request":{"url":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/54","id":52897703,"html_url":"https://github.com/cockroachdb/cockroach-prod/pull/54","diff_url":"https://github.com/cockroachdb/cockroach-prod/pull/54.diff","patch_url":"https://github.com/cockroachdb/cockroach-prod/pull/54.patch","issue_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues/54","number":54,"state":"open","locked":false,"title":"Single-step cluster turnup.","user":{"login":"mberhault","id":5901480,"avatar_url":"https://avatars.githubusercontent.com/u/5901480?v=3","gravatar_id":"","url":"https://api.github.com/users/mberhault","html_url":"https://github.com/mberhault","followers_url":"https://api.github.com/users/mberhault/followers","following_url":"https://api.github.com/users/mberhault/following{/other_user}","gists_url":"https://api.github.com/users/mberhault/gists{/gist_id}","starred_url":"https://api.github.com/users/mberhault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mberhault/subscriptions","organizations_url":"https://api.github.com/users/mberhault/orgs","repos_url":"https://api.github.com/users/mberhault/repos","events_url":"https://api.github.com/users/mberhault/events{/privacy}","received_events_url":"https://api.github.com/users/mberhault/received_events","type":"User","site_admin":false},"body":"* add a \"cockroach-initializer\" null resource. Runs only once.\r\n* remove launch.sh in favor of supervisor\r\n* use tiny program that talks to supervisor and gets final status\r\n\r\nThis is a more reliable way of watching processes and stopping then, as\r\nwell as getting the final status (runtime and exit code).\r\n\r\nThe null_resource setup in terraform can cause issues when instances go\r\ndown through anything other than terraform. Still a TODO.\r\nSome of the other logic in the scripts may get moved to go as well.","created_at":"2015-12-07T20:40:34Z","updated_at":"2015-12-08T18:16:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3ce0c946b605b2e800fd73b976642750fb327428","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/54/commits","review_comments_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/54/comments","review_comment_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues/54/comments","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/statuses/e18d28f48eff0912f7a3f0c89bd2c913f3467e01","head":{"label":"cockroachdb:marc/single_step_terraform","ref":"marc/single_step_terraform","sha":"e18d28f48eff0912f7a3f0c89bd2c913f3467e01","user":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"repo":{"id":34730187,"name":"cockroach-prod","full_name":"cockroachdb/cockroach-prod","owner":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cockroachdb/cockroach-prod","description":"Production tools for cockroachdb.","fork":false,"url":"https://api.github.com/repos/cockroachdb/cockroach-prod","forks_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/forks","keys_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/teams","hooks_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/hooks","issue_events_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues/events{/number}","events_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/events","assignees_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/assignees{/user}","branches_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/branches{/branch}","tags_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/tags","blobs_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/refs{/sha}","trees_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/statuses/{sha}","languages_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/languages","stargazers_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/stargazers","contributors_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/contributors","subscribers_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/subscribers","subscription_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/subscription","commits_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/commits{/sha}","git_commits_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/commits{/sha}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/comments{/number}","issue_comment_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues/comments{/number}","contents_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/contents/{+path}","compare_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/merges","archive_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/downloads","issues_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues{/number}","pulls_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls{/number}","milestones_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/milestones{/number}","notifications_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/labels{/name}","releases_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/releases{/id}","created_at":"2015-04-28T12:51:48Z","updated_at":"2015-11-04T18:31:54Z","pushed_at":"2015-12-08T16:36:42Z","git_url":"git://github.com/cockroachdb/cockroach-prod.git","ssh_url":"git@github.com:cockroachdb/cockroach-prod.git","clone_url":"https://github.com/cockroachdb/cockroach-prod.git","svn_url":"https://github.com/cockroachdb/cockroach-prod","homepage":null,"size":207,"stargazers_count":23,"watchers_count":23,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":3,"forks":6,"open_issues":3,"watchers":23,"default_branch":"master"}},"base":{"label":"cockroachdb:master","ref":"master","sha":"e9286069a7b15f8efdd4f07582399b8d49b2da3d","user":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"repo":{"id":34730187,"name":"cockroach-prod","full_name":"cockroachdb/cockroach-prod","owner":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cockroachdb/cockroach-prod","description":"Production tools for cockroachdb.","fork":false,"url":"https://api.github.com/repos/cockroachdb/cockroach-prod","forks_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/forks","keys_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/teams","hooks_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/hooks","issue_events_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues/events{/number}","events_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/events","assignees_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/assignees{/user}","branches_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/branches{/branch}","tags_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/tags","blobs_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/refs{/sha}","trees_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/statuses/{sha}","languages_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/languages","stargazers_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/stargazers","contributors_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/contributors","subscribers_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/subscribers","subscription_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/subscription","commits_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/commits{/sha}","git_commits_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/git/commits{/sha}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/comments{/number}","issue_comment_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues/comments{/number}","contents_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/contents/{+path}","compare_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/merges","archive_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/downloads","issues_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues{/number}","pulls_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls{/number}","milestones_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/milestones{/number}","notifications_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/labels{/name}","releases_url":"https://api.github.com/repos/cockroachdb/cockroach-prod/releases{/id}","created_at":"2015-04-28T12:51:48Z","updated_at":"2015-11-04T18:31:54Z","pushed_at":"2015-12-08T16:36:42Z","git_url":"git://github.com/cockroachdb/cockroach-prod.git","ssh_url":"git@github.com:cockroachdb/cockroach-prod.git","clone_url":"https://github.com/cockroachdb/cockroach-prod.git","svn_url":"https://github.com/cockroachdb/cockroach-prod","homepage":null,"size":207,"stargazers_count":23,"watchers_count":23,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":3,"forks":6,"open_issues":3,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/54"},"html":{"href":"https://github.com/cockroachdb/cockroach-prod/pull/54"},"issue":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues/54"},"comments":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/issues/54/comments"},"review_comments":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/54/comments"},"review_comment":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/pulls/54/commits"},"statuses":{"href":"https://api.github.com/repos/cockroachdb/cockroach-prod/statuses/e18d28f48eff0912f7a3f0c89bd2c913f3467e01"}}}}