I’ve recently moved house, sharing with $partner and her Mum while we save for a house. Whilst this is a good thing, I haven’t really sorted out internet access to my computer - so everything has been moving at a snail’s pace.
One of the worst things is trying to use my IMAP email on 3G. Being slow isn’t so much of a problem, but the latency of 3G kills it. I was contemplating getting a laptop from work, and was discussing this with a good friend - who made a joke about moving my desktop to the cloud… so I did.
I’ve been looking for a solution that lets you run applications remotely with native windowing - similar to VMWare Unity, but remotely. The X display protocol does this for you, but you’d have to launch applications each time you start up a new session - you can’t detach your windows from work and reattach them in the same state at home.
Having such lacklustre internet where I’m staying gave me the final nudge to give it a go. I signed up for a local VMWare vCloud provider and spun up a new server to give it a whirl.
First off, I’m quite happy with vCloud - it’s a great platform for managing compute applications and for the most part, pretty easy to set up. Not cheap though, a regular VPS product from the same provider would have been a cheaper option, but I’m a snob and don’t like Virtuozzo VPS products.
After getting an Ubuntu LTS box up and running and on the internet, I pulled down and installed nomachine. Nomachine is essentially poor man’s Citrix, and lets you run remote X11 or Windows desktop sessions remotely, with some awesome caching.
Using nomachine to get a full Gnome desktop session was easy enough, but it’s still not quite there. However, by editing the connection you can specify to run a single application modeless:
Which will do what you want successfully - you can launch applications like Thunderbird and Pidgin from your gnome-terminal instance and they will all present as modeless windows on your local machine.
But all the fun and games ends when that parent terminal process ends - meaning you have to tear down and restart all the processes every time you log in - no switching to the laptop and continuing a chat session whilst watching TV - which makes me sad, especially if I get one of those sexy Android tablets…
So what’s the solution? Well, fortunately it’s a solved problem.. kind of. There’s a project called xpra, which acts as a detachable man-in-the-middle X-server to host your applications.
Installing this gives you a quick path to success, set up a shell script:
#!/bin/bash
DISP=":1337"
xpra start $DISP --start-child=gnome-terminal
echo "Waiting for start/upgrade of xpra..."
sleep 5
xpra attach $DISP
echo "Exiting..."
sleep 5
Then modify the NX client to set the following startup command:
gnome-terminal -e "/path/to/startup.sh"
Firing up a session, your gnome-terminal process will either spawn or reattach to an xpra session running gnome-terminal. You can then spawn application processes under that process which will persist between nx (nomachine) sessions. Detaching is as straightforward as CTRL+C on the root gnome-terminal running your startup script (“xpra attach” runs blocking in the foreground until you kill it, when it will detach and hand the xpra session back to the daemon).
Prognosis?
Fun, interesting - but ultimately negative. A few points:
- Application Bugs - There are a few applications that cause the xpra/nx combination to bomb out, most notably the PDF Preview application
- System Tray - Applications such as Pidgin don’t have a tray to dock through when running via xpra (though works fine natively through nx), so if you close the Buddy List you will lose your pidgin session
- It’s slow - Despite all the wonderful caching, theres a perceptable lag working remotely and it gets in the way of productivity.
- xpra bugs - I’ve had a few applications dissapear from the xpra sessions altogether, running in the background but refusing to focus in my NX session, defeating the purpose of long-running applications.
So in the end, I think I will be packing this experiment in. More and more I’m convinced there’s a greater need for client/server built applications such as Quassel - where you can attach/reattach your application with the application server transparently whilst handling UI on the client side.
I wonder if there’s room for any application frameworks to help handle this…. Maybe there’s a project somewhere - but in the meantime I think it’s time to bite the bullet and sort out cabling to my PC at home.
Update: Moments after posting this blog entry, my nomachine session has decided to drop all my applications and kill itself - just another sign that it’s not ready for primetime…. sigh.