Patches getting applied at every startup

cancel
Showing results for 
Search instead for 
Did you mean: 
jaxtell
Active Member

Patches getting applied at every startup

I'm trying to bootstrap a second "admin" user following the directions at Bootstrap content | Alfresco Documentation .  This seems to work the first time I startup alfresco.  The use is created (though marked as incomplete and homeDirectory isn't set) and has the existing "GROUP_ALFRESCO_ADMINISTRATORS"  group reference added.  I thought I'd see three entries in the alf_applied_patch table, corresponding to the number of beans, but I only see one.  Then I shut down my docker instance and restart.  It looks like those patches are trying to be reapplied.  I don't have force set.  Version is 6.0.0 (3 r31e76ed5-b20) - Enterprise.  I later added a "checkPath" property to user profiles that seems to prevent the user from being recreated, but then fails on re-referencing the group.

import-user-profiles.xml:

<?xml version="1.0" encoding="UTF-8"?>
<view:view xmlns:view="http://www.alfresco.org/view/repository/1.0"
xmlns:cm="http://www.alfresco.org/model/content/1.0">
<cm:person view:childName="cm:admin2">
<view:acl>
<view:ace view:access="ALLOWED">
<view:authority>admin2</view:authority>
<view:permission>All</view:permission>
</view:ace>
</view:acl>
<view:properties>
<cm:firstName>Admin</cm:firstName>
<cm:lastName>Two</cm:lastName>
<cm:email>jaxtell@MyBusiness.com</cm:email>
<cm:userName>admin2</cm:userName>
<cm:homeFolder>/app:company_home/app:user_homes/cm:admin2</cm:homeFolder>
<cm:organizationId>MyBusiness</cm:organizationId>
<cm:sizeQuota>-1</cm:sizeQuota>
<cm:sizeCurrent>0</cm:sizeCurrent>
</view:properties>
</cm:person>
</view:view>

import-users.xml:

<?xml version="1.0" encoding="UTF-8"?>
<view:view xmlns:view="http://www.alfresco.org/view/repository/1.0"
xmlns:usr="http://www.alfresco.org/model/user/1.0"
xmlns:sys="http://www.alfresco.org/model/system/1.0">

<!-- Load the user account information -->
<usr:user view:childName="usr:admin2">
<view:aspects>
<sys:referenceable></sys:referenceable>
</view:aspects>
<view:properties>
<usr:username>admin2</usr:username>
<usr:password>7ce21f17c0aee7fb9ceba532d0546ad6</usr:password>
<usr:accountExpires>false</usr:accountExpires>
<usr:credentialsExpire>false</usr:credentialsExpire>
<usr:accountLocked>false</usr:accountLocked>
<usr:enabled>true</usr:enabled>
</view:properties>
</usr:user>
</view:view>

import-group-memberships.xml:

<?xml version="1.0" encoding="UTF-8"?>
<view:view xmlns:view="http://www.alfresco.org/view/repository/1.0"
xmlns:cm="http://www.alfresco.org/model/content/1.0"
xmlns:sys="http://www.alfresco.org/model/system/1.0">

<view:reference view:pathref="sys:authorities/cm:GROUP_ALFRESCO_ADMINISTRATORS">
<view:associations>
<cm:member>
<view:reference view:pathref="sys:people/cm:admin2"
view:childName="cm:admin2" />
</cm:member>
</view:associations>
</view:reference>
</view:view>

partial bootstrap-context.xml:

 <bean id="com.mybusiness.alfresco.bootstrap.patch.userProfilesLoader"
class="org.alfresco.repo.admin.patch.impl.GenericBootstrapPatch"
parent="basePatch">
<property name="id">
<value>com.mybusiness.alfresco.bootstrap.patch.userProfilesLoader</value>
</property>
<property name="description">
<value>Second Admin Profile Loader</value>
</property>
<property name="fixesFromSchema">
<value>0</value>
</property>
<property name="fixesToSchema">
<value>${version.schema}</value>
</property>
<property name="targetSchema">
<value>11001</value>
</property>
<property name="importerBootstrap">
<ref bean="spacesBootstrap"/>
</property>
<property name="checkPath">
<value>/${system.system_container.childname}/${system.people_container.childname}/cm:admin2</value>
</property>
<property name="bootstrapView">
<props>
<prop key="path">/${system.system_container.childname}/${system.people_container.childname}</prop>
<prop key="location">alfresco/module/repo-extension/bootstrap/import-user-profiles.xml</prop>
</props>
</property>
</bean>

<bean id="com.mybusiness.alfresco.bootstrap.patch.usersLoader"
class="org.alfresco.repo.admin.patch.impl.GenericBootstrapPatch"
parent="basePatch">
<property name="id">
<value>com.mybusiness.alfresco.bootstrap.patch.usersLoader</value>
</property>
<property name="description">
<value>Second Admin Loader</value>
</property>
<property name="fixesFromSchema">
<value>0</value>
</property>
<property name="fixesToSchema">
<value>${version.schema}</value>
</property>
<property name="targetSchema">
<value>11002</value>
</property>
<property name="dependsOn">
<list>
<ref bean="com.mybusiness.alfresco.bootstrap.patch.userProfilesLoader"/>
</list>
</property>
<property name="importerBootstrap">
<ref bean="userBootstrap"/>
</property>
<property name="bootstrapView">
<props>
<prop key="path">/${alfresco_user_store.system_container.childname}/${alfresco_user_store.user_container.childname}</prop>
<prop key="location">alfresco/module/repo-extension/bootstrap/import-users.xml</prop>
</props>
</property>
</bean>

<bean id="com.mybusiness.alfresco.bootstrap.patch.groupMembershipsLoader"
class="org.alfresco.repo.admin.patch.impl.GenericBootstrapPatch"
parent="basePatch">
<property name="id">
<value>com.mybusiness.alfresco.bootstrap.patch.groupMembershipsLoader</value>
</property>
<property name="description">
<value>Second Admin Group Membership Loader</value>
</property>
<property name="fixesFromSchema">
<value>0</value>
</property>
<property name="fixesToSchema">
<value>${version.schema}</value>
</property>
<property name="targetSchema">
<value>11003</value>
</property>
<property name="dependsOn">
<list>
<ref bean="com.mybusiness.alfresco.bootstrap.patch.userProfilesLoader"/>
<ref bean="com.mybusiness.alfresco.bootstrap.patch.usersLoader"/>
</list>
</property>
<property name="importerBootstrap">
<ref bean="spacesBootstrap"/>
</property>
<property name="bootstrapView">
<props>
<prop key="path">/sys:system</prop>
<prop key="location">alfresco/module/repo-extension/bootstrap/import-group-memberships.xml</prop>
</props>
</property>
</bean>

Any help would be appreciated.

1 Reply
jaxtell
Active Member

Re: Patches getting applied at every startup

Never mind.  I must have had some typo or other minor issue that I removed when cleansing it for adding it here.  I copy/pasted this code exactly as above back in and now it seems to work fine.
EDIT: My issue seems to be with the "id" associated with the beans.  I'm using an Oracle database.  The alf_applied_patch table has the "id" column configured for 64 characters.  Longer ids don't get written to the table even though the patch gets applied.  I've opened [ALF-22066] Bootstrapped patches with ID over 64 characters don't get saved to Oracle database - Alf...  to address this.