Updating Kantree

Each Kantree version is fully contained within itself and can be re-installed almost fully using the ./platform init command. You will have to make sure that your license file and configuration file are copied from previous versions.

Important: If you are storing your uploaded files in a folder located under the Kantree folder, you will also need to move that. Our recommendation is to have your upload folder out of the Kantree folder.

Steps

Kantree is very easy to update:

  • Download the latest release
  • Unpack the archive
  • Copy your license file and configuration file (./config.yml) inside the new folder
  • Run ./platform upgrade
  • Stop the previous processes
  • Restart them from the new folder

Changelog

The changelog is available online and inside the archive.

Recommendations for programmatically updating Kantree

For a faster and automated update process, we recommend the following architecture.

First, let’s consider the following folder hierarchy:

/opt/kantree
 |-- current -> versions/8.3.5
 |-- versions
 |    |-- 8.3.4
 |    |-- 8.3.5
 |-- uploads
 |-- venv

(Note: we are using /opt/kantree as the base but you can install Kantree anywhere)

Here we are storing each Kantree releases under the versions folder. The current folder is a symlink towards the current version.

We are keeping the uploads and venv folders outside of the actual installation path to avoid moving/re-installing them with each release. This means you will need to make sure your configuration file properly sets the upload folder (in our case /opt/kantree/uploads).

The location of the venv path can be overrided using the KANTREE_VENV_PATH environment variable.

Important: the Python virtualenv folder cannot be moved or it would break it (this is a weakness of virtualenvs…).

You will still need to copy the license and config.yml files into the new release folder for each release. You can store them in /opt/kantree and copy them from there everytime.

Here is an example bash script that downloads and installs the latest version of Kantree assuming the described structure:

#!/bin/bash
VERSION=$1
if [ -z "$VERSION" ]; then
    VERSION=$(curl -s https://enterprise.kantree.io/releases/current-version)
    echo "Fetched latest version from Kantree server: $VERSION"
fi
if [ -z "$VERSION" ]; then
    echo "No version number provided: provide a version number as script argument or check your internet connection"
    exit 1
fi
if [ -e current ]; then
    if [ "$(cat current/VERSION)" == "$VERSION" ]; then
        echo "Current version $VERSION is already the latest"
        exit 0
    fi
fi
echo "Updating to $VERSION"
if [ ! -e versions/$VERSION ]; then
    wget https://s3.eu-central-1.amazonaws.com/kantree-enterprise/kantree-enterprise-$VERSION.tar.bz2
    if [ $? -ne 0 ]; then
        echo "Failed downloading archive"
        exit 1
    fi
    tar xjf kantree-enterprise-$VERSION.tar.bz2 -C /tmp
    mv /tmp/kantree versions/$VERSION
else
    echo "Version is already present in versions folder, keeping current folder"
fi
cp license config.yml versions/$VERSION
cd versions/$VERSION
sed -i "2iexport KANTREE_VENV_PATH=/opt/kantree/venv" platform # we add a line with the venv path inside the platform script so we do not need to worry about env vars
./platform init
cd ../..
if [ -e current ]; then
    rm current
fi
ln -s versions/$VERSION current
# add commands to restart processes

Save it as /opt/kantree/update.sh, give it execution right, and run it regularly. It will check for new versions and download them when available. Note that this script does not take care of restarting processes so you will need to modify it to do so.

Releases API endpoints

The following HTTP endpoints can be used to retrieve releases information:

  • https://enterprise.kantree.io/releases.json: info about latest releases in reverse chronological order in JSON format
  • https://enterprise.kantree.io/releases/envvars: env vars with info for latest release
  • https://enterprise.kantree.io/releases/current-version: the current version number