Deploying a Web App

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

The commands, 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 your web app. Use the ares-package command to create a package file.

Before executing the packaging command, you need to check the required files. An appinfo.json file must exist when packaging the web app. The ares-package command finds and reads the appinfo.json file from the web app directory. The appinfo.json file has required fields such as main and icon. For this reason, the icon image file and main page file also must exist in the correct path.

Packaging Web App

Specify a directory of your web app to be packaged when executing the ares-package command. Execute the following command to start packaging your web apps 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 app first, and then specify your services using the ares-package command. Execute the following command to package your web app of the 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, specify your service name that begins 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 command. 

Installing a Web App on Target Device

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

From webOS TV 3.0, you can test your app on the actual device using the 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, the ares-setup-device command shows device lists in detail with -F, --listfull options. 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 the remote computer for testing your web app. The following example describes how to set the host address of the 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 the ares-setup-device command. The following command shows how to change a target's host address in interactive mode. Run the ares-setup-device command without any option. The ares-setup-device command shows a target device list and starts 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.
? Select
> add
  modify
  remove 

If you do not want to change the previous value, press the enter key without any value. For more detailed information on ares-setup-device command 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 the target 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 ares-install command.

After installing your app, you should verify the app installation completed. Execute the following command to check the ID list of apps installed on the target. 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 command to remove your app. Enter the ID of the installed application using parameters. Execute the following command to remove your app 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 command to launch or close your web app installed on the target device. This section describes how to launch or close your web app.

You can launch or close a web app on Launcher UI on the emulator or real TV. You can also use an App Manager of the target device to launch or close your web app.

Launching Web App

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

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

Launched application com.yourdomain.app

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

Closing Web App

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

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

Closed application com.yourdomain.app
Navigation