bestmazzo / kiosk-demo-electron

Electron App running in multi-screen Kiosk mode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kiosk-demo-electron

Build status Build Status

This Electron App demonstrates multi-screen Kiosk mode experience by creating an MSI package which executes PowerShell scripts. Scripts toggle Windows 10 Shell Launcher as well as set the kiosk user to AutoLogon. Creating an MSI makes sure we can distribute our app to multiple kiosks via MDM e.g Microsoft Intune.

The project is described in-depth in this blog post

Create Installer

Windows

npm run dist will build everything and create the MSI in dist folder.

Linux

Use npm run dist:wine. Script assumes that Wine and dotnet40 (using winetricks) are installed and properly configured. If the full path of any of your electron-packager output files is longer than 128 chars, you'll run into error LGHT0103 : The system cannot find the file. Note: Light.exe has a known issue with MSI validation on Wine so it had to be turned off with -sval flag.

Docker

npm run dist:docker will spin up an instance of this image, execute the above wine script and then copy artifacts back to host's dist folder. Script assumes that Docker daemon is running on host.

Configure

Kiosk parameters are passed to the installer like this:

KioskDemoElectron.msi KIOSK_USERNAME=<kiosk user> KIOSK_PASSWORD=<kiosk password>

All params have a default value as can be seen in product.wxs.

How it works

  • First we package the app using electron-packager
  • Then we harvest binaries produced by electron-packager using WiX's Heat tool.
  • We also copy our PowerShell script into the root of electron-packager output. We could let the harvester take care of PowerShell files as well, but we wanted to explicitly specify them in product.wxs with Custom Actions.
  • Output of harvest tool is heat.wxs which contains a Fragment with list of files. We take that as well as product.wxs and pass it to the Candle tool. Candle is responsible for preprocessing .wxs files and generates compiled .wixobj files.
  • Finally we use the Light tool to generate MSI from .wixobj.
  • PowerShell Scripts are executed from WiX Custom Actions.

Why WiX instead of electron-winstaller (Squirrel.Windows)?

In our case, WiX provides lot of flexibility in terms of configuring the installer;

  • Passing params to the setup
  • Executing elevated PowerShell during install/uninstall events
  • Modifying config files based on setup params

Troubleshoot

MSI logging can be enabled by executing the installer like this:

msiexec /i "setup.msi" /l*v "msi.log" PARAM=VALUE

PowerShell log will be written in C:\Windows\SysWOW64\powershell.log.

Telemetry

The solution uses Application Insights to collect basic telemetry data from the app. To enable it, please create an environment variable named APPINSIGHTS_INSTRUMENTATIONKEY and set it to the Instrumentation Key obtained from Azure portal.

About

Electron App running in multi-screen Kiosk mode

License:MIT License


Languages

Language:PowerShell 44.5%Language:JavaScript 35.6%Language:HTML 18.4%Language:Dockerfile 1.0%Language:CSS 0.6%