Bootstrapping/importing content with CT defined workspaces

Description

Problem:

If you use the Content Types feature to define workspaces and node types, and you have JCR content bootstrap files that rely on those Content Type definitions (typically in a modules 'mgnl-bootstrap' directory, or in the WEB-INF/bootraps/common directory), then the content will not be correctly installed at install time. When the system tries to bootstrap the content, it has not yet processed the Content Types and so the workspace does not exist yet.

Implemented in this ticket:

To bootstrap content, when using Content Types, use the Content Importer feature. Do not use the " WEB-INF/bootraps/common" feature.

The following capabilities have been added to the Content Importer feature.

  • In addition to magnolia.content.bootstrap.dir property, this ticket introduces magnolia.content.bootstrap.pattern which specifies wildcard pattern (glob). When not used, the behavior of content-importer is identical (the pattern defaults to *. {yaml,xml})

  • Property magnolia.content.bootstrap.initial=true (false by default) makes all files matching the pattern bootstrap at the startup. If the content with same path already exists, the import task is created instead.

Note - if you use the bootstrap.initial property, then you will recieve additional import tasks at every system restart. You can workaround  this by setting the property to false after the initial import. Or by removing the bootstrap files from the configured directory once they are imported.
This behaviour is addressed in https://magnolia-cms.atlassian.net/browse/MGNLCI-25

 

 

 

Copied from a documentation comment from  

If you have bootstrap data using that namespace and workspace, (defined in a CT yaml definiitons)  things will fail miserably.

After manually adding a workspace definition to the module descriptor, Magnolia only complains about the unknown namespace. 

So it seems like Magnolia should read the contentTypes definitions first, before bootstrapping anything. Of course this will hardly be possible, if the contentTypes are defined in JCR. 

IMO, the Magnolia startup code needs to be adapted:

  • When the repo config is read from the module descriptor files, Magnolia should also check for content type definitions files.

  • OR at least name space definitions in module descriptors should be supported.

    • However this would be a bit of a compromise as it would force us to keep the workspace and namespace definition in the module descriptor and  the content type definition.

Activity

Show:

Jaroslav Simak June 29, 2020 at 5:04 PM


Also happened with XML files. And yes, i came to the same conclusion when debugging, it's the DataTransporter issue.

Robert Šiška June 29, 2020 at 12:27 PM
Edited

So all changes are only relevant to the {{magnolia.content.bootstrap.dir }}directory (content importer), but not to the 'magnolia.bootstrap.dir' (usually 'WEB-INF/bootstrap/common')?

Yes.

So when magnolia.content.bootstrap.initial=true is used - then on install, no Tasks are created, no human intervention required? (unless path already exists?)

Also yes.

When 'magnolia.content.bootstrap.initial=true' is used - does this happen at every startup? Or only at install as the 'WEB-INF/bootraps/common' > feautre does?When 'magnolia.content.bootstrap.initial=true' is used - does this happen at every startup? Or only at install as the 'WEB-INF/bootraps/common' > feautre does?

Yes, at every start-up.

(If at every startup, I think this will cause problems with all of the files that anyone adds to the importer running at every startup and generating tasks everytime.)

Yes, that's a problem but I'd say it's only a symptom of another problem that tasks are created even when there are no actual changes (see )

changing same import file leads into same name siblings when task is approved

That happens only with yaml files, right? There's an issue with DataTransporter ignoring Import Behaviour when importing yaml files...

Jaroslav Simak June 25, 2020 at 11:53 AM

Closing this ticket because module has been released even without proper final QA.

Christopher Zimmermann June 22, 2020 at 7:42 AM
Edited

 - When 'magnolia.content.bootstrap.initial=true' is used - does this happen at every startup? Or only at install as the 'WEB-INF/bootraps/common' feautre does?
(If at every startup, I think this will cause problems with all of the files that anyone adds to the importer running at every startup and generating tasks everytime.)

Christopher Zimmermann June 16, 2020 at 6:43 AM

So when magnolia.content.boostrap.initial=true is used - then on install, no Tasks are created, no human intervention required? (unless path already exists?)

Fixed

Details

Assignee

Reporter

Priority

Magnolia Release

Fix versions

Affects versions

Story Points

Sprint

More fields

Created November 18, 2019 at 2:12 PM
Updated March 27, 2025 at 5:41 AM
Resolved June 25, 2020 at 11:53 AM