Categories

Versions

Upgrade from 9.9.2 to 9.10.0

For RapidMiner AI Hub 9.10, our Docker Images have been improved to meet the latest security guidelines, including those of OpenShift and Rootless Docker.

To upgrade an existing system based on the older images, the permissions on the mounted filesystems must be changed so that the files are accessible to non-root users. Hence, we provide a migration script.

When upgrading RapidMiner AI Hub from a previous version to 9.10, please be aware of the following points.

  • You must upgrade from RapidMiner AI Hub 9.9.2. If you are using an earlier version of RapidMiner AI Hub, you first need to upgrade to version 9.9.2.

  • Before you upgrade RapidMiner AI Hub, be sure to shut down your current environment and then make a backup. A complete backup consists of three parts:

    1. the complete contents of the folder containing the files .env and docker-compose.yml. Note that Docker creates bind-mounts to the go and ssl subfolders.

    2. the complete set of named volumes referenced by the file docker-compose.yml. See the documentation Backup, restore, or migrate data volumes on the Docker website.

    3. any additional volumes spawned by JupyterHub, one per user, with names such as jupyterhub-user-<username>-<JUPYTER_STACK_NAME>.

  • Your backup will only have a consistent state if you first take RapidMiner AI Hub offline, by executing docker-compose down on the host machine.
  • The backup tools must conserve Linux file system metadata (user and group information, permissions, etc.).

Upgrade

Rootless Docker was introduced in Docker Engine version 19.03 as an experimental feature, and graduated from that status in version 20.10.

Hence, it is recommended that you use version >= 20.10 of the Docker Engine.

For details related to the operating system, see the distribution-specific hints. Note that CentOS 6/7 are not supported, because unprivileged user namespaces are not supported in Linux kernel versions < 3.19.

Once you have created a backup for your existing RapidMiner AI Hub 9.9.2, as described above, you are ready to upgrade. The following steps take place in your current production environment, the folder containing .env and docker-compose.yml.

  1. Download the upgrade scripts and unzip.

  2. Copy the following files into your current production environment, the folder containing .env and docker-compose.yml:

     docker-compose-gen2.yml
     env-gen2
     upgrade-gen2.sh
     migration-compose.yaml
     ReadMe.md
    

    The files docker-compose-gen2.yml and env-gen2 describe the new configuration, but env-gen2 does not yet include the values that are specific to your setup, e.g. for the variables marked CLIENT_SECRET, and contained in the old file .env. The file ReadMe.md explains how to manually merge .env and env-gen2, but in most cases it will be simpler to run the shell script described in the next step, provided that you have not heavily modified the files provided by this website.

  3. Before you run the shell script to to migrate your values of the environment variables from the old .env file to the new one, env-gen2, make sure that your .env and docker-compose.yml files have not been heavily modified. Ideally, your configuration is based on the templates provided by this website, using profiles to guide the choice of services. If you have added services to docker-compose.yml (e.g. StandPy or TabGo), you will need to add them also to docker-compose-gen2.yml.

    With these precautions in mind, run the shell script:

     sh upgrade-gen2.sh
    

    The script writes the modified values to the screen, and creates two patch files, so you have a record of the changes that will take place:

     upgrade-env.patch
     upgrade-yml.patch
    

    At this point, nothing has actually been changed, except that env-gen2 has been updated with your values. As a check, you can compare the proposed changes with the instructions in ReadMe.md. The next step initiates the upgrade.

  4. When you are satisfied that changes are correct, overwrite the original files, either by copying to them:

     cp env-gen2 .env
     cp docker-compose-gen2.yml docker-compose.yml
    

    or by patching them:

     patch .env upgrade-env.patch
     patch docker-compose.yml upgrade-yml.patch
    
  5. To satisfy the requirements of nginx within the context of rootless Docker, you need to change the file ownership of the ssl subfolder:

     sudo chown -R 2011:0 ssl   # as root user
    
  6. Run the upgrade / migration script to modify the file permissions on named volumes:

     docker-compose -f migration-compose.yaml up
    

    This script should run without any warnings or errors. If you see any, make sure that migration-compose.yaml has access to the same .env file as docker-compose.yml.

  7. Download the new images

     docker-compose pull
    
  8. Run RapidMiner AI Hub 9.10. The upgrade is complete!

     docker-compose up -d
    

