Upgrading CollectionSpace (5.2 to 6.0)
  • Ready for review
  • Upgrading CollectionSpace (5.2 to 6.0)

    About Upgrading CollectionSpace
    This page provides details on upgrading from 5.2 to 6.0.

    See Current and Past Releases for information on upgrading from older versions of CollectionSpace.

    See Installing CollectionSpace for more information on installing CollectionSpace for first time.

     


    Prerequisites

    Before upgrading your CollectionSpace server, make sure you have a viable backup of your installation that can be restored if any problems occur. A whole-system backup or VM snapshot is preferred, but at a minimum, the following should be backed up:

    • Databases - Use pg_dump to create archives of all postgres databases, and store the archives in a safe location.

    • Source code - Back up the CollectionSpace source code directories on your server. These directories are named services and application. Depending on how you installed ColllectionSpace, these might be in /home/cspacecollectionspace-source, or /opt/collectionspace. These directories need to be backed up because you may have made configuration changes there – for example, to create tenants.

    • Tomcat - Back up the tomcat directory on your server. Tomcat is typically located at either /usr/local/share/apache-tomcat-{version}, or /opt/collectionspace/apache-tomcat-{version}. Substitute {version} with the number that exists on your server. This will vary with the CollectionSpace version – for example, 8.5.40 for CollectionSpace 5.2.

    Before continuing, ensure that tomcat is not running.

    Upgrading from CollectionSpace 5.2

    Install Tomcat 8.5.51

    CollectionSpace 6.0 includes Tomcat 8.5.51, upgraded from 8.5.40 in CollectionSpace 5.2.

    As a user with superuser privileges, go to the directory where Tomcat is installed – typically, either /usr/local/share or /opt/collectionspace/.

    cd /usr/local/share # or cd /opt/collectionspace

    A pre-configured installation of Tomcat 8.5.51 is included in the CollectionSpace distribution package. Download the tarball:

    sudo wget https://s3-us-west-2.amazonaws.com/cs-public-shared-files/releases/6.0/cspace-server-6.0.tar.gz

    Unpack the tarball:

    sudo tar -xzvof cspace-server-6.0.tar.gz

    This will create a directory named apache-tomcat-8.5.51.

    Change the files to be owned by the user you use to run CollectionSpace – typically, either cspace or collectionspace:

    sudo chown -R cspace:cspace apache-tomcat-8.5.51 # or sudo chown -R collectionspace:collectionspace apache-tomcat-8.5.51

    Remove the tarball:

    sudo rm cspace-server-6.0.tar.gz

    Update Symbolic Links or Environment Variables

    Change to the user you use to build and deploy CollectionSpace – typically, either cspace or collectionspace.

    sudo su - cspace # or sudo su - collectionspace

    If your installation is in /opt/collectionspace, you will have a symbolic link in that directory named server that points to the old tomcat directory. Update the link to point to the new tomcat directory.

    cd /opt/collectionspace

    ls -l server

    > lrwxrwxrwx 1 collectionspace collectionspace 41 May 26 17:01 server -> /opt/collectionspace/apache-tomcat-8.5.40

    ln -sfn /opt/collectionspace/apache-tomcat-8.5.51 server

    ls -l server

    > lrwxrwxrwx 1 collectionspace collectionspace 41 May 26 17:01 server -> /opt/collectionspace/apache-tomcat-8.5.51

    If your installation is in /opt/collectionspace, updating the symbolic link is all you need to do. Continue to "Upgrade Source Code".

    If your installation is not in /opt/collectionspace

    Edit the file in which environment variables are set for the build – typically, .bashrc in the home directory of the user used to build and deploy CollectionSpace.

    vim ~/.bashrc

    In that file, find the lines where the CATALINA_HOMECATALINA_PID, and CSPACE_JEESERVER_HOME variables are set. The values will contain the path to the old Tomcat 8.5.40 directory. Change them to use path of the new Tomcat 8.5.51 directory. The changed lines should now look like the below examples:

    export CATALINA_HOME='/usr/local/share/apache-tomcat-8.5.51'

    export CATALINA_PID='/usr/local/share/apache-tomcat-8.5.51/bin/tomcat.pid'

    export CSPACE_JEESERVER_HOME='/usr/local/share/apache-tomcat-8.5.51'

    Source the file to update the environment variables:

    source ~/.bashrc

    Upgrade Source Code

    Continue to perform the following steps as the user you use to build and deploy CollectionSpace – typically, either cspace or collectionspace.

    CollectionSpace source code is normally located in /home/cspace/collectionspace-source or /opt/collectionspace.

    If you created a tenant on your system using the clone-tenant tool, you will have edited the tenant.properties files in the services and application source code directories. These changes will prevent some the next steps form working. Usually, there's no need to retain the changed tenant.properties files after the tenant has been created, so you can remove your changes:

    cd /home/cspace/collectionspace-source # or cd /opt/collectionspace

    cd services

    git checkout tenant.properties

    cd ../application

    git checkout tenant.properties

    Upgrade the source code to 6.0:

    cd /home/cspace/collectionspace-source # or cd cd

    cd services

    git fetch

    git checkout v6.0-branch

    cd ../application

    git fetch

    git checkout v6.0-branch

    Upgrade Tenant Back End (Services) Configuration

    If you created a tenant in 5.2, there will be some back end configuration for the tenant in the application source code directory, in the directory named tomcat-main/src/main/resources/tenants/{tenant_short_name}, where {tenant_short_name} is the short name of your tenant. There will also be a directory containing configuration for the tenant that you used as a template to create your tenant, at tomcat-main/src/main/resources/tenants/{template_short_name}. Copy all of the files from the template tenant directory to your tenant directory, except for settings.xml. When copying, replace the template tenant's short name with your tenant's short name in each file name. For example, if your tenant's short name is mytenant, and it was created from the anthro tenant:

    cd /home/cspace/collectionspace-source # or cd /opt/collectionspace

    cd application/tomcat-main/src/main/resources/tenants

    ls anthro

    > anthro-authority-concept.xml          anthro-collectionobject.xml       settings.xml

    > anthro-authority-person-termList.xml  domain-instance-vocabularies.xml

    cp anthro/anthro-authority-concept.xml mytenant/mytenant-authority-concept.xml

    cp anthro/anthro-authority-person-termList.xml mytenant/mytenant-authority-person-termList.xml

    cp anthro/anthro-collectionobject.xml mytenant/mytenant-collectionobject.xml

    cp anthro/domain-instance-vocabularies.xml mytenant/domain-instance-vocabularies.xml

    There is additional configuration for your tenant in the file tomcat-main/src/main/resources/{tenant_short_name}-tenant.xml. This file was based on the corresponding file for the tenant you used as a template. That file is named tomcat-main/src/main/resources/{template_short_name}-tenant.xml. You will need to check if the configuration for the template tenant has changed between 5.2 and 6.0. If so, make the same changes to your tenant's configuration file. For example, if your tenant is based on the anthro tenant, use git to check for changes to tomcat-main/src/main/resources/anthro-tenant.xml:

    cd /home/cspace/collectionspace-source # or cd /opt/collectionspace

    cd application

    git diff -w v5.2-branch tomcat-main/src/main/resources/anthro-tenant.xml

    This shows that no changes were made to the configuration for the template tenant (in this example, the anthro tenant) from 5.2 to 6.0. If there had been any changes, you would need to make the same changes to the configuration file for your tenant (tomcat-main/src/main/resources/{tenant_short_name}-tenant.xml). Note that the results will vary, depending on the template tenant. Some tenants may require configuration changes.

    If you created more than one tenant, repeat the above steps for each tenant.

    Upgrade Tenant Front End (UI) Configuration

    If you created a tenant in 5.2, the user interface for the tenant will be located in the services/cspace-ui directory. Inside that directory, there will be a directory named with the short name of your tenant.

    To upgrade your tenant, copy build.properties from the tenant that you used as a template for creating your tenant. For example, if the short name of your tenant is mytenant tenant, and your tenant was cloned from the anthro tenant:

    cd /home/cspace/collectionspace-source # or cd /opt/collectionspace

    cd services/cspace-ui

    cp anthro/build.properties mytenant

    If you created more than one tenant, repeat for each tenant.

    Build and Deploy

    Build and deploy CollectionSpace from the source code. The final ant command below includes the create_db target. This will not delete any existing data, because the -Drecreate_db=true parameter is not supplied.

    cd /home/cspace/collectionspace-source # or cd /opt/collectionspace

    cd services

    mvn clean install -DskipTests

    cd ../application

    mvn clean install -DskipTests

    cd ../services

    ant undeploy deploy create_db import

    Migrate Binary Data

    Perform the following steps as the user you use to run CollectionSpace – typically, either cspace or collectionspace.

    Move or copy the nuxeo-server/data directory from Tomcat 8.5.40 to Tomcat 8.5.51. This directory contains the binary data that was uploaded in CollectionSpace media records, so it can be large. Moving the directory instead of copying it is faster, and prevents unnecessary duplication. If you need to revert the upgrade, remember to move the directory back.

    cd /usr/local/share # or cd /opt/collectionspace

    mv apache-tomcat-8.5.40/nuxeo-server/data apache-tomcat-8.5.51/nuxeo-server

    Migrate Server Configuration

    You may have made configuration changes to the server in the old tomcat directory, in the files lib/security.properties and nuxeo-server/config/nuxeo.properties. Copy those files from apache-tomcat-8.5.40 to apache-tomcat-8.5.51.

    cd /usr/local/share # or cd /opt/collectionspace

    cp apache-tomcat-8.5.40/lib/security.properties apache-tomcat-8.5.51/lib/security.properties

    cp apache-tomcat-8.5.40/nuxeo-server/config/nuxeo.properties apache-tomcat-8.5.51/nuxeo-server/config/nuxeo.properties

    Verify the Upgrade

    Start CollectionSpace, being sure to use the startup script in the new Tomcat 8.5.51 directory, not the old Tomcat 8.5.40. Ensure that there are no errors in the logs during startup, and that you can log in to your tenant, and open and save records.