== Xpra - X Persistent Remote Applications [[PageOutline]] {{{#!table style="border:none; text-align:left; margin:0px" {{{#!th align=left,style="border: none" [[Image(xpra-logo.png,100px, align=left, margin=0, link:vnc3d/xpra)]]\\ }}} {{{#!th align=left,style="border: none" '''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.). \\ * Homepage: http://www.xpra.org * Wiki: https://www.xpra.org/trac/ }}} {{{#!th align=left,style="border: none" [[Image(Xpra_GUI.png, 200px)]] }}} }}} === Preparation '''Download & Installation Xpra-client''' Xpra can be downloaded for Windows, Linux and Mac from the official Xpra site:\\ http://www.xpra.org/trac/wiki/Download '''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 @juwelsvis.fz-juelich.de echo "success"''' !Windows/Putty: \\'''"C:\Program Files (x86)\PuTTY\plink.exe" -ssh @juwelsvis.fz-juelich.de echo "success"'''\\Ensure you have loaded your key in PuTTY´s SSH key agent called Pagent before! \\ === General approach using Xpra requires three steps. 1. '''Start application in Xpra-server''' on a JUWELS login node. 2. '''Connect with Xpra-client from workstation to Xpra-server''' 3. '''Check if Xpra-server stopped''' on the JUWELS login node. ==== 1. Start application in Xpra-server Login to any JUWELS login node and start application with Xpra-server. If you want hardware accelerated rendering, you need to login to a vis-login node. In the following example we use juwelsvis02.fz-juelich.de: Before you can use Xpra, you must load the needed modules, which are, as of November 2020: {{{ #!sh module --force purge module use otherstages ml Stages/Devel-2020 GCCcore/.9.3.0 xpra/4.0.4-Python-3.8.5 }}} The you can a application via the "xpra" command: * '''simple X11''' application {{{ #!sh jwvis02> xpra start --start-child=xterm --min-quality=90 }}} * '''OpenGL''' application {{{ #!sh jwvis02> xpra start --start-child="vglrun glxgears" --min-quality=90 }}} * using VirtualGL for hardware accelerated server-side rendering only works, if a GPU with a running X-server is available * currently only on JUWELSVIS login nodes (juwelsvis00.fz-juelich.de to juwelsvis03.fz-juelich.de) Take a note of the and the Xpra returns: {{{ #!sh > Actual display used: : > Actual log file name is now: }}} ==== 2. Connect with Xpra-client from workstation to Xpra-server Start the Xpra-client on the workstation to connect to the Xpra-server on JUWELS.\\ * '''Connect using Xpra command line (primarily with Linux or MacOSX)''' {{{ #!sh client> xpra attach ssh:@: }}} * '''Connect using Xpra GUI (primarily with Windows)''' {{{ #!sh client> xpra_launcher }}} [[Image(Xpra_GUI.png, 200px)]] Mode = SSH\\ @juwelsvis02.fz-juelich.de:22: ==== 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. {{{ #!sh jwvis02> xpra list jwvis02> xpra stop : }}} 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 {{{ #!sh client> xpra start ssh:@juwelsvis02.fz-juelich.de --start-child=xterm --min-quality=90 }}} Now start load the necessary modules and start !ParaView in the xterm: {{{ #!sh xterm> module --force purge xterm> ml Stages/2020 GCC/9.3.0 ParaStationMPI/5.4.7-1 xterm> ml ParaView/5.8.1-Python-3.8.5 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: {{{ #!sh #!/bin/bash -x module --force purge module load Stages/Devel-2020 GCCcore/.9.3.0 module load xpra/4.0.4-Python-3.8.5 module load Atom/1.52.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 {{{ #!sh client> xpra start ssh:@juwelsvis02.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: * List all running Xpra-server: {{{ #!sh xpra list }}} * Get all infos of a running Xpra-server: {{{ #!sh xpra info : }}} * Start Xpra-server with larger/smaller fonts {{{ #!sh xpra start --start-child="xterm" --dpi=96 --min-quality=90 }}} ---- any feedback welcomed - [mailto:h.zilken@fz.juelich.de], [mailto:j.goebbert@fz-juelich.de]