Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Module dependencies: cycles and enabling #231

Closed
mworrell opened this Issue · 12 comments

4 participants

@mworrell
Owner

When modules now have a dependency cycle then Zotonic will not start.
We should add some error handling.
Maybe don't start the modules in the cycle?

Also, when enabling a module and its dependencies are not running, what to do?

@arjan
Owner

when enabling a module, its dependencies should also be enabled, right?
or at least we should look at which modules provide which dependencies and enable those? (based on priority)
what happens if you have 2 modules that provide the same thing?

@mworrell
Owner

Right now I use a very loose dependency graph, though it chokes on cyles (they are detected and returned).

Maybe we need some module selector? Interface?
Refuse to enable a module when it depends are not provided?

@helllamer

I think, it may look like:

$ cat mod_somemodule.erl | head
-module(mod_somemodule).
-mod_dep(mod_survey).
-mod_dep(mod_enterprise).

and some bootstapper will start mod_survey and mod_enterprise before mod_somemodule.

... and may be to separate modules frpm main repo? Look at https://github.com/basho/riak (git clone, make) - all modules in separate repos with its own maintainers. Module dependencies are resolved in compile-time by rebar. I understand, that you talking about run-time module dependencies, but zotonic repo goes fat day-by-day.

@mworrell
Owner

Good ideas for splitting up the repo into smaller pieces are welcome.

Maas had a short exercise into seeing if rebar could be used for Zotonic. He ran into some problems though, I think mainly that Zotonic modules are not OTP applications.

@mworrell
Owner

Right now I have added:

-mod_depends([ mod1, mod2, foo, bar .... ]).
-mod_provides([ bla, bloe ]).

Where every module automatically provides itself. And a missing mod_depends([...]) will fall back on a dependency on base

Cycles are detected using the digraph_utils.

Am working on starting the modules in the right sequence and not starting module iff their dependencies are missing.

@kaos
Owner

Would be really useful to be able to use this on sites, too. But then when a site depends on a module, it better be started... :)

@mworrell
Owner

Kind of 'optional' dependencies?

As in "if this module is enabled, then it should start before me."

@arjan
Owner

Nah. if a site needs a module it should just depend on it, right?

We're not making a package manager, "depends", "suggests", "recomends", :)

@kaos
Owner

Uh, no.

say I have a site, demo. Demo depends on mod_foo. When starting demo, all dependencies for demo are enabled (since demo is a site, and a site can't run unless all dependencies are met).

@arjan
Owner

Yes. This is already possible right, because sites are treated just like modules.

@kaos
Owner

Yes, my point was triggered by:

Am working on starting the modules in the right sequence and not starting module iff their dependencies are missing.

Not sure what missing means exactly (disabled, or really missing).
So the question becomes what to do when a dependency is disabled. And if sites need to be treated differently.

@mworrell
Owner

Closing due to age and changes in the module manager,

@mworrell mworrell closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.