Upgrading Alfresco without the content binary files (for testing and validating purposes)

cancel
Showing results for 
Search instead for 
Did you mean: 

Upgrading Alfresco without the content binary files (for testing and validating purposes)

folcina
Active Member II
9 1 5,176

This post is going to cover how to upgrade an Alfresco instance without using the data in the content store. This is a useful scenario to quickly validate an upgrade, as it is usually costly to clone the data on large repositories.

For instance, imagine you want to make a clone of a production environment to test an upgrade, and the repository (content store) has a several TB of data, it will require a lot of time (and money) to make a clone of such amount of content. However, following this method you'll speed up the upgrading process as it won't be necessary to use the content. 

Needless to say this is a method to quickly do an upgrade ONLY for testing purposes. The recommended way to upgrade an Alfresco instance is fully documented here.

Having said that, when using this method and bootstrapping the new version for the first time without the data, Alfresco will be able to complete the process but content won't be accessible (metadata will). This is still useful to estimate how long it takes to upgrade the DB or to make simple functionality tests that aren't content dependant.

The instance used on this post is a vanilla version of Alfresco 4.2.8 that will be upgraded to 5.2.4.

These are the steps to follow:

1. Find the binary files associated with the descriptor node.

The only binary files from the content store that Alfresco needs to bootstrap and/or do an upgrade are those linked to the descriptor node. Depending on the Alfresco version the descriptor node has 2 or 3 binary files associated. 

The quickest way to identify the binary files associated with the descriptor node is by executing the following SQL query:

select uuid,content_url from alf_node n,alf_node_properties np,alf_content_url cu,alf_content_data cd where n.id=np.node_id and np.long_value=cd.id and cd.content_url_id=cu.id and n.uuid IN (select n.uuid from alf_node n,alf_store s where n.store_id=s.id AND s.identifier='system');

The output of the previous query in the Alfresco instance used in this post is:

uuidcontent_url
f6274202-4b7f-442f-8032-c3755974ffeastore://2018/11/8/15/34/8b30b10b-e27a-4fe4-8b3e-c89798c6e3e0.bin 
f6274202-4b7f-442f-8032-c3755974ffeastore://2018/11/8/15/38/84f6eaf2-3cb7-44f3-8caf-2c9b7ae73a78.bin
f6274202-4b7f-442f-8032-c3755974ffeastore://2018/11/8/15/35/ae13363d-79a9-42ac-b2cc-99366a76eaf7.bin


Therefore the binaries required from the content store to be able to upgrade/bootstrap the Alfresco instance in this post are:

  • {ALFRESCO_DIR}/alf_data/contentstore/2018/11/8/15/34/8b30b10b-e27a-4fe4-8b3e-c89798c6e3e0.bin
  • {ALFRESCO_DIR}/alf_data/contentstore/2018/11/8/15/38/84f6eaf2-3cb7-44f3-8caf-2c9b7ae73a78.bin
  • {ALFRESCO_DIR}/alf_data/contentstore/2018/11/8/15/35/ae13363d-79a9-42ac-b2cc-99366a76eaf7.bin

To have a better context of the nature of those binary files, you can find the descriptor node in Alfresco using the nodebrowser. In this case, the noderef will be:

system://system/f6274202-4b7f-442f-8032-c3755974ffea

The following screenshot shows how to search the descriptor node using the nodebrowser:

This screenshot shows all the properties for the descriptor node:

Notice that the descriptor node has the following properties associated with the binary files found with the SQL query:

(update 15/5/19)

The descriptor node can also be found using the Alfresco (slingshot) API as shown in the following curl command:

$ curl -u admin:admin "http://localhost:8080/alfresco/s/slingshot/node/search?q=%3Dsys%5C%3Aname%3A%27Main%20Repository%27&lang=db-afts&store=system%3A%2F%2Fsystem"

{

   "numResults": 1,

   "results": [

      {

         "nodeRef": "system://system/02b5958c-f13f-489b-ac3e-38faa5e07d54",

         "qnamePath": {

            "name": "\/{http:\/\/www.alfresco.org\/model\/system\/1.0}descriptor-current",

            "prefixedName": "\/sys:descriptor-current"

         },

         "name": {

            "name": "{http:\/\/www.alfresco.org\/model\/system\/1.0}descriptor-current",

            "prefixedName": "sys:descriptor-current"

         },

         "parentNodeRef": ""

      }

   ],

   "searchElapsedTime": 5

}

The above query is using "db-afts" language (in other words, querying the DB) and the query itself is:

=sys\:name:'Main Repository'

Once the descriptor node has been identified, using again Slingshot API it's possible to get the path of all associated binary files:

curl -u admin:admin "http://localhost:8080/alfresco/s/slingshot/node/system/system/02b5958c-f13f-489b-ac3e-38faa5e07d54?"

...

"dataType": "{http:\/\/www.alfresco.org\/model\/dictionary\/1.0}content",

"value":          "contentUrl=store://2019/5/15/11/35/306bd5e6-0ef7-4166-b2de-f27d180a0ee4.bin|mimetype=application/octet-stream|size=904|encoding=UTF-8|locale=en_GB_|id=145"

....

"dataType": "{http:\/\/www.alfresco.org\/model\/dictionary\/1.0}content",

               "value":          "contentUrl=store://2019/5/15/11/36/bc349c8b-17df-4911-9b58-d92df379debb.bin|mimetype=application/octet-stream|size=650|encoding=UTF-8|locale=en_GB_|id=245"

,

....

"dataType": "{http:\/\/www.alfresco.org\/model\/dictionary\/1.0}content",

               "value":          "contentUrl=store://2019/5/15/11/35/358cc878-b6f2-4370-8f7b-7dbd9529e9a4.bin|mimetype=text/plain|size=371|encoding=UTF8|locale=en_GB_|id=5"

,

.....

2. Set up the new instance

For this test, Alfresco will be upgraded to 5.2.4 therefore we need to have an instance of that version ready to be used for the upgrade.

This instance need the following:

  • To point to a copy of the DB of the Alfresco 4.2.8 instance.
  • A copy of the binary files identified on step 1. They should be placed on alf_data/contentstore folder keeping the same path. (e.g. {ALFRESCO_DIR}/alf_data/contentstore/2018/11/8/15/34/8b30b10b-e27a-4fe4-8b3e-c89798c6e3e0.bin).

3. Upgrade

Once the new instance with Alfresco 5.2.4 is ready with the requirements of step 2, we just need to bootstrap it. Alfresco will upgrade the database and will create new files on the content store. No warnings regarding missing files will be seen in the logs. 

Moreover, when upgrading from Alfresco 4.2.x version to 5.2.x, new configuration files such as user dashboards will be created, therefore we will be able to log in into share with admin user with no issues.

The descriptor node will be updated with the new Alfresco version (5.2.4) and two new binaries linked to this node will be created as shown in the following screenshot:

 

 

For further updates you only need to repeat the steps in this post.

1 Comment
cesarista
Customer

Hi Francisco:

This worked like a charm.

Kind regards.

--C.