Running MapTool Headless - RPTools/maptool GitHub Wiki

How to get Maptool working "Headless", a Guide by Akaiku

Prereq: Having an AWS instance up and reachable using Ubuntu linux and also have opened the ports needed for this.

This guide references MT 1.5.13. Using it with later versions will require adjusting paths/filenames to match the version you are using.

install xpra

# add GPG key
wget -q https://xpra.org/gpg.asc -O- | sudo apt-key add -
# add XPRA repository
sudo add-apt-repository "deb https://xpra.org/ <distro> main"
#example sudo add-apt-repository "deb https://xpra.org/ eoan main"
# install XPRA package
sudo apt-get install xpra

install maptool

wget https://github.com/RPTools/maptool/releases/download/1.5.13/maptool-1.5.13.deb
sudo apt install /home/<username>/maptool-1.5.13.deb
# alternatively if apt fails to install this way
sudo dpkg -i install maptool-1.5.13.deb

if it complains about missing xdg-desktop-menu: sudo nano /usr/bin/xdg-desktop-menu paste this code in:

#!/bin/bash
echo "$@"

then sudo chmod +x /usr/bin/xdg-desktop-menu

make maptool user so not exceptionally insecure:

sudo useradd maptool
sudo passwd maptool

use whatever password, but pick a different one from your xpra password. It is unlikely to be used after the initial setup.

now, make sure the /home/maptool directory exists, if not, make it.

sudo mkdir /home/maptool
sudo chown maptool:maptool /home/maptool
sudo chmod 777 /home/maptool

That makes it all reachable by the account you are logged in as well.

More hardening time!

sudo mkdir /home/maptool/.ssh
sudo chmod 700 /home/maptool/.ssh

Nobody can log directly into that user via aws now.

Make a script to launch xpra with the correct settings, as they looove messing with default cfg files so..

nano /home/maptool/xpra.sh paste this in

#!/bin/bash
xpra start  --bind-tcp=0.0.0.0:14600 --tcp-auth=password:value=xxxx --start-new-commands=yes  --start=/opt/MapTool/MapTool

The bind-tcp command, you change the number after the : to some random, not-used socket number. Change the value after password to whatever secret password you wanna log into xpra with.

Lets assume your user is also missing a log folder!

First off!

cat /etc/passwd | grep maptool

gives you something like: maptool:x:1003:1003::/home/maptool:/bin/bash

Note the user number (1003 in this example). You'll need to use it in the steps below.

Now, do these:

sudo mkdir /run/user/1003/xpra/
sudo chown maptool:maptool /run/user/1003/xpra/

Using whatever user number your install gave the maptool user. In this example the user number is 1003.

Now to test!

su maptool
<enter passsword>
~/xpra.sh

it should spit out this:

Entering daemon mode; any further errors will be reported to:
  /run/user/1003/xpra/S3404.log
Actual display used: :0
Actual log file name is now: /run/user/1003/xpra/:0.log

The first line comes up immediately, the second after a slight delay.

You should check the s3404.log file, and if you read something like this: 0.0.0.0:14500 address already in user/1003/xpra/S3404 That means you need to change the port number used above.

Now to actually connect to it!

https://www.xpra.org/trac/wiki/Download

Pick your client, install. Run. Hit the big connect button.

Remove the username before the @, put your ip address for the server in the server, put the port you picked in the port, then use the password you picked in password.

It should show up a nice pretty already opened maptool screen.

Lets get xpra working on startup. sudo crontab -u maptool -e add this to the end of the crontab @reboot /home/maptool/xpra.sh

It will now load on startup.

To upload your campaign file, just use some client like mobaxterm to ssh as your non-maptool user and drag drop to the /home/maptool/ folder.

Important caveat about remote GMing, images that are not currently displayed don't get saved as a remote gm, so always hop into xpra to save the file directly, then copy it off of the server via mobaxterm again.

If you ever close the maptool instance, you can right click the little tray icon xpra has, go to server, then run command. type in exactly /opt/MapTool/MapTool and wait, should re-open.

Updates to the server can be done by just wgeting the deb and apt installing it again.

Other things to note!

Menus that go off the local screen (the not aws one) will often not pop up or work. If it acts odd, just resize/move the window till the menu would fit.

After you have the server started, you can disconnect from xpra via right clicking the context menu on your desktop and going to disconnect: it won't close the server.

Starting the server, it's best to start it as a player instead of a gm, so the server client has to pay attention to the absolute least info. Also good to leave it on a blank tiny map if it's acting slow. Adjust for how often you yank all the players to a specific map.

⚠️ **GitHub.com Fallback** ⚠️