Skip to content

Upgrading application

This tutorial shows how to upgrade application that is already working on Onteon.

Environment

To execute upgrade, you need at least one application that will be upgraded. In this example it is onteon-demo-app-cookbook-native application, but you can use any application you want.

$ onteoncli application list
id                       createdAt                updatedAt                name                            version type     processType
616c341335699a6b5d599d80 2021-10-17T14:32:51.352Z 2021-10-17T14:32:51.352Z onteon-demo-app-cookbook-native 1.1.0   standard native

You can create some application instances with distribution. Here you can check how to create distribution. In this example, the application is managed by distribution with two instances.

$ onteoncli distribution list 
id                       createdAt                updatedAt                applicationId            numberOfInstances
616c343135699a6b5d599d95 2021-10-17T14:33:21.361Z 2021-10-17T14:33:21.361Z 616c341335699a6b5d599d80 2

$ onteoncli application-instance list
id                       createdAt                applicationName                 applicationVersion applicationId            nodeId                   status
425ca0bf0970aac55f5d7872 2021-10-17T14:33:51.155Z onteon-demo-app-cookbook-native 1.1.0              616c341335699a6b5d599d80 1a2d8cb8c6de564d4539e465 running
1528193ccdc887a2630f53fb 2021-10-17T14:33:35.221Z onteon-demo-app-cookbook-native 1.1.0              616c341335699a6b5d599d80 06e038fbac709788daf38f31 running
84251c30393279449134a42c 2021-10-17T14:31:31.592Z nginx-edge                      1.0.0              null                     1a2d8cb8c6de564d4539e465 running
c42f36e661d93dca00e56c2f 2021-10-17T14:31:31.535Z nginx-edge                      1.0.0              null                     06e038fbac709788daf38f31 running
239bbef3f08952cb4d2febd1 2021-10-17T14:31:30.486Z nginx-inner                     1.0.0              null                     1a2d8cb8c6de564d4539e465 running
a198d08a1bddf68874ed9e72 2021-10-17T14:31:30.434Z nginx-inner                     1.0.0              null                     06e038fbac709788daf38f31 running

Notice that, distribution has id of application in version 1.0.0. After upgrade, this will change to id of new application.

Upgrade

First, you need to upload new application version.

$ onteoncli application-registry upload onteon-demo-app-cookbook-native-1.1.1.tar.gz 
Starting upload session...
Sending part no 0...
Sending part no 1...
Sending part no 2...
Sending part no 3...
Sending part no 4...
Sending part no 5...
Sending part no 6...
Sending part no 7...
Sending part no 8...
Sending part no 9...
Finishing upload session...
uploaded: true

$ onteoncli application list
id                       createdAt                updatedAt                name                            version type     processType
616c35f235699a6b5d599f25 2021-10-17T14:40:50.141Z 2021-10-17T14:40:50.141Z onteon-demo-app-cookbook-native 1.1.1   standard native
616c341335699a6b5d599d80 2021-10-17T14:32:51.352Z 2021-10-17T14:32:51.352Z onteon-demo-app-cookbook-native 1.1.0   standard native

Now you can use application change. It will replace old application with new one. You need to execute this command: onteoncli application-change create <oldApplicationId> <newApplicationId>.

$ onteoncli application list
id                       createdAt                updatedAt                name                            version type     processType
616c35f235699a6b5d599f25 2021-10-17T14:40:50.141Z 2021-10-17T14:40:50.141Z onteon-demo-app-cookbook-native 1.1.1   standard native
616c341335699a6b5d599d80 2021-10-17T14:32:51.352Z 2021-10-17T14:32:51.352Z onteon-demo-app-cookbook-native 1.1.0   standard native

$ onteoncli application-change create 616c341335699a6b5d599d80 616c35f235699a6b5d599f25
id:               616c368835699a6b5d599fbc
createdAt:        2021-10-17T14:43:20.413Z
updatedAt:        2021-10-17T14:43:20.413Z
oldApplicationId: 616c341335699a6b5d599d80
newApplicationId: 616c35f235699a6b5d599f25

After a while, you should see the results of application change.

$ onteoncli distribution list 
id                       createdAt                updatedAt                applicationId            numberOfInstances
616c343135699a6b5d599d95 2021-10-17T14:33:21.361Z 2021-10-17T14:43:30.058Z 616c35f235699a6b5d599f25 2

$ onteoncli application-instance list
id                       createdAt                applicationName                 applicationVersion applicationId            nodeId                   status
379a44c8a96f9d60ef7a9ff1 2021-10-17T14:44:40.222Z onteon-demo-app-cookbook-native 1.1.1              616c35f235699a6b5d599f25 06e038fbac709788daf38f31 running
be4b942c68984d1d31b584c7 2021-10-17T14:43:34.15Z  onteon-demo-app-cookbook-native 1.1.1              616c35f235699a6b5d599f25 1a2d8cb8c6de564d4539e465 running
84251c30393279449134a42c 2021-10-17T14:31:31.592Z nginx-edge                      1.0.0              null                     1a2d8cb8c6de564d4539e465 running
c42f36e661d93dca00e56c2f 2021-10-17T14:31:31.535Z nginx-edge                      1.0.0              null                     06e038fbac709788daf38f31 running
239bbef3f08952cb4d2febd1 2021-10-17T14:31:30.486Z nginx-inner                     1.0.0              null                     1a2d8cb8c6de564d4539e465 running
a198d08a1bddf68874ed9e72 2021-10-17T14:31:30.434Z nginx-inner                     1.0.0              null                     06e038fbac709788daf38f31 running

As you can see, distribution's applicationId is up to date, old application instances are removed and new ones are running.