upgrade-gen2.sh

#!/bin/bash

# The old files correspond to version 9.9.2 of RapidMiner AI Hub
# The new files correspond to version 9.10.0 of RapidMiner AI Hub

old_yml_file="docker-compose.yml"
new_yml_file="docker-compose-gen2.yml"

old_env_file=".env"
new_env_file="env-gen2"

# Find values of the environment variables in the old files that differ from the new files
# and copy them to the new files, excluding variables that should have new values,
# such as those labelled VERSION / BACKEND / REGISTRY

diff -u $old_env_file $new_env_file | grep ^-[^#-] | grep -v VERSION | grep -v BACKEND | grep -v REGISTRY | cut -c 2- | cut -d= -f1 | \
    while read key; do
        if grep -q $key= $new_env_file; then
            replacement=$(grep ^${key}= $old_env_file | cut -d= -f2)
            echo "$key=$replacement"
            perl -pi -e "s@^$key=.*@$key=$replacement@" $new_env_file
        fi 
    done

# Create patch files

diff -u $old_env_file $new_env_file > upgrade-env.patch

diff -u $old_yml_file $new_yml_file > upgrade-yml.patch

migration-compose.yaml

version: "3.9"
services:
  rm-migration-svc:
    image: "rapidminer/aihub-migration:9.10.0-gen2"
    container_name: "migration"
    #entrypoint: sh -c 'while true;do sleep 120;done'
    volumes:
      #RM PROXY & LE
      - ./ssl:/etc/nginx/ssl
      #KC PG
      #- keycloak-postgresql-vol:/var/lib/postgresql/data
      #RM-INIT
      - ./.env:/rm-init/rapidminer/.env
      - keycloak-admin-cli-vol:/rm-init/rapidminer/.keycloak/
      - deployed-services-vol:/rm-init/rapidminer/deployed-services/
      - ./go:/rm-init/go/
      #RM PG SVC
      #- rm-postgresql-vol:/var/lib/postgresql/data
      #RM SERVER SVC
      - rm-server-bootstrap-vol:/aihub/bootstrap.d
      - rm-server-home-vol:/aihub/persistent-rapidminer-home
      #RM JA
      - rm-server-bootstrap-ja-vol:/ja/bootstrap.d
      - rm-server-ja-extensions:/ja/rapidminer-jobagent/home/resources/extensions:rw
      - rm-server-ja-log-vol:/ja/rapidminer-jobagent/home/log
      - rm-server-ja-data-vol:/ja/rapidminer-jobagent/home/data
      #PA
      - platform-admin-uploaded-vol:/pa/var/www/html/uploaded/
      - rts-licenses-vol:/pa/var/www/html/uploaded/licenses/
      #RTS
      - rts-deployments-vol:/rtsa/rapidminer-scoring-agent/home/deployments/
      - rts-licenses-vol:/rtsa/rapidminer-scoring-agent/home/resources/licenses
      #JHUB DB
      #- jupyterhub-postgresql-vol:/var/lib/postgresql/data
      #CES
      - rm-coding-shared-vol:/ces/opt/coding-shared/
      #GF
      - grafana-home:/var/lib/grafana
      #LandingPage
      - rm-landing-page-vol:/landingpage/var/www/html/uploaded/
      - deployed-services-vol:/landingpage/rapidminer/deployed-services/
      #TokenTool
      - rm-token-tool-vol:/tokentool/var/www/html/uploaded/

volumes:
  rm-postgresql-vol:
  rm-server-bootstrap-vol:
  rm-server-home-vol:
  rm-server-bootstrap-ja-vol:
  rm-server-ja-log-vol:
  rm-server-ja-data-vol:
  rm-server-ja-extensions:
  platform-admin-uploaded-vol:
  rts-deployments-vol:
  rts-licenses-vol:
  jupyterhub-postgresql-vol:
  grafana-home:
  keycloak-postgresql-vol:
  keycloak-admin-cli-vol:
  rm-landing-page-vol:
  rm-token-tool-vol:
  deployed-services-vol:
  rm-coding-shared-vol:
    name: ${JHUB_ENV_VOLUME_NAME}
  rapidminer_automodel_dbdata:
  rapidminer_automodel_shared: