Repository navigation
Setting Up the Kiosk From Scratch
I’m going to assume you have a Windows 11 device, with two accounts: Admin and Demo. Admin has administrator access and is password protected. Demo must be non-Admin and have no password.
You are going to do most of the setup on Admin, but the kiosk will be running on Demo. This will set the demo account to Windows 11, which will lock down a lot of things.
- Note: even though you’re installing on Admin and running on Demo, all the automated stuff will be running on a separate, hidden account called SYSTEM.
- PowerShell
- Launch it with Administrator privileges on the Admin account.
- You may need to run
Set-ExecutionPolicy RemoteSignedto allow you to run scripts.
Install these as Admin for all users so that the Demo account can access them. They should be visible on the PATH for all users.
- Node.js
- To run the Kiosk application.
- Try to use the version our Kiosk is pinned to (find it in
.node-version).
-
Servy
- Runs the Kiosk application as a service and monitors its health.
- It can automatically restart the Kiosk’s proxy server in case it crashes or hangs, by having it check the server’s heartbeat.
You’ll want to change some settings on Windows before you run Kiosk mode.
The frontend is not responsive and was built for exactly 1080x1920. You'll need to ensure the scale and resolution match that. As Demo:
- Right-click the desktop.
- Select "Display Settings".
- Under "Scale & Layout" make sure the "Scale" is
100% - Make sure "Display Resolution" is
1080x1920.
You’ll want to disable sleep and the screensaver to ensure the Kiosk is always on. As Admin run the following commands in an admin-level Powershell:
# 1.Disable screensaver
powercfg /change monitor-timeout-ac 0
# 2.Disable standby
powercfg /change standby-timeout-ac 0This will disable the notifications that pop up at the bottom right of the screen. As Admin:
- Press
Windows + I - System > Notifications
- Full-screen apps might already block toast notifications, but you can modify them here.
This is so the device gets its updates, but not in the middle of the school day. As Admin:
- Settings > Windows Update > Advanced options > Active hours
- I suggest 8AM - 2AM for active hours.
Make sure you’ve downloaded all the software mentioned above (Node and Servy).
Do this on Admin.
- Download the latest working release of the Kiosk application on GitHub.
- Extract it into an easy to remember directory
-
C:\apps\csss-kiosk\should work - The root of this folder should look exactly like the root of the zip, don’t place anything in different directories.
-
- Lock down permissions on the Kiosk folder with this command:
-
icacls C:\apps /inheritance:r /grant:r "SYSTEM:(OI)(CI)F" "Administrators:(OI)(CI)F"- This will make the Kiosk application files not be accessible by Demo.
-
- The Kiosk application should be able to be launched now, but not readable by the Demo account. You can test this by trying to run the server file. It should fail to start, but it will attempt to.
node C:\apps\csss-kiosk\server\server.js- You should also make the directories
C:\apps\logs\csss-kiosk\andC:\apps\scripts\csss-kiosk.
- Note: If you accidentally locked down permissions before you extracted the application use:
Expand-Archive -Path "C:\path\to\csss-kiosk\archive" -DestinationPath "C:\apps\csss-kiosk"Kiosk mode automatically restarts the browser to our web application, but Servy handles our server which handles communication with our web server and serves our static pages.
- Set up the environment variables
- The frontend shouldn’t need any setup since it’s built with production variables.
- You’ll need to set the variables below up using Servy’s recommended way:
NODE_ENV=production-
KIOSK_API_SECRET=<...>: This should be the web server’sKIOSK_SECRETenvironment variable. PROXY_TARGET=https://sfucsss.org-
SERVER_PORT=<...>: this can be whatever, but make sure it matches the URL the one Kiosk mode uses. At the time of writing it’s 8080. KIOSK_UPDATE_LOG_PATH=C:\apps\logs\csss-kiosk\csss-kiosk-update-log.txtKIOSK_STDERR_LOG_PATH=C:\apps\logs\csss-kiosk\stderr.log- TL;DR: set the environment variables:
$env:SERVY_ENVIRONMENT_VARIABLES = “NODE_ENV=production; KIOSK_API_SECRET=<...>; PROXY_TARGET=https://sfucsss.org; SERVER_PORT=<...>; KIOSK_UPDATE_LOG_PATH=C:\apps\logs\csss-kiosk\csss-kiosk-update-log.txt; KIOSK_STDERR_LOG_PATH=C:\apps\logs\csss-kiosk\stderr.log”
- Install the Kiosk server as a service:
servy-cli install `
--name="CSSS-Kiosk-Server" `
--description="CSSS Kiosk Proxy Server" `
--path="C:\path\to\node.exe" `
--startupDir="C:\apps\csss-kiosk\server" `
--params="C:\apps\csss-kiosk\server\server.js" `
--startupType="Automatic" `
--enableSizeRotation `
--rotationSize=5 `
--maxRotations=1 `
--stdout="C:\apps\logs\csss-kiosk\stdout.log" `
--stderr="C:\apps\logs\csss-kiosk\stderr.log" `
--enableHealth `
--heartbeatInterval=30 `
--maxFailedChecks=3 `
--recoveryAction="RestartService" `
--maxRestartAttempts=5- Don’t put any non-application files into
C:\app\csss-kiosk, or else the auto-updater will delete them. - Logs will be rotated out when they reach 5MB (
rotationSize=5) and only 1 old file will be kept (--maxRotations=1)
- DELETE THE ENVIRONMENT VARIABLES. THIS IS VERY IMPORTANT SO PEOPLE CAN’T GET THE
KIOSK_API_SECRET. Remove-Item Env:SERVY_ENVIRONMENT_VARIABLESClear-History- You probably also want to exit out of this terminal and open a new one so people can’t scroll back and see what was typed.
- Start the service:
servy-cli start --name="CSSS-Kiosk-Server".- Verify it's running with
Get-Service -Name "CSSS-Kiosk-Server"
- Verify it's running with
- Servy now runs the Proxy server before anyone even logs in. It will also attempt to restart the server if it goes down, with 5 max restart attempts before it gives up. You can test this by going to http://localhost:SERVER\_PORT on the Kiosk; the web app should show up.
- Servy also has a GUI which you can use to manage this.
At this point the Kiosk application’s server should be running in the background. You can now set up the auto-update script. Run this on Admin:
- Copy the script onto the device that Demo shouldn’t be able to modify, most likely to
C:\apps\scripts\csss-kiosk\csss-kiosk-autoupdater.ps1 - Fill out the
CONFIGsection i.e. the lines between the hyphens.-
$RepoOwner: “CSSS” -
$RepoName: “csss-site-kiosk” -
$ServiceName: “CSSS-Kiosk-Server” (or whatever you named it in Servy) -
$AppRoot: “C:\apps\csss-kiosk” (or whatever you named it) -
$BackupRoot: “C:\apps\csss-kiosk_backup” (just make sure it doesn’t share the name of something else in C:\apps) -
$TempDir: “C:\apps\csss-kiosk_temp” -
$VersionFile: Join-Path $AppRoot “VERSION” (i.e.C:\apps\csss-kiosk\VERSION) -
$HealthCheckURL: “http://localhost:SERVER\_PORT/health” -
$LogFile: “C:\apps\logs\csss-kiosk\csss-kiosk-update-log.txt” (make sure this isn’t inside C:\apps\csss-kiosk)
-
- Run this script manually to ensure it works. You’ll want to test:
- Updates with no new version.
- Updates with a new version. You can edit the
VERSIONfile to be different from the latest release. - Test a broken release and ensure the rollback feature works.
- Use
powershell -ExecutionPolicy Bypass -File C:\apps\scripts\csss-kiosk\csss-kiosk-updater.ps1
- Once you’ve verified it works, you’ll register this to run every on an interval.
- Move
csss-kiosk-scheduled-task.ps1intoC:\app\scripts\csss-kiosk\ - Run
- Move
powershell -NoProfile -ExecutionPolicy Bypass -File C:\apps\scripts\csss-kiosk\csss-kiosk-scheduled-task.ps1- Confirm it’s running:
Get-ScheduledTask -TaskName "CSSS-Kiosk-Updater"Get-ScheduledTaskInfo -TaskName "CSSS-Kiosk-Updater"- You should see it will run in the next minute, then at a set interval after that.
- You can also check the logs, where you specified
$LogFile.
This will cause the Demo account to automatically be signed into on reboot AND launch the browser to the Kiosk application. The application will run in full-screen and it will block access to the desktop, taskbar, and system settings.
Kiosk mode keeps failing
The Windows service that manages this, AssignedAccessManagerService, may not be enabled. To enable it:
- Hit
Windows + R, type inservices.mscand pressEnteror clickOK. - Find AssignedAccessManager Service in the list and double-click it.
- Change "Startup type" to "Automatic".
- Hit "Start".
- Click "OK".
- Before you do this make sure you log into Demo at least once. Log back in to Admin afterwards and follow these steps.
- Settings > Accounts > Other Users > Set up a kiosk
- Choose the Demo account, pick Microsoft Edge.
- Use "As a digital sign or interactive display".
- For the website URL use
http://localhost:<SERVER_PORT>. - Idle/session timeout indicates how long it will take for the app to go back home when there is no interaction. Set this to something like 5 minutes.
- Now whenever you’re not logged in, Demo will attempt to log in and even after reboots.
- This will configure auto sign-in for that account on boot and locks the session to a full-screen browser.
- See FAQ’s “How do I get out of Kiosk mode?” to service the device.