{"action":"created","comment":{"url":"https://api.github.com/repos/flynn/flynn/pulls/comments/64432801","id":64432801,"diff_hunk":"@@ -138,22 +144,42 @@ func runClusterAdd(args *docopt.Args) error {\n \t\treturn errors.New(fmt.Sprintf(\"Cluster %q does not exist and cannot be set as default.\", s.Name))\n \t}\n \n+\tvar caPath string\n+\tif !args.Bool[\"--no-git\"] && !args.Bool[\"--no-docker\"] {\n+\t\tclient, err := s.Client()\n+\t\tif err != nil {\n+\t\t\treturn err\n+\t\t}\n+\t\tcaPath, err = writeCACert(client, s.Name)\n+\t\tif err != nil {\n+\t\t\treturn fmt.Errorf(\"Error writing CA certificate: %s\", err)\n+\t\t}\n+\t}\n+\n \tif !args.Bool[\"--no-git\"] {\n \t\tif _, err := exec.LookPath(\"git\"); err != nil {\n \t\t\tif serr, ok := err.(*exec.Error); ok && serr.Err == exec.ErrNotFound {\n \t\t\t\treturn errors.New(\"Executable 'git' was not found. Use --no-git to skip git configuration\")\n \t\t\t}\n \t\t\treturn err\n \t\t}\n-\t\tclient, err := s.Client()\n-\t\tif err != nil {\n+\t\tif err := cfg.WriteGlobalGitConfig(s.GitURL, caPath); err != nil {\n \t\t\treturn err\n \t\t}\n-\t\tcaPath, err := writeCACert(client, s.Name)\n+\t}\n+\n+\tif !args.Bool[\"--no-docker\"] {\n+\t\thost, err := s.DockerHost()\n \t\tif err != nil {\n-\t\t\treturn fmt.Errorf(\"Error writing CA certificate: %s\", err)\n+\t\t\treturn err\n \t\t}\n-\t\tif err := cfg.WriteGlobalGitConfig(s.GitURL, caPath); err != nil {\n+\t\tif err := dockerLogin(host, s.Key); err != nil {\n+\t\t\tif e, ok := err.(*exec.Error); ok && e.Err == exec.ErrNotFound {\n+\t\t\t\terr = errors.New(\"Executable 'docker' was not found. Use --no-docker to skip docker configuration\")","path":"cli/cluster.go","position":96,"original_position":96,"commit_id":"f43ff07ee424a6a1bc706c8443cc6b043bf9d177","original_commit_id":"f43ff07ee424a6a1bc706c8443cc6b043bf9d177","user":{"login":"titanous","id":13026,"avatar_url":"https://avatars.githubusercontent.com/u/13026?v=3","gravatar_id":"","url":"https://api.github.com/users/titanous","html_url":"https://github.com/titanous","followers_url":"https://api.github.com/users/titanous/followers","following_url":"https://api.github.com/users/titanous/following{/other_user}","gists_url":"https://api.github.com/users/titanous/gists{/gist_id}","starred_url":"https://api.github.com/users/titanous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/titanous/subscriptions","organizations_url":"https://api.github.com/users/titanous/orgs","repos_url":"https://api.github.com/users/titanous/repos","events_url":"https://api.github.com/users/titanous/events{/privacy}","received_events_url":"https://api.github.com/users/titanous/received_events","type":"User","site_admin":false},"body":"I think we should only do it if the flag is specified for now.","created_at":"2016-05-24T17:03:04Z","updated_at":"2016-05-24T17:03:04Z","html_url":"https://github.com/flynn/flynn/pull/2857#discussion_r64432801","pull_request_url":"https://api.github.com/repos/flynn/flynn/pulls/2857","_links":{"self":{"href":"https://api.github.com/repos/flynn/flynn/pulls/comments/64432801"},"html":{"href":"https://github.com/flynn/flynn/pull/2857#discussion_r64432801"},"pull_request":{"href":"https://api.github.com/repos/flynn/flynn/pulls/2857"}}},"pull_request":{"url":"https://api.github.com/repos/flynn/flynn/pulls/2857","id":70983956,"html_url":"https://github.com/flynn/flynn/pull/2857","diff_url":"https://github.com/flynn/flynn/pull/2857.diff","patch_url":"https://github.com/flynn/flynn/pull/2857.patch","issue_url":"https://api.github.com/repos/flynn/flynn/issues/2857","number":2857,"state":"open","locked":false,"title":"Implement Docker Receive App","user":{"login":"lmars","id":488515,"avatar_url":"https://avatars.githubusercontent.com/u/488515?v=3","gravatar_id":"","url":"https://api.github.com/users/lmars","html_url":"https://github.com/lmars","followers_url":"https://api.github.com/users/lmars/followers","following_url":"https://api.github.com/users/lmars/following{/other_user}","gists_url":"https://api.github.com/users/lmars/gists{/gist_id}","starred_url":"https://api.github.com/users/lmars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lmars/subscriptions","organizations_url":"https://api.github.com/users/lmars/orgs","repos_url":"https://api.github.com/users/lmars/repos","events_url":"https://api.github.com/users/lmars/events{/privacy}","received_events_url":"https://api.github.com/users/lmars/received_events","type":"User","site_admin":false},"body":"This adds a `docker-receive` app which receives Docker images from `docker push` and creates corresponding artifacts, and `flynn docker push` which also deploys them to the cluster.\r\n\r\nRunning `flynn cluster add ...` will attempt to configure the local Docker client using `docker login`, but this can fail if the Docker daemon does not trust the Flynn cluster's CA certificate, in which case a warning is printed like:\r\n\r\n```\r\nWARN: docker configuration failed with a TLS error.\r\nWARN:\r\nWARN: Copy the TLS CA certificate /home/ubuntu/.flynn/ca-certs/default.pem\r\nWARN: to /etc/docker/certs.d/docker.1.localflynn.com/ca.crt\r\nWARN: on the docker daemon's host and restart docker.\r\n```\r\n\r\nFollowing the instructions then re-running the `flynn cluster add ...` command (or `flynn docker login`) should work.\r\n\r\nAssuming things are configured, here is an example of deploying elasticsearch:\r\n\r\n```\r\n$ docker pull elasticsearch:2.3.3\r\n\r\n$ flynn create --remote \"\" elasticsearch\r\nCreated elasticsearch\r\n\r\n$ flynn -a elasticsearch docker push elasticsearch:2.3.3\r\nflynn: getting image config with \"docker inspect -f {{ json .Config }} elasticsearch:2.3.3\"\r\nflynn: tagging Docker image with \"docker tag --force elasticsearch:2.3.3 docker.1.localflynn.com/elasticsearch:latest\"\r\nflynn: pushing Docker image with \"docker push docker.1.localflynn.com/elasticsearch:latest\"\r\nThe push refers to a repository [docker.1.localflynn.com/elasticsearch] (len: 1)\r\na8eb754d1a89: Pushed \r\n6162aa7ca453: Pushed \r\n...\r\n4e59e6df754e: Pushed \r\n3059b4820522: Pushed \r\nlatest: digest: sha256:1752ca12bbedb99734ca1ba3ec35720768a95ad83b7b6c371fc37a28b98ea351 size: 61216\r\nflynn: image pushed, waiting for artifact creation\r\nflynn: deploying release using artifact URI http://docker-receive.discoverd?name=elasticsearch&id=sha256:1752ca12bbedb99734ca1ba3ec35720768a95ad83b7b6c371fc37a28b98ea351\r\nflynn: image deployed, scale it with 'flynn scale app=N'\r\n\r\n$ flynn -a elasticsearch scale app=1\r\nscaling app: 0=>1\r\n\r\n18:05:38.308 ==> app fd8266b1-453d-4733-9417-2ad9ac33a418 pending\r\n18:05:38.308 ==> app host0-fd8266b1-453d-4733-9417-2ad9ac33a418 starting\r\n18:05:41.018 ==> app host0-fd8266b1-453d-4733-9417-2ad9ac33a418 up\r\n\r\nscale completed in 2.728163927s\r\n\r\n$ flynn -a elasticsearch run curl http://elasticsearch.discoverd:9200\r\n{\r\n  \"name\" : \"Hate-Monger\",\r\n  \"cluster_name\" : \"elasticsearch\",\r\n  \"version\" : {\r\n    \"number\" : \"2.3.3\",\r\n    \"build_hash\" : \"218bdf10790eef486ff2c41a3df5cfa32dadcfde\",\r\n    \"build_timestamp\" : \"2016-05-17T15:40:04Z\",\r\n    \"build_snapshot\" : false,\r\n    \"lucene_version\" : \"5.5.0\"\r\n  },\r\n  \"tagline\" : \"You Know, for Search\"\r\n}\r\n```\r\n\r\nCloses #2763.","created_at":"2016-05-22T18:10:01Z","updated_at":"2016-05-24T17:03:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cc054e8eeaacff99b17aae08b290c5763f088fd0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/flynn/flynn/pulls/2857/commits","review_comments_url":"https://api.github.com/repos/flynn/flynn/pulls/2857/comments","review_comment_url":"https://api.github.com/repos/flynn/flynn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/flynn/flynn/issues/2857/comments","statuses_url":"https://api.github.com/repos/flynn/flynn/statuses/f43ff07ee424a6a1bc706c8443cc6b043bf9d177","head":{"label":"flynn:docker-receive","ref":"docker-receive","sha":"f43ff07ee424a6a1bc706c8443cc6b043bf9d177","user":{"login":"flynn","id":4973613,"avatar_url":"https://avatars.githubusercontent.com/u/4973613?v=3","gravatar_id":"","url":"https://api.github.com/users/flynn","html_url":"https://github.com/flynn","followers_url":"https://api.github.com/users/flynn/followers","following_url":"https://api.github.com/users/flynn/following{/other_user}","gists_url":"https://api.github.com/users/flynn/gists{/gist_id}","starred_url":"https://api.github.com/users/flynn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flynn/subscriptions","organizations_url":"https://api.github.com/users/flynn/orgs","repos_url":"https://api.github.com/users/flynn/repos","events_url":"https://api.github.com/users/flynn/events{/privacy}","received_events_url":"https://api.github.com/users/flynn/received_events","type":"Organization","site_admin":false},"repo":{"id":11290232,"name":"flynn","full_name":"flynn/flynn","owner":{"login":"flynn","id":4973613,"avatar_url":"https://avatars.githubusercontent.com/u/4973613?v=3","gravatar_id":"","url":"https://api.github.com/users/flynn","html_url":"https://github.com/flynn","followers_url":"https://api.github.com/users/flynn/followers","following_url":"https://api.github.com/users/flynn/following{/other_user}","gists_url":"https://api.github.com/users/flynn/gists{/gist_id}","starred_url":"https://api.github.com/users/flynn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flynn/subscriptions","organizations_url":"https://api.github.com/users/flynn/orgs","repos_url":"https://api.github.com/users/flynn/repos","events_url":"https://api.github.com/users/flynn/events{/privacy}","received_events_url":"https://api.github.com/users/flynn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/flynn/flynn","description":"A next generation open source platform as a service (PaaS)","fork":false,"url":"https://api.github.com/repos/flynn/flynn","forks_url":"https://api.github.com/repos/flynn/flynn/forks","keys_url":"https://api.github.com/repos/flynn/flynn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flynn/flynn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flynn/flynn/teams","hooks_url":"https://api.github.com/repos/flynn/flynn/hooks","issue_events_url":"https://api.github.com/repos/flynn/flynn/issues/events{/number}","events_url":"https://api.github.com/repos/flynn/flynn/events","assignees_url":"https://api.github.com/repos/flynn/flynn/assignees{/user}","branches_url":"https://api.github.com/repos/flynn/flynn/branches{/branch}","tags_url":"https://api.github.com/repos/flynn/flynn/tags","blobs_url":"https://api.github.com/repos/flynn/flynn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flynn/flynn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flynn/flynn/git/refs{/sha}","trees_url":"https://api.github.com/repos/flynn/flynn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flynn/flynn/statuses/{sha}","languages_url":"https://api.github.com/repos/flynn/flynn/languages","stargazers_url":"https://api.github.com/repos/flynn/flynn/stargazers","contributors_url":"https://api.github.com/repos/flynn/flynn/contributors","subscribers_url":"https://api.github.com/repos/flynn/flynn/subscribers","subscription_url":"https://api.github.com/repos/flynn/flynn/subscription","commits_url":"https://api.github.com/repos/flynn/flynn/commits{/sha}","git_commits_url":"https://api.github.com/repos/flynn/flynn/git/commits{/sha}","comments_url":"https://api.github.com/repos/flynn/flynn/comments{/number}","issue_comment_url":"https://api.github.com/repos/flynn/flynn/issues/comments{/number}","contents_url":"https://api.github.com/repos/flynn/flynn/contents/{+path}","compare_url":"https://api.github.com/repos/flynn/flynn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flynn/flynn/merges","archive_url":"https://api.github.com/repos/flynn/flynn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flynn/flynn/downloads","issues_url":"https://api.github.com/repos/flynn/flynn/issues{/number}","pulls_url":"https://api.github.com/repos/flynn/flynn/pulls{/number}","milestones_url":"https://api.github.com/repos/flynn/flynn/milestones{/number}","notifications_url":"https://api.github.com/repos/flynn/flynn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flynn/flynn/labels{/name}","releases_url":"https://api.github.com/repos/flynn/flynn/releases{/id}","deployments_url":"https://api.github.com/repos/flynn/flynn/deployments","created_at":"2013-07-09T18:22:06Z","updated_at":"2016-05-24T13:57:43Z","pushed_at":"2016-05-24T07:00:52Z","git_url":"git://github.com/flynn/flynn.git","ssh_url":"git@github.com:flynn/flynn.git","clone_url":"https://github.com/flynn/flynn.git","svn_url":"https://github.com/flynn/flynn","homepage":"https://flynn.io","size":29142,"stargazers_count":4493,"watchers_count":4493,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":332,"mirror_url":null,"open_issues_count":355,"forks":332,"open_issues":355,"watchers":4493,"default_branch":"master"}},"base":{"label":"flynn:master","ref":"master","sha":"fa5817574598a6c5a65ee234e0ef48b2b959bdb1","user":{"login":"flynn","id":4973613,"avatar_url":"https://avatars.githubusercontent.com/u/4973613?v=3","gravatar_id":"","url":"https://api.github.com/users/flynn","html_url":"https://github.com/flynn","followers_url":"https://api.github.com/users/flynn/followers","following_url":"https://api.github.com/users/flynn/following{/other_user}","gists_url":"https://api.github.com/users/flynn/gists{/gist_id}","starred_url":"https://api.github.com/users/flynn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flynn/subscriptions","organizations_url":"https://api.github.com/users/flynn/orgs","repos_url":"https://api.github.com/users/flynn/repos","events_url":"https://api.github.com/users/flynn/events{/privacy}","received_events_url":"https://api.github.com/users/flynn/received_events","type":"Organization","site_admin":false},"repo":{"id":11290232,"name":"flynn","full_name":"flynn/flynn","owner":{"login":"flynn","id":4973613,"avatar_url":"https://avatars.githubusercontent.com/u/4973613?v=3","gravatar_id":"","url":"https://api.github.com/users/flynn","html_url":"https://github.com/flynn","followers_url":"https://api.github.com/users/flynn/followers","following_url":"https://api.github.com/users/flynn/following{/other_user}","gists_url":"https://api.github.com/users/flynn/gists{/gist_id}","starred_url":"https://api.github.com/users/flynn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flynn/subscriptions","organizations_url":"https://api.github.com/users/flynn/orgs","repos_url":"https://api.github.com/users/flynn/repos","events_url":"https://api.github.com/users/flynn/events{/privacy}","received_events_url":"https://api.github.com/users/flynn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/flynn/flynn","description":"A next generation open source platform as a service (PaaS)","fork":false,"url":"https://api.github.com/repos/flynn/flynn","forks_url":"https://api.github.com/repos/flynn/flynn/forks","keys_url":"https://api.github.com/repos/flynn/flynn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flynn/flynn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flynn/flynn/teams","hooks_url":"https://api.github.com/repos/flynn/flynn/hooks","issue_events_url":"https://api.github.com/repos/flynn/flynn/issues/events{/number}","events_url":"https://api.github.com/repos/flynn/flynn/events","assignees_url":"https://api.github.com/repos/flynn/flynn/assignees{/user}","branches_url":"https://api.github.com/repos/flynn/flynn/branches{/branch}","tags_url":"https://api.github.com/repos/flynn/flynn/tags","blobs_url":"https://api.github.com/repos/flynn/flynn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flynn/flynn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flynn/flynn/git/refs{/sha}","trees_url":"https://api.github.com/repos/flynn/flynn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flynn/flynn/statuses/{sha}","languages_url":"https://api.github.com/repos/flynn/flynn/languages","stargazers_url":"https://api.github.com/repos/flynn/flynn/stargazers","contributors_url":"https://api.github.com/repos/flynn/flynn/contributors","subscribers_url":"https://api.github.com/repos/flynn/flynn/subscribers","subscription_url":"https://api.github.com/repos/flynn/flynn/subscription","commits_url":"https://api.github.com/repos/flynn/flynn/commits{/sha}","git_commits_url":"https://api.github.com/repos/flynn/flynn/git/commits{/sha}","comments_url":"https://api.github.com/repos/flynn/flynn/comments{/number}","issue_comment_url":"https://api.github.com/repos/flynn/flynn/issues/comments{/number}","contents_url":"https://api.github.com/repos/flynn/flynn/contents/{+path}","compare_url":"https://api.github.com/repos/flynn/flynn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flynn/flynn/merges","archive_url":"https://api.github.com/repos/flynn/flynn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flynn/flynn/downloads","issues_url":"https://api.github.com/repos/flynn/flynn/issues{/number}","pulls_url":"https://api.github.com/repos/flynn/flynn/pulls{/number}","milestones_url":"https://api.github.com/repos/flynn/flynn/milestones{/number}","notifications_url":"https://api.github.com/repos/flynn/flynn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flynn/flynn/labels{/name}","releases_url":"https://api.github.com/repos/flynn/flynn/releases{/id}","deployments_url":"https://api.github.com/repos/flynn/flynn/deployments","created_at":"2013-07-09T18:22:06Z","updated_at":"2016-05-24T13:57:43Z","pushed_at":"2016-05-24T07:00:52Z","git_url":"git://github.com/flynn/flynn.git","ssh_url":"git@github.com:flynn/flynn.git","clone_url":"https://github.com/flynn/flynn.git","svn_url":"https://github.com/flynn/flynn","homepage":"https://flynn.io","size":29142,"stargazers_count":4493,"watchers_count":4493,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":332,"mirror_url":null,"open_issues_count":355,"forks":332,"open_issues":355,"watchers":4493,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/flynn/flynn/pulls/2857"},"html":{"href":"https://github.com/flynn/flynn/pull/2857"},"issue":{"href":"https://api.github.com/repos/flynn/flynn/issues/2857"},"comments":{"href":"https://api.github.com/repos/flynn/flynn/issues/2857/comments"},"review_comments":{"href":"https://api.github.com/repos/flynn/flynn/pulls/2857/comments"},"review_comment":{"href":"https://api.github.com/repos/flynn/flynn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/flynn/flynn/pulls/2857/commits"},"statuses":{"href":"https://api.github.com/repos/flynn/flynn/statuses/f43ff07ee424a6a1bc706c8443cc6b043bf9d177"}}}}
{"actor":{"display_login":"titanous"}}