vnc3d/xpra – vis
wiki:vnc3d/xpra

Xpra - X Persistent Remote Applications


Xpra (X Persistent Remote Applications)

... is a remote display solution for forwarding applications and desktop screens.
Applications forwarded by Xpra appear on the local desktop as normal windows (seamless mode),
rather than being all "trapped in a box together" (full desktop mode) like with VNC.
Xpra uses a custom protocol that is self-tuning and relatively latency-insensitive, and thus is usable also over worse links.
Xpra allows disconnection and reconnection without disrupting the forwarded application.

Xpra is an open-source software for multiple platforms (Linux, Windows, MaxOS, etc.).

Preparation

Download & Installation Xpra-client (>= 0.14.x, we recomment >=1.0.1)


Authentication

Xpra must communicate with JURECA via Secure Shell (SSH) and JURECA requires authentication to be password-less using SSH key-pair.
Please test your system before you proceed.

Execute the command with your JURECA-userid on your local workstation.
It must return the word 'success' for a successful SSH connection to JURECAVIS.

Linux/MacOSX:
ssh <YOUR-USERID>@jurecavis.fz-juelich.de echo "success"

Windows/Putty:
"C:\Program Files (x86)\PuTTY\plink.exe" -ssh <YOUR-USERID>@jurecavis.fz-juelich.de echo "success"
Ensure you have loaded your key in PuTTY´s SSH key agent called Pagent before!


Quick Howto (Linux/MacOSX only)

Start JURECA application directly from your workstation:

client> xpra start ssh:<USERID>@<LOGINNODE> --start-child=<JURECA_APP> --min-quality=90
  • password-less authentication using SSH must be ensured
  • set minimum quality to level 90 (unset:0, lowest:1, highest:100)


General approach using Xpra requires three steps.

  1. Start application in Xpra-server on a JURECA login node.
  2. Connect with Xpra-client from workstation to Xpra-server
  3. Check if Xpra-server stopped on the JURECA login node.

1. Start application in Xpra-server

Login to any JURECA login node and start application with Xpra-server

  • simple X11 application
    jureca> xpra start --start-child=xterm --min-quality=90
    
  • OpenGL application
    jurecavis> xpra start --start-child="glxgears" --min-quality=90
    
    • using VirtualGL for hardware accelerated server-sider rendering on the GPU if available
    • vglrun is automatically put in front of the command, if vglrun exists on the node
    • currently only on JURECAVIS login nodes (jurecavis01.fz-juelich.de or jurecavis02.fz-juelich.de)

Take a note of the <DISPLAYID> and the <LOGFILE> Xpra returns:

> Actual display used: :<DISPLAYID>
> Actual log file name is now: <LOGFILE>

2. Connect with Xpra-client from workstation to Xpra-server

Start the Xpra-client on the workstation to connect to the Xpra-server on JURECA.

  • Connect using Xpra command line (primarily with Linux or MacOSX)
    client> xpra attach ssh:<USERID>@<LOGINNODE>:<DISPLAYID>
    
  • Connect using Xpra GUI (primarily with Windows)
    client> xpra_launcher
    

Mode = SSH
<USERID>@jurecavis01.fz-juelich.de:22:<DISPLAYID>

3. Check if Xpra-server stopped

The Xpra-server shuts down automatically, when the application is closed.
Check if that is the case and stop it manually if required.

jureca> xpra list
jureca> xpra stop :<DISPLAYID>

Attention:
If you stop the Xpra-client without closing your application, your application keeps on running!
This can use cpu and memory resources others might need.

Real-case scenarios with Xpra

ParaView with full serverside rendering support using VirtualGL

client> xpra start ssh:<USERID>@jurecavis01.fz-juelich.de --start-child=xterm --min-quality=90
xterm> module --force purge
xterm> module load Stages/Devel
xterm> module load GCC/5.4.0
xterm> module load ParaStationMPI
xterm> module load ParaView
xterm> paraview

Atom
If you want to avoid to manually switch to another stage or load extra modules, you can follow this example.
Thanks goes to Johannes Hörmann.

A suitable xpra wrapper script can do the extra work before you program starts:

#!/bin/bash -x

module --force purge
module load Stages/2018a GCCcore/.5.5.0 Xpra/1.0.11-Python-2.7.14
module load Atom/1.25.0

exec $@
  • Add the executable bit (chmod +x xpra_wrapper)
  • Add the line exec-wrapper = /absolute/path/to/xpra_wrapper to ~/.xpra/xpra.conf
    • if you have used xpra before, this file should already exist

Now you can bring up a remote Atom with this single command

client> xpra start ssh:<USERID>@jurecavis01.fz-juelich.de --start-child="atom -w" --min-quality=90 --dpi=96

In order not to detach Atom from the calling process it needs to be started with -w option -- otherwise the xpra_wrapper would return immediately after initiating Atom and the xpra server shuts down.

More on Xpra

Full documentation of Xpra command: http://xpra.org/manual.html
Configuration Options: https://xpra.org/trac/wiki/Configuration

Usefull examples:

Background Information

Authentication:

Xpra must communicate with JURECA via Secure Shell (SSH).
It is mandatory that JURECA trusts Xpra and is 100% sure
that the incoming connection is by a certain user and no none else.

Hence, each new SSH connections starts with an authentification procedure.
SSH supports different authentification methods, but not all are available on any site.
Xpra must be used with the most secure Public-Key Authentification (PKA) to connect to JURECA.

PKA is based on a SSH key-pair with a private key and a public key.
The private key never leaves the local machine and the public key must be installed on the remote machine.
Anyone who knows the private key can now connect to the remote machine.

Xpra Wrapper

On JURECA Xpra is started through a wrapper script, which loads the Xpra module before calling Xpra:

module use /usr/local/software/jureca/OtherStages
module load Stages/Devel
module load GCCcore/.5.4.0
module load Xpra

any feedback welcomed - h.zilken@…, j.goebbert@…

Last modified 15 months ago Last modified on 09/11/18 10:42:42

Attachments (2)

Download all attachments as: .zip