Remote control via web browser using xpra

From Bisq Wiki
Jump to navigation Jump to search

This guide will have you follow the steps needed to run Bisq on a headless server (could even be a VPS), running Linux (preferably Debian or one of its derivatives), and accessing it using a web browser as if you were in front of the application itself (tested with Firefox, should work with any other major alternative).

Requirements

As a rule of thumb, at least 1GB of free RAM is needed, as are 2GB of disk space, on an amd64 architecture (no Raspberry Pi will work, nor old 32bit CPUs, while your average 64bit desktop CPU will run just fine).

Installing xpra

As customary, update your system:

sudo apt update
sudo apt dist-upgrade

For good measure, add xpra repository

sudo nano /etc/apt/sources.list

Add the following to bottom of file and then save with Ctrl-X followed by Y

deb https://xpra.org/ bullseye main # edit "bullseye" with your version if needed

Add xpra GPG key

wget -q https://xpra.org/gpg.asc -O- | sudo apt-key add -

Refresh repositories

sudo apt update

and install

sudo apt install xpra

Verify

xpra --version

Installing Bisq from source

We are going to run Bisq on a headless system (no desktop environment) so installing the deb file will most likely not work. Since we are nerds and like to do things the hard way, we will get the source from github, and build the application ourselves.

Create Bisq user

If you deem it functional, add a user specifically for Bisq

sudo adduser --gecos "" --disabled-password bisq

Install git and Java

We will need the git package to clone Bisq repository, and Java so that Bisq will run

sudo apt install default-jre default-jdk git

Prepare paths for Bisq

Move in a folder where you want the bisq application folder to reside, we will use the bisq user as per the example above, and the custom myapps subfolder of your home (you can place it direcly in home, or wherever you please where the running user has r/w access)

sudo su - bisq
mkdir -p myapps
cd myapps

Install Bisq

Clone the latest version repository and compile the source:

git clone --branch release/v1.9.10 https://github.com/bisq-network/bisq # change 1.9.10 with current latest version
cd bisq
./gradlew build

Use Bisq remotely

Now the fun begins, as you can run bisq through xpra:

xpra start :100 --bind-tcp=0.0.0.0:9876 --html=on --start=/home/bisq/myapps/bisq/bisq-desktop

Then, from the browser on your local machine, go to remoteserverip:9876

It will load into a GUI, where you should see your Bisq app barely showing in the bottom right corner; if that happens, click on the "images/windows" icon in the top floating menu, you should see a list of Bisq windows; press the "maximize" icon to show the windows on your screen, and then act accordingly. The same menu action might be needed when popups are shown, as in order to interact with buttons in said popups you sometimes have to manually focus on the popup via the floating menu.

When you have to restart Bisq for any reason (for example to refresh tor files, to resync SPV or DAO state) you have to run, on the remote machine:

xpra stop :100 # to stop the running xpra instance
xpra stop :100 # once more, to REALLY stop the running xpra instance (sometimes it won't work with just one call, especially when restarting Bisq)
xpra start :100 --bind-tcp=0.0.0.0:9876 --html=on --start=/home/bisq/myapps/bisq/bisq-desktop # to restart Bisq through xpra

This command will make you wait 20s as a timeout to fully close any existing xpra sessions, after which the application will be launched. You should make the above lines into an executable script, so you can just launch that and have it (re)start Bisq:

cd /home/bisq
nano bisqxpra
# add the above lines in the file and then save with Ctrl-X and press Y
chmod +x bisqxpra
./bisqxpra #launch Bisq

Tips

When you want to restart Bisq, you could just execute the above script, but it would terminate Bisq in a potentially breaking way, so it's best to first log into the web interface, close Bisq using the window close button, and only then start the script.

Want to use a custom data folder, just like you maybe used a custom application folder? Add the relevant parameter to the Bisq command:

# make sure you leave the quotes in, to enclose the command to start as a single entity
xpra start :100 --bind-tcp=0.0.0.0:9876 --html=on --start="/home/bisq/myapps/bisq/bisq-desktop --appData=/home/bisq/myapps/bisq-data"

Want to add password authentication, so the Bisq instance isn't accessible to just anyone finding its port on the local network?

# replace password123 with your password, no need for advanced security as anyone able to access your remote server to see this, will have also access to Bisq anyway
xpra start :100 --bind-tcp=0.0.0.0:9876,auth=password:value=password123 --html=on --start="/home/bisq/myapps/bisq/bisq-desktop --appData=/home/bisq/myapps/bisq-data"