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 init
  • 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 retreive 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

Migrating from version before 8.0

The backend part of Kantree 8.0 has been through a big rewrite. While the platform script helping you to manage your instance has not changed, the configuration file location and format has completely changed.

Here are the pain points when you are updating from a previous version:

  • The configuration file is now located at the root of the installation under the name config.yml
  • A lot of the configuration keys have changed
  • Possible options values are listed in kantree/config.py
  • Default location of uploaded files is now the uploads folder at the root of the installation. You will need to move your previous folder.
  • Kantree doesn’t include a runner anymore, only a Procfile. Although this should be hidden under ./platform run

The most important settings to take into account:

  • The former features section has disappeared
  • Database URI is now defined under the key database_uri
  • Redis URI is now defined under the key redis_uri
  • The push server url is now defined under a key push_server_url
  • The upload dir is now defined under a key upload_dir
  • SMTP options are now prefixed with smtp_ and are not located under any other key
  • Extensions located in the folder kantree/extensions can be activated under the extensions key.
  • If you were using ldap, see the Directory Services chapter

A basic configuration now looks like this:

secret_key: "XXX..."
server_name: localhost:5000
server_secured: false
database_uri: "postgresql://..."
redis_uri: "redis://localhost"
push_server_url: "http://localhost:4000"
upload_dir: "uploads"
smtp_server: localhost
smtp_port: 25
smtp_username: username
smtp_password: password