Managing IOx services lifecycle

The service management commands are available via ioxclient service set of commands. The operation and usage of these commands are same as that of the application management commands.

$ ioxclient  service
NAME:
   ioxclient service - Manage lifecycle of services

USAGE:
   ioxclient service command [command options] [arguments...]

COMMANDS:
   list, li		            List installed services on the system
   install, in		        Install a service
   start, sta		        Start an installed service
   stop, stp		        Stop an installed service
   restart, rs		        Restart an installed service
   status, sts		        Get current status of an installed service
   info, inf		        Get info pertaining to an installed service
   activate, act	        Activate Service
   deactivate, deact	    Deactivate Service
   uninstall, unin	        Uninstall an installed service
   upgrade, upgr	        Upgrade a service
   getconfig, getconf	    Get config information of an installed service
   setconfig, setconf	    Set config information for an installed service from the specified file
   infrastructure,infra     Used for device provisioning, messaging,
   logs, lgs		        Manage log files
   datamount, dm	        Manage contents of service's data mount directory
   appdata, appdata	        Manage files in the appdata directory under datamount
   console, con		        Connect to the console of the service
   metrics, met		        Get resource usage metrics of installed services
   help, h		            Shows a list of commands or help for one command

OPTIONS:
   --help, -h			show help
   --generate-bash-completion

Installing a service with dependent IOx Services

A user who wants the dependencies of the services to be taken care of, can specify the ioxclient to resolve dependencies in two methods -

There are three flags available to achieve this functionality -

  • --resolve-dependencies or --rd : specify this flag to enable automatic dependency resolution
  • --service-source or --src : specify a folder containing service bundles to use them for dependency resolution. If no folder is specified, fogportal will be searched for the required packages.
  • --service-activation-payload or --p - where the path of the activation payload for services is specified.

Resolve Service Dependencies from the Fog portal

Here, the ioxclient searches for the required services from the Fog portal, downloads them into a temp folder and installs, activates using the activation payload, and runs them in order to install the required service

A sample service install is as follows -

~$ioxclient svc in mw test_resources\svc-bundles\mw-core.tar.gz --rd --p test_resources\nat-activation.json

Sample Output

Currently active profile :  vm211
Command Name: service-install
Resolve Dependencies flag specified by user
Reading  test_resources\svc-bundles\mw-core.tar.gz ......
Parsing  mw-core.tar.gz .yaml
Checking CAF for the already existing services
Existing services in CAF are -
Resolving dependencies from Fog portal
Checking fog portal for the dependencies that are not in CAF
Requesting  https://128.107.5.61:443/api/v1/fogportal/service_bundles/
Requesting -   https://128.107.5.61:443/api/v1/fogportal/service_bundles/
The following services are available in the Fog portal
1 .  middleware-core
2 .  Middleware Message Broker
Saving current configuration
Constructing a Dependency tree for middleware-core
|_middleware-core
|_|_Middleware Message Broker
Checking CPU architecture compatibility of the service  Middleware Message Broker
Middleware Message Broker  is present in the FogPortal
Downloading  Middleware Message Broker ....
Service bundle to be stored in  C:\Users\xyz\AppData\Local\Temp\185222e322175b49ebe62449798d47f48dbe449932d5b752e2c7a2321031952b
Installing the service  Middleware Message Broker
Installation Successful. Service is available at : https://10.78.106.211:8443/iox/api/v2/hosting/service-bundles/MiddlewareMessageBroker
Successfully deployed
Activating the service  Middleware Message Broker
Payload file : test_resources\nat-activation.json. Will pass it as application/json in request body..
Service MiddlewareMessageBroker is Activated
Starting the service  Middleware Message Broker
Service MiddlewareMessageBroker is Started

Resolved status of  Middleware Message Broker  -  true
Installation Successful. Service is available at : https://10.78.106.211:8443/iox/api/v2/hosting/service-bundles/mw
Successfully deployed

Resolve Service Dependencies from the folder

In this case, the specified folder is searched for the required dependencies and the ones required are installed, activated and started in order to install the service.

~$ioxclient svc in mw test_resources\svc-bundles\mw-core.tar.gz --rd --src test_resources\svc-bundles -p test_resources\nat-activation.json

Sample Output

 Currently active profile :  vm211
 Command Name: service-install
 Resolve Dependencies flag specified by user
 Reading  test_resources\svc-bundles\mw-core.tar.gz ......
 Parsing  mw-core.tar.gz .yaml
 Checking CAF for the already existing services
 Existing services in CAF are -
 Resolving dependencies from the specified Local respository
 Searching the specified local repo for the dependencies..
 Unpacking  MessageBus.tar.gz
 Reading  test_resources\svc-bundles\MessageBus.tar.gz ......
 Parsing  MessageBus.tar.gz .yaml
 Unpacking  mw-core.tar.gz
 Reading  test_resources\svc-bundles\mw-core.tar.gz ......
 Parsing  mw-core.tar.gz .yaml
 Saving current configuration
 Constructing a Dependency tree for middleware-core
 |_middleware-core
 |_|_Middleware Message Broker
 Checking CPU architecture compatibility of the service  Middleware Message Broker
 Installing the service  Middleware Message Broker
 Installation Successful. Service is available at : https://10.78.106.211:8443/iox/api/v2/hosting/service-bundles/MiddlewareMessageBroker
 Successfully deployed
 Activating the service  Middleware Message Broker
 Payload file : test_resources\nat-activation.json. Will pass it as application/json in request body..
 Service MiddlewareMessageBroker is Activated
 Starting the service  Middleware Message Broker
 Service MiddlewareMessageBroker is Started

 Resolved status of  Middleware Message Broker  -  true
 Installation Successful. Service is available at : https://10.78.106.211:8443/iox/api/v2/hosting/service-bundles/mw
 Successfully deployed