I am currently planning to deploy required ServiceUsers with bundle. To do so I created a user with the Composum user manager which is shipped with sling10. Then I exported a package with my user and extracted in to put the folder structure in my maven project.
myapp/ui/src/main/resources/jcr_root/home/users/system/myapp/cNmLYZeYn1j_2LP6vhlVl
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal"
jcr:primaryType="rep:SystemUser"
jcr:uuid="ded83881-f468-31bf-8f31-5d34b4d08475"
rep:authorizableId="myServiceUser"
rep:principalName="myServiceUser"/>
The user should then be deployed with the Sling-Initial-Content configuration.
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>run-bnd</id>
<goals>
<goal>bnd-process</goal>
</goals>
</execution>
</executions>
<configuration>
<bnd>Sling-Nodetypes: SLING-INF/nodetypes/nodetypes.cnd
Sling-Initial-Content: \
jcr_root/home/users/system/;overwrite:=true;uninstall:=true;path:=/home/users/system/,\
jcr_root/apps/myapp;overwrite:=true;uninstall:=true;path:=/apps/myapp,\
jcr_root/etc/myapp;overwrite:=true;uninstall:=true;path:=/etc/myapp,\
jcr_root/content/myapp;overwrite:=true;overwriteProperties:=true;uninstall:=false;path:=/content/myapp
</bnd>
</configuration>
</plugin>
My problem is that I am facing an error that I am not allowed to create a child node in /home/users/system/
ERROR [Background Update ui (161)] org.apache.sling.jcr.contentloader.internal.BundleContentLoader Cannot load initial content for bundle ui : OakConstraint0001: /home/users/system[[rep:AuthorizableFolder]]: No matching definition found for child node cellular with effective type [sling:Folder] javax.jcr.nodetype.ConstraintViolationException: OakConstraint0001: /home/users/system[[rep:AuthorizableFolder]]: No matching definition found for child node cellular with effective type [sling:Folder]
After facing that issue I was researching in other projects how ServiceUsers are created. I found out that the slingshot sample application is using the provisioning model to create ServiceUsers. sling-samples/slingshot/src/main/provisioning/model.txt The difference between my application and the slingshot is that the slingshot application will be installed with the initial startup of the sling-quickstart.jar. I am not sure if i can use the repository initialisation when deploying to an existing Sling instance.
Is there any recommended way to "deploy" ServiceUsers with the regular bundle?