Search by Tags

Web Browser / Kiosk Mode with TorizonCore

 

Article updated at 22 Dec 2020
Compare with Revision


Subscribe for this article updates

Select the version of your OS from the tabs below. If you don't know the version you are using, run the command cat /etc/os-release or cat /etc/issue on the board.



Remember that you can always refer to the Torizon Documentation, there you can find a lot of relevant articles that might help you in the application development.

Torizon 5.0.0

Introduction

The Torizon kiosk-mode browser container runs a browser in kiosk-mode, allowing the implementation of web-based UIs for kiosk applications.

This container should be used together with the torizon/weston container to provide a kiosk-mode user interface with a browser that opens an URL passed as a parameter, does not show error messages/popups and does not allow the user to navigate to different websites.

What is Kiosk-mode

It is a full-screen mode where only the web page is displayed. The user cannot see the window, the top bar, refresh button, or anything else.

Tehcnical Details

The current implementation is based on Chromium (using ozone/wayland rendering backend) and it is not optimized and does not use the GPU. We are working on a browser implementation that can leverage hardware features like the GPU and HW accelerated video playback. If you need HW accelerated browser, please subscribe to our BSP Layers and Reference Images for Yocto Project Issue Tracker or contact us to get updates on the current status.

This article complies to the Typographic Conventions for Torizon Documentation.

Prerequisites

Usage

First, start the Wayland server container (torizon/weston) as explained on Debian Containers for Torizon to provide the graphical environment for the browser window. Moreover, depending on how your application is designed, also start a container that provides the local UI that the kiosk browser will render.

The kiosk container needs visibility to some host resources (for accessing the accelerated graphical environment, buffer sharing, and inter-process communication), and the URL of the web UI as a command line parameter. It also recognizes some optional command line flags (explained ahead).

Execution example of the kiosk mode browser (Wayland build, with hardware graphical acceleration):

# docker run -d --rm -v /tmp:/tmp -v /dev/dri:/dev/dri -v /var/run/dbus:/var/run/dbus \
              --device-cgroup-rule='c 226:* rmw' --shm-size="256m" \
              --security-opt="seccomp=unconfined" --name kiosk \
              torizon/kiosk-mode-browser:$CT_TAG_KIOSK_MODE_BROWSER \
              --virtual-keyboard https://www.toradex.com

Execution example of the kiosk mode browser (X11 build, without hardware graphical acceleration):

# docker run -d --ipc=host --rm -v /tmp:/tmp -v /dev/dri:/dev/dri -v /var/run/dbus:/var/run/dbus \
              --device-cgroup-rule='c 226:* rmw' --shm-size="256m"
              --security-opt="seccomp=unconfined" --name kiosk \
              torizon/kiosk-mode-browser-x11:$CT_TAG_KIOSK_MODE_BROWSER_X11 \
              --virtual-keyboard https://www.toradex.com

Optional command line flags

It's possible to start chromium in less-secure ways (secure from the point of view of a user being able to run other graphical apps etc.) using command line switches.

  • --window-mode : runs the browser inside a maximized window without the navigation bar
  • --browser-mode : runs the browser in a standard window with navigation bars and all user menus enabled
  • --virtual-keyboard : enables a virtual keyboard for text entry

Docker Compose

Docker compose can be used to start multiple containers at the same time, providing shared data volumes, mount points, resource usage limitations, etc. If you want to use the kiosk-mode-browser container in this way it's a good idea to make it dependent on the Wayland compositor container and the container providing the data that should be displayed by the UI.

You can find example Docker compose files in our sample repository: https://github.com/toradex/torizon-samples/tree/bullseye/debian-container/demonstration

Optional Command Line Flags on Docker Compose

The previously described command line flags must be added to the command parameter on the docker-compose file. See an example in the code snippet below:

docker-compose.yml
services:
  kiosk:
    command: --virtual-keyboard --window-mode http://portainer:9000

TorizonCore with Evaluation Containers

The TorizonCore with Evaluation Containers image comes with the Kiosk container, since we run the Portainer container manager on top of it. You can read or edit the file on the board on /var/sota/storage/docker-compose/docker-compose.yml for quick evaluation. To make persistent changes or deploy your own docker-compose.yml, we recommend using the TorizonCore Builder Tool.

Examples

In the article Using Multiple Containers with TorizonCore, we use the Kiosk container to display Grafana on a local UI. It allows us to explain, with a practical example, how to use multiple containers on Torizon.

Remote Connection via VNC/RDP


  • Remote access via VNC

    Remote access via VNC

As the image above illustrates, you can remote access the Weston container via VNC or RDP, please refer to the Remote Access the TorizonCore GUI Using VNC or RDP to learn more.

Torizon 4.0.0

Introduction

Container that can be used to run a browser in kiosk-mode, allowing implementation of web-based UIs.

This container should be used together with the torizon/arm32v7-debian-weston:buster container to provide a kiosk-mode user interface with a browser that opens an URL passed as a parameter, does not show error messages/popups and does not allow the user to navigate to different websites.

Current implementation is based on chromium (using ozone/wayland rendering backend).

This article complies to the Typographic Conventions for Torizon Documentation.

Usage

You should start the wayland server container first (torizon/arm32v7-debian-weston:buster) and the container providing the local UI, if required. When you start the kiosk container you need to provide access to the /tmp folder (used for wayland and X11 sockets), /dev/dri (for buffer sharing/hardware acceleration) and provide the URL you want to open as command line parameter.

# docker run -d --rm -v /tmp:/tmp -v /dev/dri:/dev/dri -v /var/run/dbus:/var/run/dbus \
              --device-cgroup-rule='c 226:* rmw' --shm-size="256m"
              --security-opt="seccomp=unconfined" \
              torizon/arm32v7-debian-kiosk-mode-browser https://www.toradex.com

Replace arm32v7 with arm64v8 for the 64-bit variant.

For the X11 build we have to provide shared memory access from the host system:

# docker run -d --ipc=host --rm -v /tmp:/tmp -v /dev/dri:/dev/dri -v /var/run/dbus:/var/run/dbus \
              --device-cgroup-rule='c 226:* rmw' --shm-size="256m"
              --security-opt="seccomp=unconfined" \
              torizon/arm32v7-debian-kiosk-mode-browser https://www.toradex.com

Optional command line flags

It's possible to start chromium in less-secure ways (secure from the point of view of user being able to run other graphical apps etc.) using command line switches.

  • --window-mode : runs the browser inside a maximized window without navigation bar
  • --browser-mode : runs the browser in a standard window with navigation bars and all user menus enabled

Docker Compose

Docker compose can be used to start multiple containers at the same time, providing shared data volumes, mount points, resource usage limitations etc. If you want to use the kiosk-mode-browser container in this way it's a good idea to make it dependent from the Wayland compositor container and the container providing the data that should be displayed by the UI.

You can find example Docker compose files in our sample repository: https://github.com/toradex/torizon-samples/tree/master/debian-container/demonstration