-
Notifications
You must be signed in to change notification settings - Fork 66
integrate mlpm for package deployment #357
Comments
This should be integrated into deploy modules. Crawl mlpm_modules (configurable path), prepend all subdirs as basedirs, and do usual stuff. Mlpm_modules should go first. Is order within mlpm important? Using module locations nice as option. Maybe auto generate into ml-config if placeholder is uncommented. We could append these mod locations to qconsole app server with special option? Note group support does not yet include mod location. Only supported on server level now.. |
This functionality would be a superset of the proposal in #133. |
+1 |
Would be interesting if the packages would not only contain src and rest-api, but ml-config fragments as well. I prepared setup.xqy to take multiple configs. Then you could really modularize your project.. |
thanks @grtjn, I opened joemfb/mlpm#1 to track the possibility of config fragments in packages. |
re: your earlier comments, order is import for REST extensions/transforms, which are parsed and validated when deployed. To be safe, the deployer needs a reverse topological sort of modules and their dependencies. As for locations, they're supported at both appserver and group levels: |
Finally, here's are the deployment notes that I originally promised... I apologize for both the delay, and the length, but there's a lot to consider here. I'd appreciate any feedback y'all can offer ;) mlpm should establish best practices for module authors, and should provide consistency to module consumers. It should also offer flexibility to module authors, requiring as little change as possible to their existing practices. import mechanismsThere are several ways to import modules in MarkLogic:
Note: there's no way to import JS libs into XQuery main modules. deployment strategiesThere are several potential strategies for module deployment:
The simplest strategy, provides a consistent absolute path. Easily compatible with namespace-only imports. Easily updated via semver. Modules with dependencies should import via absolute path. Downside: disallows concurrent use of multiple module versions; requires a bower-style conflict resolution if different module versions are required
Allows concurrent use of multiple modules versions. Downside: doesn't provide a consistent path; not easily updated via semver; namespace URIs must include version info to allow for namespace-only imports
Allows concurrent use of multiple modules versions. Easily updated via semver. Downside: incompatible with namespace-only imports; all imports must be via relative path.
Rewrite import paths when modules are installed. Upside: support any strategy. Downside: magic conclusionGiven these options, I favor the first; I think it's the most easily understood. Rewriting import paths has the least impact on authors, but would have substantial and difficult-to-debug failure modes for consumers. As for multiple concurrent module versions: I haven't come seen it in any XQuery. At the same time, I would guess that's partly a function of the lack of XQuery package management. I do think it would be useful, but I don't think it's essential. The cost of supporting it seems high, given how XQuery module imports work. As for SJS, I favor absolute over relative paths. If, in the future, Thoughts? |
Quick note on mod locations: yes supported by admin lib, but not yet in ml-config.. More later.. |
@grtjn can you clarify what's not supported yet? Module location at application server level is supported by Roxy. |
This confusion is my fault: I confused @grtjn's comment re: the Roxy bootstrap module location support with MarkLogic's general capability. The gist I linked earlier (the "crude" deployment mechanism for modules: https://gist.github.com/joemfb/c786696f459290e57c73) automatically creates appserver-level module location bindings, bypassing the Roxy mechanism. |
@rlouapre see first comment above: module locations at group level, still on my todo list.. ;) |
@joemfb haven't read your entire comment yet, but wouldn't it simplify the deployment if we would deploy all src modules first, also of dependencies, and deploy all rest extensions last? Modules are not checked at upload, extensions are but extensions cannot depend on each other (not through import at least).. Might just work, and saves a lot of headache around dependency checks.. :P |
That's the approach taken by the linked gist, and it should be sufficient for most use-cases. However REST extensions/transformations are library modules, and could be imported by other modules (although it's probably not recommended). Finally, there are REST assets (http://docs.marklogic.com/guide/rest-dev/extensions#id_55309), which I haven't really examined in any depth yet ... A topo-sort isn't completely necessary, but would be more "correct", and also fun ;) |
Ah right, assets, that is new. I think it is another way of uploading modules. Do src first, assets second, extensions/transforms last. That would be a good first step. I would normaly highly discourage importing REST extensions, but I may have been guilty on doing similar things with MLCP transforms, decorators, custom facets, etc.. ;-) |
About time to add this to Roxy.. |
Simple first step would be to support |
see the README for an |
Pretty close indeed. Needs prompt_user/pass, and a slightly tighter integration into deploy modules perhaps. Doing a sys-call is questionable, but we do the same for mlcp, xqsync, recordloader, etc. Not expecting changes currently either, are we? |
Shouldn't need to prompt: the credentials used for module deployment are sufficient. Not sure about tighter integration, I don't think you want to deploy packages every time you deploy modules. Open to debate I guess. I'd like to see it be really easy to use: ie, use the |
Prompt_password is an internal function that prompts if roxy password prop is left blank. ;-) I'd include it in deploy modules for symmetry with clean modules. The deploy mod is not very smart so far. You could deploy src+rest to skip it. And make it look for mlpm_modules dir for starters. If that dir exists mlpm must be installed. :-) |
Need to reread above comments, but wanted to mention I have code for a deploy_packages that leverages the internal deploy commands to mimic mlpm deploy. Not perfect, but close enough to get you going.. |
I'll open a PR for that.. |
See also https://gist.github.com/joemfb/c786696f459290e57c73. It's somewhat out of date, but could be helpful. |
Interesting, totally glanced over that! I had this so far:
|
Your code is probably more complete/accurate.. :P |
My concern is duplicated implementation/effort, and creeping incompatibility. I've thought about having mlpm maintain some kind of metadata file laying out the order, structure, and type of assets within packages. Then it'd be easy for various tools to deploy; they'd just be following that file instead of parsing, classifying, sorting assets and packages. |
Hmm, something like adding extra details to mlpm.json on publish? That could be useful. You would need to touch existing versions perhaps, but that is doable too.. Duplication, yeah totally. I completely missed that link to your work, even though you mentioned in the very first comment.. :p Doing a sys-call prevents incompatibilities, and by far easiest, but not really fond of it.. |
Sounds like this needs more discussion, pushing away.. |
After pondering a while about this, I ended up doing this in slush-marklogic-node: https://github.com/marklogic/slush-marklogic-node/blob/master/app/templates/deploy/app_specific.rb#L77 I defer the complexity of deploying MLPM package to mlpm itself, which because of that needs to be installed. Then again, you need to have it anyhow to pull down the packages anyhow. I'm also doing deploy_packages before deploy_modules, since src and rest extensions of the project can depend on MLPM packages, but not other way around. MLPM packages are still deployed in alphabetic or random order probably, but I haven't seen packages with complex dependencies yet. I think it is time to integrate the slush approach into Roxy itself.. |
FYI, mlpm deploys packages in inverse topological order, based on any dependencies between them: https://github.com/joemfb/mlpm/blob/master/lib/project.js#L151 |
Awesome, even better! |
mlpm is a package manager for XQuery library modules, and REST API extensions/transformations. I've created a (crude) deployment mechanism customizing Roxy's app_specific.rb.
I'd like to discuss some of the tradeoffs in deployment, and an approach for integrating package deployment into Roxy. I'll add more details as soon as I can.
The text was updated successfully, but these errors were encountered: