Chapter 5. Migration of information from a deployment on Red Hat OpenShift Container Platform 3 If you previously used a Red Hat Process Automation Manager deployment on Red Hat OpenShift Container Platform 3, you can migrate the information from that deployment to a new deployment on Red Hat OpenShift Container Platform 4. Before migrating information, you must deploy a new Red Hat Process Automation Manager infrastructure on Red Hat OpenShift Container Platform 4 using the operator. Include the same elements in the new infrastructure as those present in the old deployment. For example: For any existing authoring deployment, create a new authoring infrastructure, including Business Central and at least one KIE Server. For any existing immutable KIE Server, deploy a new immutable KIE Server with the same artifacts. For any existing KIE Server with a MySQL or PostgreSQL database pod, deploy a new KIE Server with the same type of database pod. For any existing KIE Server that uses an external database server, deploy a new KIE Server that uses the same external database server with the same credentials. The server connects to the same database and therefore can read the process context state. Note If a KIE Server uses the H2 built-in database, migration of the process context state is not supported. No migration is required for Smart Router. A new deployment of Smart Router automatically works with the services on the new KIE Servers. 5.1. Migrating information in Business Central If you have an existing authoring environment in Red Hat OpenShift Container Platform 3, you can copy the .niogit repository and the Maven repository from Business Central in this environment to Business Central in a new deployment on Red Hat OpenShift Container Platform 4. This action makes all the same projects and artifacts available in the new deployment. Prerequisites You must have a machine that has network access to both the Red Hat OpenShift Container Platform 3 and Red Hat OpenShift Container Platform 4 infrastructures. The oc command-line client from Red Hat OpenShift Container Platform 4 must be installed on the machine. For instructions about installing the command-line client, see CLI tools in Red Hat OpenShift Container Platform documentation. Procedure Ensure that no web clients and no client applications are connected to any elements of the old and new deployment, including Business Central and KIE Servers. Create an empty temporary directory and change into it. Using the oc command, log in to the Red Hat OpenShift Container Platform 3 infrastructure and switch to the project containing the old deployment. To view the pod names in the old deployment, run the following command: Find the Business Central pod. The name of this pod includes rhpamcentr . In a high-availability deployment, you can use any of the Business Central pods. Use the oc command to copy the .niogit repository and the Maven repository from the pod to the local machine, for example: Using the oc command, log in to the Red Hat OpenShift Container Platform 4 infrastructure and switch to the project containing the new deployment. To view the pod names in the new deployment, run the following command: Find the Business Central pod. The name of this pod includes rhpamcentr . In a high-availability deployment, you can use any of the Business Central pods. Use the oc command to copy the .niogit repository and the Maven repository from the local machine to the pod, for example: 5.2. Migrating a MySQL database for a KIE Server If your environment in Red Hat OpenShift Container Platform 3 includes a KIE Server that uses a MySQL database pod, copy the MySQL database content from the old deployment to the new deployment. This action copies the existing process state to the new deployment. Prerequisites You must have a machine that has network access to both the Red Hat OpenShift Container Platform 3 and Red Hat OpenShift Container Platform 4 infrastructures. The oc command-line client from Red Hat OpenShift Container Platform 4 must be installed on the machine. For instructions about installing the command-line client, see CLI tools in Red Hat OpenShift Container Platform documentation. The mysql and mysqldump client applications provided by MySQL version 8 or later or by MariaDB version 10 or later must be installed. Procedure Ensure that no web clients and no client applications are connected to any elements of the old and new deployment, including Business Central and KIE Servers. Create an empty temporary directory and change into it. Using the oc command, log in to the Red Hat OpenShift Container Platform 3 infrastructure and switch to the project containing the old deployment. To view the deployment configuration names in the old deployment, run the following command: Find the mysql deployment configuration that corresponds to the required KIE Server instance. View the configuration YAML of the deployment configuration, for example: In this file, find the user name (normally rhpam ) and password for the database server, for example: Record the user name and password. Do not make any changes to the file. Note You can also use the following commands to retrieve the user name and password: To view the service names in the old deployment, run the following command: Find the mysql service that corresponds to the required KIE Server instance. In a separate terminal window, start port forwarding from the local host to the mysql service, using the name and port number displayed for the service, for example: Create a full database dump using the recorded user name, for example: When prompted, enter the recorded password. The dump creation can take considerable time. Stop the port forwarding in the separate window using the Ctrl+C key combination. Using the oc command, log in to the Red Hat OpenShift Container Platform 4 infrastructure and switch to the project containing the new deployment. To view the deployment configuration names in the new deployment, run the following command: Find the mysql deployment configuration that corresponds to the required KIE Server instance. View the configuration YAML of the deployment configuration, for example: In this file, find the user name (normally rhpam ) and password for the database server. Record the user name and password. Do not make any changes to the file. Note You can also use the following commands to retrieve the user name and password: To view the service names in the new deployment, run the following command: Find the mysql service that corresponds to the required KIE Server instance. In a separate terminal window, start port forwarding from the local host to the mysql service, using the name and port number displayed for the service, for example: Restore the database dump using the recorded user name, for example: When prompted, enter the recorded password. The restoration can take considerable time. Stop the port forwarding in the separate window using the Ctrl+C key combination. 5.3. Migrating a PostgreSQL database for a KIE Server If your environment in Red Hat OpenShift Container Platform 3 includes a KIE Server that uses a PostgreSQL database pod, copy the PostgreSQL database content from the old deployment to the new deployment. This action copies the existing process state to the new deployment. Prerequisites You must have a machine that has network access to both the Red Hat OpenShift Container Platform 3 and Red Hat OpenShift Container Platform 4 infrastructures. The oc command-line client from Red Hat OpenShift Container Platform 4 must be installed on the machine. For instructions about installing the command-line client, see CLI tools in Red Hat OpenShift Container Platform documentation. The psql and pg_dump client applications provided by PostgreSQL version 10 or later must be installed. Procedure Ensure that no web clients and no client applications are connected to any elements of the old and new deployment, including Business Central and KIE Servers. Create an empty temporary directory and change into it. Using the oc command, log in to the Red Hat OpenShift Container Platform 3 infrastructure and switch to the project containing the old deployment. To view the deployment configuration names in the old deployment, run the following command: Find the postgresql deployment configuration that corresponds to the required KIE Server instance. View the configuration YAML of the deployment configuration, for example: In this file, find the user name (normally rhpam ), password, and database name (normally rhpam7 ) for the database server, for example: Record the user name, password, and database name. Do not make any changes to the file. Note You can also use the following commands to retrieve the user name, password, and database name: To view the service names in the old deployment, run the following command: Find the postgresql service that corresponds to the required KIE Server instance. In a separate terminal window, start port forwarding from the local host to the postgresql service, using the name and port number displayed for the service, for example: Create a dump of the database using the recorded user name and database name, for example: When prompted, enter the recorded password. The dump creation can take considerable time. Stop the port forwarding in the separate window using the Ctrl+C key combination. Using the oc command, log in to the Red Hat OpenShift Container Platform 4 infrastructure and switch to the project containing the new deployment. To view the deployment configuration names in the new deployment, run the following command: Find the postgresql deployment configuration that corresponds to the required KIE Server instance. View the configuration YAML of the deployment configuration, for example: In this file, find the user name (normally rhpam ), password, , and database name (normally rhpam7 ) for the database server. Record the user name, password, and database name. Do not make any changes to the file. Note You can also use the following commands to retrieve the user name, password, and database name: To view the service names in the new deployment, run the command: Find the postgresql service that corresponds to the required KIE Server instance. In a separate terminal window, start port forwarding from the local host to the postgresql service, using the name and port number displayed for the service, for example: Restore the database dump using the recorded user name and database name, for example: When prompted, enter the recorded password. The restoration can take considerable time. Review any displayed database error messages. Messages about objects that already exist are normal. Stop the port forwarding in the separate window using the Ctrl+C key combination.

Commands:
get pods
cp myapp-rhpamcentr-5-689mw:/opt/kie/data/.niogit .niogit cp myapp-rhpamcentr-5-689mw:/opt/kie/data/maven-repository maven-repository
get pods
cp .niogit myappnew-rhpamcentr-abd24:/opt/kie/data/.niogit cp maven-repository myappnew-rhpamcentr-abd24:/opt/kie/data/maven-repository
get dc
edit dc/myapp-mysql
- name: MYSQL_USER value: rhpam - name: MYSQL_PASSWORD value: NDaJIV7!
get dc/myapp-mysql -ojsonpath='{.spec.template.spec.containers[0].env[?(@.name=="MYSQL_USER")]}'.value get dc/myapp-mysql -ojsonpath='{.spec.template.spec.containers[0].env[?(@.name=="MYSQL_PASSWORD")]}'.value
get svc
port-forward service/myapp-mysql 3306:3306
mysqldump --all-databases -u rhpam -p -h 127.0.0.1 > mysqldump.sql
get dc
edit dc/myappnew-mysql
get dc/myapp-mysql -ojsonpath='{.spec.template.spec.containers[0].env[?(@.name=="MYSQL_USER")]}'.value get dc/myapp-mysql -ojsonpath='{.spec.template.spec.containers[0].env[?(@.name=="MYSQL_PASSWORD")]}'.value
get svc
port-forward service/myappnew-mysql 3306:3306
mysql -u rhpam -p -h 127.0.0.1 < mysqldump.sql
get dc
edit dc/myapp-postgresql
- name: POSTGRESQL_USER value: rhpam - name: POSTGRESQL_PASSWORD value: NDaJIV7! - name: POSTGRESQL_DATABASE value: rhpam7
get dc/myapp-postgresql -ojsonpath='{.spec.template.spec.containers[0].env[?(@.name=="POSTGRESQL_USER")]}'.value get dc/myapp-postgresql -ojsonpath='{.spec.template.spec.containers[0].env[?(@.name=="POSTGRESQL_PASSWORD")]}'.value get dc/myapp-postgresql -ojsonpath='{.spec.template.spec.containers[0].env[?(@.name=="POSTGRESQL_DATABASE")]}'.value
get svc
port-forward service/myapp-postgresql 5432:5432
pg_dump rhpam7 -h 127.0.0.1 -U rhpam -W > pgdump.sql
get dc
edit dc/myappnew-postgresql
get dc/myapp-postgresql -ojsonpath='{.spec.template.spec.containers[0].env[?(@.name=="POSTGRESQL_USER")]}'.value get dc/myapp-postgresql -ojsonpath='{.spec.template.spec.containers[0].env[?(@.name=="POSTGRESQL_PASSWORD")]}'.value get dc/myapp-postgresql -ojsonpath='{.spec.template.spec.containers[0].env[?(@.name=="POSTGRESQL_DATABASE")]}'.value
get svc
port-forward service/myappnew-postgresql 5432:5432
psql -h 127.0.0.1 -d rhpam7 -U rhpam -W < pgdump.sql