Gurenko Maxim
Gurenko Maxim

Reputation: 33

Publish workspace from Author instance to public

I got newly created Magnolia instance. I tried to create an app via bundled groovy script and publish news to public instance. I got this error

error

It happened because 'ebtnews' workspace is not synchronised from author to private. So the question is how to sync workspace from author to private?

Upvotes: 0

Views: 308

Answers (2)

Jan
Jan

Reputation: 4369

Alternatively, you can just run following via groovy console/script:

// create workspace
Components.getSingleton(RepositoryManager.class).createWorkspace(app_repository, app_workspace)
// check we registered all right
appSession = ctx.getJCRSession(app_workspace)
// register node type
nodeTypeManager = appSession.getWorkspace().getNodeTypeManager()
type = NodeTypeTemplateUtil.createSimpleNodeType(nodeTypeManager, app_node_type, Arrays.asList(NodeType.NT_HIERARCHY_NODE, NodeType.MIX_REFERENCEABLE, NodeTypes.Created.NAME, NodeTypes.Activatable.NAME, NodeTypes.LastModified.NAME, NodeTypes.Renderable.NAME))
nodeTypeManager.registerNodeType(type, true)
appSession.save()
// double check it registered all right
nodeTypeManager.getNodeType(app_node_type)

You will also want to register basic security rights for the workspace, set it under subscriber workspace mapping to enable activation and possibly include/exclude it from list of triggers for flushing cache upon update of content on public instance.

You can find code to do all that in createAppScript sample script in groovy module. Code I've pasted above is actually from the same script.

Advantage being that you can do all that at runtime w/o restart. Disadvantage, that you need to run same code on each instance.

Upvotes: 1

Jen Sze
Jen Sze

Reputation: 284

What I do is every time I added a new workspace in the module definition xml for my author instance, I make sure I also added this workspace in the module definition xml for my public instance. Then need to restart both author and public instance for it to create the new workspace.

Upvotes: 2

Related Questions