Tutorial

Auxiliary Upgrade

Applicable to versions of SuperMap iManager for Kubernetes and GIS Cloud Suite before 10.1.0 manual operation instructions for upgrading to the latest version.

The minimum version supported by the upgrade package is version 10.1.0. If you want to upgrade from version before 10.1.0 to the latest version through the upgrade package, you first need to upgrade to version 10.1.0 through the previous method. Then follow the content below to do the necessary operations. After the operation is completed, refer to Use Upgrade Package to upgrade.

Notices

  1. This auxiliary instructions require the user to have the ability to operate the Kubernetes cluster through kubectl and to have access to Docker for upgrading script.
  2. The current directory during the upgrade process refers to the directory containing all the files extracted with the 辅助升级手册.pdf.
  3. Direct pasting of the commands used in the instructions may result in incorrect formatting. Please compare the line numbers to ensure the correct format.

Database Migration

Migration from a MySQL database to a PostgreSQL database

The following operations are performed in the current directory without special declaration.

The keycloak before version 10.1.0 uses the MySQL database to store data, and the version after 10.1.0 uses the PostgreSQL database for storage. Before using the upgrade package to upgrade, you need to migrate the data from the MySQL database to the PostgreSQL database.

Parameter Specification

Param Specification
<namespace> Namespace of SuperMap iManager for Kubernetes and GIS Cloud Suite
<Kubernetes public ip> The IP of the host where the upgrade package is located and can access the product. For example: the product page can be accessed by http://172.16.120.139:31100, <Kubernetes public ip> should be 172.16.120.139
  1. Check the database used by Keycloak, enter the following command to see if there is a keycloak-postgresql service, if not, go to the next step, otherwise do not need to.

    kubectl -n <namespace> get svc | grep keycloak-postgresql
  2. Images preparation. Pull the following images from Alibaba Cloud registry. If it is an intranet environment, you need to pull them from Alibaba Cloud registry, save them as files through docker save, transfer them to the intranet, restore them through docker load, and then modify the image registry names through docker tag. Then push them to the intranet image registry. The following places where the images are used need to be manually replaced with the intranet image registry address.

    docker pull registry.cn-beijing.aliyuncs.com/supermap/postgres:10
    docker pull registry.cn-chengdu.aliyuncs.com/supermap/pgloader:ccl.3.6.3
  3. Application YAML file. Create a keycloak-postgresql(To use a non-Alibaba cloud registry, you need to modify the image registry address in the YAML file). Wait for the created keycloak-postgresql Pod to start successfully, which can be viewed through the log.

    kubectl -n <namespace> apply -f data_migration/keycloak-postgresql-single.yaml
  4. Migrate data to PostgreSQL

    Use the following command to get the export port of SuperMap iManager for Kubernetes.

    mysql_port=$(kubectl -n <namespace> get svc imanager-mysql-for-export --output="jsonpath={.spec.ports[0].nodePort}");

    Use the following command to get the export port of GIS Cloud Suite.

    mysql_port=$(kubectl -n <namespace> get svc keycloak-mysql-for-export --output="jsonpath={.spec.ports[0].nodePort}");

    Start to migrate.

    postgresql_port=$(kubectl -n <namespace> get svc keycloak-postgresql-for-import --output="jsonpath={.spec.ports[0].nodePort}");
    docker run -it --rm registry.cn-chengdu.aliyuncs.com/supermap/pgloader:ccl.3.6.3 \
     pgloader \
     mysql://supermap:supermap@<Kubernetes public ip>:$mysql_port/keycloak \
     postgresql://supermap:supermap@<Kubernetes public ip>:$postgresql_port/keycloak
     
    docker run -it --rm \
     --entrypoint bash \
     -v $(pwd)/data_migration/:/root/data_migration \
     registry.cn-beijing.aliyuncs.com/supermap/postgres:10 \
     -c "export PGPASSWORD=supermap; psql -h <Kubernetes public ip> -p 30507 -U supermap keycloak < /root/data_migration/transtar.sql"
  5. Clean up service

    kubectl -n <namespace> delete svc keycloak-mysql-for-export keycloak-postgresql-for-import imanager-mysql-for-export

GIS Cloud Suite

The following sections are specific to the GIS Cloud Suite.

Parameter Specification: <giscloudsuite namespace> is the namespace of GIS Cloud Suite.

  1. Scale StatefulSet consul-server replications to 3.

    kubectl scale -<giscloudsuite namespace> --replicas=3 statefulset/consul-server
  2. Expose Service keycloak

    Notice: Improper operation of the following steps will result in inaccessibility after the upgrade. Please check before proceeding.

    1. Confirm the protocol and port of keycloak

    Visit the GIS Cloud Suite page, click Service Management, you should jump to the login page. If there is no jump, execute the logout operation.

    View the request address of the login page, and record the protocol and port of the login address. For example, the request address is https://172.16.120.139:32221, the protocol is the https, and the port is 32221.

    1. Delete Service keycloak and keycloak-external
    kubectl -n <giscloudsuite namespace> delete svc keycloak keycloak-external
    1. Replace the placeholders below and recreate Service keycloak。

    If using https protocol, replace <target port> with 8443, otherwise with 8080.

    <access port> is the port accessed by keycloak, such as 32221 in the above example.

    cat <<EOF | kubectl -n <giscloudsuite namespace> apply -f -
    apiVersion: v1
    kind: Service
    metadata:
      labels:
        type: icloud-native
        kind: icloud-native-dev
      name: keycloak
    spec:
      type: NodePort
      ports:
      - name: http
        port: <target port>
        targetPort: <target port>
        NodePort: <access port>
      selector:
        app: keycloak
    EOF