Deploying a Web App

This article describes how to package, install and execute a web application on an emulator or webOS TV for deploying purposes.

The scripts, ares-package, ares-install, ares-setup-device and ares-launch are used to deploy web applications. See Using webOS TV CLI for the detailed description.

 

Packaging a Web App for Deploying

The first step is creating a package file (.ipk) for web applications. Use the ares-package script to create a package file. This script also reduces the code size before packaging.

Before execute the packaging command, you need to check the required files. An appinfo.json file must exist when packaging web application. The ares-package script will find and read appinfo.json from the web application directory. An appinfo.json file has essential fields such as main and icon. For this reason, icon image file and main page file also must exist in the correct path.

ares-package script includes simple building function based on Enyo Framework. For Enyo Framework 2.6, we provide Enyo Developer Tools to enable you to build your app with various convenience options. You can build your app with the appropriate option of Enyo Development Tools, and then packing your app with ares-package script. For more information, refer to below URL.

Packaging Web App

Specify a directory of the web application to be packaged when executing the ares-package script. Execute the following command to start packaging the web applications in the sampleApp directory. 

ares-package ./sampleApp

Creating package com.yourdomain.app_0.0.1_all.ipk in ./

Packaging Web App with JavaScript Service

Specify a directory of your web application first, and then specify your services using the ares-package script. Execute the following command to package your web application of sampleApp directory and your service of sampleService. 

ares-package ./sampleApp ./sampleService

Creating package com.yourdomain.app_0.0.1_all.ipk ./

To package your app and service into one ipk file, your service name must begin with the app ID. For example:

App ID: "com.yourdomain.app" 
Service ID: "com.yourdomain.app.myService"

 

Now you can see that the package file exists in the directory from which you execute the script. 

 

 


Installing a Web App on Target Device

You need to install the created package file on a target device. Use the ares-install script to see the list of target devices before installing the web application. You can also modify the setting for the device using the ares-setup-device script.

From webOS TV 3.0, you can test your app on the actual device using Developer Mode app. For more information, see App Testing.

Listing Target Device

Use the ares-setup-device command to check the name of the device, platform type, description, and SSH access address of the target device. Execute the following command to view the list of target devices. 

ares-setup-device --list

name        deviceinfo               connection    profile
---------   --------------------     ------------  --------
emulator    developer@127.0.0.1:6622 ssh           tv
tv          prisoner@10.123.45.67    ssh           tv 

 

The emulator is included in the default device list. Also ares-setup-device command shows device lists in detail with -F, --listfull option. See the following command.

ares-setup-device --listfull

 

ares-setup-device --listful
[
  {
    "profile": "tv",
    "name": "tv",
    "deviceinfo": {
        "ip": "10.123.45.67",
        "port": "9922",
        "user": "prisoner"
    },
    "connection": [
        "ssh"
    ],
    "details": {
        "platform": "starfish",
        "privatekey": "tv_webos",
        "passphrase": "ares-setup-device --full",
        "description": "new device"
    }
  },
  {
    "profile": "tv",
    "name": "emulator",
    "deviceinfo": {
        "ip": "127.0.0.1",
        "port": "6622",
        "user": "developer"
    },
    "connection": [
    "ssh"
    ],
    "details": {
        "platform": "starfish",
        "privatekey": "webos_emul",
        "description": "LG webOS TV Emulator"
    }
  }
]

Setting Target Device

The default loopback address needs to be changed to the remote host address if using the emulator on a remote computer for testing the web application. The following example describes how to set the host address of webOS TV emulator to the target device: 

ares-setup-device --modify emulator --info "host=10.177.231.137"

 

Re-check the device list to confirm if the host address of the target device has been modified.

ares-setup-device --list

 

name     deviceinfo                    connection  profile
-------- ----------------------------- ----------  -------

tv       prisoner@10.123.45.67         ssh         tv

emulator developer@10.177.231.137:6622 ssh         tv

 

There is another way to change the target device's information with the interactive mode of ares-setup-device script. The following command shows how to change an target's host address in interactive mode. Run ares-setup-device script without any option. ares-setup-device script will show target device list and start interactive mode as below.

ares-setup-device
 

name     deviceinfo               connection  profile
-------- ------------------------ ----------  --------
tv       prisoner@10.123.45.67    ssh         tv
emulator developer@127.0.0.1:6622 ssh         tv
 

** You can modify the device info in the above list, or add new device.
? Slect
> add
  modify
  remove 

 

If you do not want change previous value, press the enter key without any value. For more detailed information on ares-setup-device script usage, see Using webOS TV CLI.

Installing a Web App

Execute the following command to install the package file on the target. Input the name of emulator and package file as parameters.

ares-install --device emulator ./com.yourdomain.app_0.0.1_all.ipk

Installing package com.yourdomain.app_0.0.1_all.ipk
Success

 

Run the target device, before you execute the installation command.

 

After installing the application, you should verify the app installation completed. Execute the following command to check the ID list of applications installed on the emulator. Make sure that your app ID exists in the result. 

ares-install --device emulator --list

...
com.yourdomain.sampleapp

Removing a Web App

Use the --remove option of the ares-install script to remove the application. Enter the ID of the installed application using parameters. Execute the following command to remove the application installed on the target as shown in the following example. 

ares-install --device emulator --remove com.yourdomain.app

Removed application com.yourdomain.app

Launching a Web App on Target Device

Use the ares-launch script to launch or close the web application installed on the target device. This section describes how to launch or close the web application.

 

You can launch or close web application on Launcher UI on Emulator or real TV. And also you can use an App Manager of the target device to launch or close a web application.

Launching Web Application

Select the target device name and the application ID from the device and the application list, used during the installation phase, and enter them as parameters before executing the command as shown follow:

ares-launch --device emulator com.yourdomain.app

Launched application com.yourdomain.app

 

After executing the above command, you need to check whether the sample application started on the target device or not. 

Closing Web Application

Enter the names of target device and application using parameters to close the currently running application, just as in launching the application. 

ares-launch --device emulator --close com.yourdomain.app

Closed application com.yourdomain.app

Navigation