Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yurt blueprint isolation #3

Open
dhruvbhatia opened this issue Nov 14, 2016 · 8 comments
Open

Yurt blueprint isolation #3

dhruvbhatia opened this issue Nov 14, 2016 · 8 comments

Comments

@dhruvbhatia
Copy link

Hi there,

I have run into another edge case that I'd like your guidance with.

I have a situation where I've built super-cool-library which uses Yurt to run it's lifecycle.
If I create my-project, a project with mount components, and add super-cool-library as a dep, I find that super-cool-library's yurt/blueprint contains ALL the mount components of the parent project.

This means that starting super-cool-library within a mount component in the parent project results in ALL the mount components starting. In other words, there is no isolation between a Yurt blueprint of a dependency, and the parent project.

Is this by design? If so, is there a way for me to limit a dependancy's lifecycle so that the yurt/blueprint fn doesn't pull in components from other namespaces?

Let me know if my explanation is gibberish - I can try and create a demo project if need be!

tolitius added a commit that referenced this issue Nov 14, 2016
@tolitius
Copy link
Owner

usually libraries are stateless: i.e. they provide functionality with the state passed to them. As a rule of thumb I would generally try to keep libraries stateless.

but of course there are different use cases. I just added building smaller Yurts that would allow your "super-cool-library" to only start its own components: i.e. when it's built, it would not look at the app components.

Let me know if that works for you.

@dhruvbhatia
Copy link
Author

Thanks - that works well, appreciate the update!

One more q: is it possible to combine build-only with the ability to swap alternative implementations (as per build-with)?

@tolitius
Copy link
Owner

tolitius commented Nov 18, 2016

sure, glad it worked for you!

build-only & build-with not right now, but maybe later when I have more time to work on it :)

@dhruvbhatia
Copy link
Author

No probs - I've sent a PR #4 adding yurt/build-only-with which combines :only and :swap. There is also a relevant test showing how this works.

Let me know your thoughts? My code probably isn't the most elegant, but it works as expected!

@tolitius
Copy link
Owner

I enhanced build / destroy a little to optionally take a map with options:

(yurt/build (yurt/blueprint) {:swap {"neo.conf/config" test-config}
                              :only ["neo.conf/config" "neo.db/db"]})

so now we can combine them easily in one call to build.

see whether it works for you (0.1.2-SNAPSHOT), I'll release it with docs some time later.

@tolitius
Copy link
Owner

tolitius commented Nov 25, 2016

* only build takes opts map and does something to it. destroy does not do anything with the map yet.

@dhruvbhatia
Copy link
Author

Awesome - this looks a lot cleaner than my solution (I shall close that PR now).
Thanks for the update!

@tolitius
Copy link
Owner

sure.
thanks for the PR and for raising the issue though, since it would not happen without them :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants