0

Recently, on holiday, I had WiFi, time to spare in the sun, a Nexus 7 tablet, and wanted to try to prototype something. I wondered just how much lightweight development work could be done on a Nexus 7 android device. Clearly, none of is this is, or claims to be an ideal development platform but I thought why not give it a try for a prototype.

I had an interest in developing a small Python Flask app and a small Clojure app.

On the Android side, I began by looking for an out of the box solution. There are several platforms that allow you to develop in the browser and offer and editor and dev environments in one offering. I tried one called Code Anywhere, and even found that they had an android app. Once I had signed up for their free package to trial it, I could login and edit their sample app. Their sample app was a static HTML site and I had to login via a browser to delete this because the android app appeared to only let me delete individual files. They also appear to offer a development linux box upon which you can apparently run services, however this appeared unavailable from the android app and the browser offering did not wish to load the shell interface in mobile chrome. All in all, I got the impression that this app would be considerably more useful were I interested purely in knocking together some HTML and CSS.

CodeAnywhere

Searching the app store I also came across several applications that embed a compiler or interpreter in process on your android device and allow you to run REPL style snippets of code. I tried the Clojure REPL app and the python equivalent which appeared more functional called QPython. These apps are marvellous for testing a snippet of code or short method but quickly fall short for anything more.

Having concluded that this wasn’t going to help me too much, I then looked to assemble a DIY offering from a set of discrete tools. I decided to look for a local editor with SCP/SFTP capabilities so I could edit files locally and then run then on a remote machine. Looking through the Play store revealed the Quoda editor, which looked suitably clean and we’ll thought out. The Quoda editor offers SFTP connection options as well as adding keyboard extensions for symbols that are common to development languages. It has a fast switch selector for open files and offers features such as bracket highlighting and quote completion. The SFTP support also handled the spotty WiFi coverage gracefully.

Quoda editor

There were a couple of annoyances with the Quoda editor, for example there is no Tags file style symbol completion, which would have helped. Another thing that would have helped is an easier way to indent and an easier way to hide the keyboard so you can browse the code more easily. Quoda also appears to lose line breaks when doing a copy paste from the browser, which is an annoyance for when you are trying to paste example config files.

To actually run my code, I spun up a small t2.micro EC2 instance from Amazon EC2 on which to run my code. I downloaded the official Amazon AWS app, which offers a smooth interface for browsing, but not for spinning up new resources. Luckily, the AWS web console works reasonably well on mobile chrome and a 7″ screen. The new micro instances offered more than enough for my meek requirements and I opted for an SSD backed EBS instance figuring that I would spend more than enough time waiting for network without layering any potential IO constraints in there for app compilation etc.

Had I created a snapshot of a configured node prior to my travel and been able to spin all of this up much more quickly, but as it was I created a new node, keypair and security group for my node on the go and chose the Amazon AMI because it is fairly lightweight but also offered the packages that I wanted.

For the purposes of interacting with the AWS node, JuiceSSH is a marvellous Android SSH client that does a pretty fine job. I merely added my new node’s IP and keypair and it provides a pretty decent client, with keyboard helpers for special keys. One thing I wished I had found earlier was the cdspell option for bash, which can be enabled with

shopt -s cdspell

This gives you automatic spelling correction for cd commands, which is useful on a touch keyboard and tiny screen.
The Amazon AMI came pre-installed with Python and the Java 7 JRE. This meant that I had to install:

Lein for Clojure dev

wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein

pip + virtualenv for my Flask app

sudo yum install python-pip
sudo pip install virtualenv

As well as nginx:

sudo yum install nginx

I also installed Postgresql (packages postgresql and postgresql-server) to act as a data store. Editing config files to setup a reverse proxy to serve up my app on port 8080 was a bit of a pain, but there was not a huge amount required.

Overall, and as expected, the experience was a pretty clunky and the 7″ screen was almost certainly not ergonomically suitable, but I was relatively happy with the results. A Bluetooth keyboard or lightweight laptop (such as a HP Chromebook) would add a bit more comfort and certainly having a preconfigured dev node would have helped with setup time. This could be kept as a snapshot on S3 relatively cheaply or as a puppet controlled set of manifests for ease of maintenance.

Tags: , ,

Leave a Comment