Installing as a Service

SKGM can be installed on Ubuntu 20.04 or 22.04 as a systemd service, rather than run manually. Once the prerequisites have been installed, the following systemd units can be created to install SKGM as a service.

Xvfb for Headless

As with the manual setup, SKGM needs a Xvfb display to run headless. Save the following script as /etc/systemd/system/gamemaker-fake-display.service

[Unit]
Description=GameMaker Fake Display
 
[Service]
Restart=on-failure
ExecStart=Xvfb :0 -screen 0 400x400x24
 
[Install]
WantedBy=default.target

Creating an Unpriviliged User

It is desirable to run SKGM as an unpriviliged user. One can be created using the following commands

adduser --disabled-password --gecos "" skgm
usermod -L skgm

SKGM Service

The following systemd unit launches SKGM as a service, and provides some automatic restart support. Save the following script as /etc/systemd/system/skgm.servic. Any additional environmental variables can be added here to further customize SKGM before launching it.

[Unit]
Description=SeverKit GameMaker
Requires=gamemaker-fake-display
StartLimitBurst=5
StartLimitIntervalSec=30

[Service]
Restart=on-failure
Environment="DISPLAY=:0"
ExecStart=/usr/local/bin/skgm.AppImage --appimage-extract-and-run
User=skgm
Group=skgm
 
[Install]
WantedBy=default.target

Enable and Start Services

Once the files and users have been create, the files need to be given the correct permissions, and enabled as services.

chmod 664 /etc/systemd/system/gamemaker-fake-display.service
chmod 664 /etc/systemd/system/skgm.service

systemctl daemon-reload
systemctl enable gamemaker-fake-display
systemctl enable skgm
systemctl start gamemaker-fake-display
systemctl start skgm

Once SKGM is running, you can open up the control panel, using port 5000 (the default port). e.g. http://:5000