Upgrading DCOR

DCOR only

Updating DCOR is done via the command:

dcor update

This will update all extensions to the latest release (if installed from PyPI) or to the latest commit (if installed from git repositories).

After each update, you should make sure that your installation is still set up correctly. The following command will check your configuration files (amongst other things):

dcor inspect

Upgrading CKAN/DCOR

If you would like to upgrade CKAN via a .deb package (recommended), you may have to install DCOR again (because the environment will be reset). First, follow the steps to upgrade CKAN from the CKAN docs:

  1. Make sure your system is up-to-date and not running any outdated binaries.

  2. Activate the virtual environment:

    source /usr/lib/ckan/default/bin/activate
    export CKAN_INI=/etc/ckan/default/ckan.ini
    
  1. Shut down all services:

    systemctl stop supervisor
    systemctl stop nginx
    
  2. Create a database backup:

    mkdir -p CKAN_updates
    DATE=$(printf '%(%Y-%m-%d)T\n' -1)
    CKANVER=$(python -c "import ckan; print(ckan.__version__)")
    sudo -u postgres pg_dump --format=custom -d ckan_default > CKAN_updates/ckan_${CKANVER}_${DATE}.dump
    
  3. Check the CKAN Changelog to see if there are any incompatibilities. Making a patch release upgrade should not be problematic, but if you are planning to upgrade to a minor release, please be careful. You should probably also check the CKAN upgrade docs.

    Install the latest version of CKAN for your system:

    CKANMINOR=2.10
    CKANPATCH=2.10.4
    UBUNTURELEASE=$(lsb_release -cs)
    DLNAMESERVR=python-ckan_${CKANMINOR}-${UBUNTURELEASE}_amd64.deb
    DLNAMELOCAL=python-ckan_${CKANPATCH}-${UBUNTURELEASE}_amd64.deb
    mkdir -p CKAN_updates
    wget https://packaging.ckan.org/${DLNAMESERVR} -O CKAN_updates/${DLNAMELOCAL}
    apt-get -y remove python-ckan
    rm -rf /usr/lib/ckan/
    dpkg -i CKAN_updates/${DLNAMELOCAL}
    
  4. Reactivate the environment:

    deactivate
    source /usr/lib/ckan/default/bin/activate
    export CKAN_INI=/etc/ckan/default/ckan.ini
    
  5. For the upgrade from CKAN 2.0 to 2.10, Solr must be installed (previous versions of Solr were installed via apt):

    apt purge tomcat9 solr-tomcat
    

    Then, install solr manually as described in (installing openjdk-8-jdk-headless is sufficient, you don’t have to install openjdk-8-jdk). https://docs.ckan.org/en/2.10/maintaining/installing/solr.html?highlight=solr#installing-solr-manually (CKAN 2.10 only supports solr 8.x). Note that solr by default listens to tcp6 (IPv6). Thus, any setting in the ckan.ini file that uses 127.0.0.1 will not work - use localhost instead. To test solr, make sure that the following URL returns JSON data: http://localhost:8983/solr/ckan/select/?q=*:*&rows=1&wt=json

  6. Install DCOR (either via pip or as described in the development section):

    # might be necessary if pip is still broken
    wget https://gitlab.gwdg.de/pmuelle3/ckan-release-mirror/-/raw/main/get-pip.py?inline=false -O CKAN_updates/get-pip.py
    # Make sure there is no conflict between setuptools and distutils
    # (https://github.com/pypa/setuptools/issues/2993#issuecomment-1003765389)
    export SETUPTOOLS_USE_DISTUTILS=stdlib
    python CKAN_updates/get-pip.py
    pip install --upgrade pip wheel
    pip install --upgrade --force-reinstall dcor_control
    
  7. Rerun rebranding scripts:

    sed -i 's/ckan.locale_default=en_US/ckan.locale_default=en_GB/g' /etc/ckan/default/ckan.ini
    ckan dcor-theme-main-css-branding
    ckan dcor-theme-i18n-branding
    
  8. Make sure the configuration is intact (you may skip scanning for orphaned files):

    dcor inspect
    
  9. If the CKAN upgrade requires a database upgrade (see CKAN changelog):

    ckan db upgrade
    # This will take some time. For installations with many datasets, consider
    # running it in a screen session:
    ckan search-index rebuild
    
  10. Finally start nginx and supervisor:

    systemctl start nginx
    systemctl start supervisor