{"action":"created","issue":{"url":"https://api.github.com/repos/michaelsauter/crane/issues/149","labels_url":"https://api.github.com/repos/michaelsauter/crane/issues/149/labels{/name}","comments_url":"https://api.github.com/repos/michaelsauter/crane/issues/149/comments","events_url":"https://api.github.com/repos/michaelsauter/crane/issues/149/events","html_url":"https://github.com/michaelsauter/crane/pull/149","id":56606559,"number":149,"title":"Support for optional dependencies and `required` cascading","user":{"login":"bjaglin","id":349077,"avatar_url":"https://avatars.githubusercontent.com/u/349077?v=3","gravatar_id":"","url":"https://api.github.com/users/bjaglin","html_url":"https://github.com/bjaglin","followers_url":"https://api.github.com/users/bjaglin/followers","following_url":"https://api.github.com/users/bjaglin/following{/other_user}","gists_url":"https://api.github.com/users/bjaglin/gists{/gist_id}","starred_url":"https://api.github.com/users/bjaglin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjaglin/subscriptions","organizations_url":"https://api.github.com/users/bjaglin/orgs","repos_url":"https://api.github.com/users/bjaglin/repos","events_url":"https://api.github.com/users/bjaglin/events{/privacy}","received_events_url":"https://api.github.com/users/bjaglin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-02-04T23:50:43Z","updated_at":"2015-02-19T21:33:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/michaelsauter/crane/pulls/149","html_url":"https://github.com/michaelsauter/crane/pull/149","diff_url":"https://github.com/michaelsauter/crane/pull/149.diff","patch_url":"https://github.com/michaelsauter/crane/pull/149.patch"},"body":"We have a need for optional dependencies as our microservices stack described by a `crane.yml` gets more and more complex. For example:\r\n* A Crane user shouldn't have to start _all_ backends containers behind a proxy container\r\n* Some stub containers are relevant only for testing but should remain within our main, centralized config.\r\n\r\n\r\nHere is behavior of that new feature:\r\n```\r\ncontainers:\r\n  foo:\r\n    image: busybox\r\n    run:\r\n      detach: true\r\n      cmd: [\"sleep\", \"50\"]\r\n      link:\r\n        - ?bar:bar\r\n        - qux:qux\r\n  bar:\r\n    image: busybox\r\n    run:\r\n      detach: true\r\n      cmd: [\"sleep\", \"50\"]\r\n  qux:\r\n    image: busybox\r\n    run:\r\n      detach: true\r\n      cmd: [\"sleep\", \"50\"]\r\n```\r\n\r\n```\r\nbrice@t440s:~$ crane status foo -dall\r\nNAME\tIMAGE\tID\tUP TO DATE\tIP\tPORTS\tRUNNING\r\nbar\tbusybox\t-\t-\t\t-\t-\t-\r\nqux\tbusybox\t-\t-\t\t-\t-\t-\r\nfoo\tbusybox\t-\t-\t\t-\t-\t-\r\n```\r\n```\r\nbrice@t440s:~$ crane status foo -drequired\r\nNAME\tIMAGE\tID\tUP TO DATE\tIP\tPORTS\tRUNNING\r\nqux\tbusybox\t-\t-\t\t-\t-\t-\r\nfoo\tbusybox\t-\t-\t\t-\t-\t-\r\n```\r\n```\r\nbrice@t440s:~$ crane run -r -v foo\r\nERROR: Dependencies for container(s) foo could not be resolved. Check for cyclic or missing dependencies, or use -d/--cascade-dependencies to automatically attempt to recursively include dependencies in the set of targeted containers.\r\n```\r\n```\r\nbrice@t440s:~$ crane run -r -v foo -drequired\r\nCommand will be applied to: qux, foo\r\n\r\nRunning container qux ... \r\n--> docker run --detach --name qux busybox sleep 50\r\naf4cd93da77fe57a29ec973c333b0d61f4ff6847e70d8d176df299f068b63321\r\nRunning container foo ... \r\n--> docker run --detach --link qux:qux --name foo busybox sleep 50\r\n810d8f98cfc3477d10e8f56d5a463df8a421536432be50f895dd6f6cd4ee87de\r\n```\r\n```\r\nbrice@t440s:~$ crane run -r -v bar\r\nCommand will be applied to: bar\r\n\r\nRunning container bar ... \r\n--> docker run --detach --name bar busybox sleep 50\r\n728e7e073b1d40077b2963f7f96a42edb8a2953ce8409b794ce2d4962949fd45\r\n```\r\n```\r\nbrice@t440s:~$ crane run -r -v foo\r\nCommand will be applied to: foo\r\n\r\nRemoving container foo ... \r\n--> docker rm --force foo\r\nfoo\r\nRunning container foo ... \r\n--> docker run --detach --link bar:bar --link qux:qux --name foo busybox sleep 50\r\ne06b5fd7c1383d494cc5963d499ebe33c926cdd3f7edd654ab1251f7c79665e6\r\n```"},"comment":{"url":"https://api.github.com/repos/michaelsauter/crane/issues/comments/75140671","html_url":"https://github.com/michaelsauter/crane/pull/149#issuecomment-75140671","issue_url":"https://api.github.com/repos/michaelsauter/crane/issues/149","id":75140671,"user":{"login":"michaelsauter","id":215455,"avatar_url":"https://avatars.githubusercontent.com/u/215455?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelsauter","html_url":"https://github.com/michaelsauter","followers_url":"https://api.github.com/users/michaelsauter/followers","following_url":"https://api.github.com/users/michaelsauter/following{/other_user}","gists_url":"https://api.github.com/users/michaelsauter/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelsauter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelsauter/subscriptions","organizations_url":"https://api.github.com/users/michaelsauter/orgs","repos_url":"https://api.github.com/users/michaelsauter/repos","events_url":"https://api.github.com/users/michaelsauter/events{/privacy}","received_events_url":"https://api.github.com/users/michaelsauter/received_events","type":"User","site_admin":false},"created_at":"2015-02-19T21:33:16Z","updated_at":"2015-02-19T21:33:16Z","body":"I see your point. Very tricky indeed :)\r\n\r\nHowever, I'm not quite sure I understand why you're opposed to the idea that the user needs to know what should not be started? To me, this whole feature sounds like an explicit opt-in optimisation (by choosing to ignore parts of the graph). This will potentially break things, therefore the user should be aware of it. As far as I understand it, your specific use case has to do with \"testing\" backends, so putting all of those into a group doesn't sound to complicated either.\r\n\r\nYour suggested alternative would be quite powerful indeed, but I agree that is looks very complex.\r\n\r\n\r\n"}}