Revisiting software development on Chromebooks - rapidly improving state of Chrome apps for developers
By: +David Herron; Date: 2015-11-12 01:25
I've written about this before, and have just gone another round of trying different options for software development work on my Chromebook.
UPDATE: In the comments below I received a pointer to excellent instructions for mounting SSHFS filesystems from the chronos shell. The performance is much better this way, and I'm incorporating some additional options below. I've also written my own guide on SSHFS file systems from Crouton
The result of all the stuff below is the ability to
- mount remote file systems that appear in ChromeOS file explorer windows with better performance than with the SSH file system
- multiple local and remote terminal sessions, using SSH keys to control access
- competent programmers editors to edit both local and remote files
Ubuntu desktop environment - chews up memory - Chromebooks are a bit memory-constrained
Originally my approach was to use Linux and start up a Linux/Ubuntu desktop to run Linux GUI apps to edit code, and command line tools to compile/run the code. And then for image editing or wordpressing I've installed tools like Inkscape or Gimp or LibreOffice.
This has been successful except for one thing: Memory. My Chromebook has 4 gigabytes of memory, which is quite a bit for a Chromebook, but I quickly run out because a) I keep lots of Chrome tabs open, b) the desktop Ubuntu environment uses up some memory.
Minimizing memory consumption on Chrome/ChromeOS
To minimize memory consumption I've installed a great Chrome extension: The Great Suspender. This extension does one thing extremely well -- any browser tab that I've not visited for an hour is "suspended," meaning that all resources to run the tab are killed off and replaced by a message saying the tab has been suspended. I can reinstate the tab at any time just by clicking on it. The effect is to eliminate a lot of memory use while letting me keep too many tabs open.
Which really means it's an enabler for my browser tab addiction. I admit that I'm addicted to having too many tabs open. Rather than cure the browser tab addiction, I'm using this bandaid and getting on with life.
What I've looked at today is an ability to edit code and run command line tools without having to launch a desktop Ubuntu environment. Another question I explored is what'd be required to edit stuff on a remote server, and run command line tools on the remote server, both via SSH sessions. I've found a few useful tools, but the state of the tools aren't quite what I'd hoped for.
Multiple local and remote command-line windows on ChromeOS
The first stop was to have multiple command-line shell windows for both the local Linux environment, and for remote servers.
For the local Linux environment, you must first put the Chromebook in developer mode, then install Crouton so you can install Ubuntu. There are many guides for this and it's quite cool to have Linux alongside ChromeOS.
On a developer mode Chromebook you type
CTRL-ALT-T to open a
crosh shell window, then at the
crosh prompt you type
shell, then at the command line prompt you type
sudo enter-chroot. Thus, you enter into the Linux environment. You can start as many crosh/Linux shell windows just by doing this multiple times.
For shell windows on remote systems, I tried a few SSH clients and settled on FireSSH. You can start multiple FireSSH instances. It easily uses SSH key's for password-less login. The terminal emulator is pretty fast. VI runs well on the terminal emulator. The only downside is that it uses the black background and bright green color theme remniscient of old-skool VT100's.
UPDATE: While poking around today I noticed the Chronos shell environment has a full complement of
ssh tools, including
ssh-keygen. That means you can create an SSH key from the Chronos shell, and use that shell to remote log into your desired hosts. It's not necessary to install other apps like FireSSH as I just recommended. /UPDATE
Chrome apps for code editing on the local filesystem
There are several code editors that run as Chrome apps. I've tried several, and have two to recommend.
The Keypress editor is a nice, fast, programmers text editor. To open a folder browser into a directory tree you select "Project / Add Folder To Project". From there you click on files in the file tree view, and can edit them in the editor area. It can open multiple files, with tabbed access to each one. There is good quality syntax highlighting.
Caret is another programmers text editor for which I can say almost exactly the same things as I just said for Keypress. A significant difference is that Caret projects can be saved to a file on disk, and then you can re-open the project at a later date. Caret is based on the Atom editor component, FWIW.
Let me mention a bonus third editor - Mado - a Markdown editor as a Chrome app. It uses a split view where you're editing Markdown in the left-hand pane, and have a Markdown previewer in the right-hand pane. I use this for editing Markdown content that is rendered into websites using AkashaCMS. It's fast, and it's a lot nicer to edit Markdown when you have a previewer giving you a near pseudo-WYSIWYG model.
With these code editors, you're editing local files using the Chrome app, then doing associated tasks at the command line using the "crosh" window technique I just described.
Chrome apps for code editing on remote filesystems
Now that ChromeOS has an ability to mount various network filesystems, you could edit remote files just by mounting the remote filesystem. The author of Caret suggests this while explaining why he won't add SFTP editing support to Caret. He notes that instead a ChromeOS user could utilize the SFTP Filesystem to mount the remote file tree in a ChromeOS finder window. And, yes, you can do that...but...
I tried that today, and accessing remote file trees was VERY SLOW. With both Keypress and Caret, editing files on a remote file tree means first adding the file tree to the current project. For both editors the editor then scans that whole tree to build the file browser widget. Over SFTP over the Internet this is extremely slow. It's also extremely slow using the SMB Filesystem extension to access file shares on the Drobo that's on my local network. It may be that the new filesystem support for ChromeOS hasn't yet been optimized, and is simply slow.
I don't have a good solution for editing remote code yet.
UPDATE: Thanks to the G+ post linked above, I now have an excellent recommendation.
What you do is install the Chromium Dev Tools following
the instructions on the Chromium website. The devtools are apparently meant for people developing Chromium, which is the base from which ChromeOS is developed. One of the many side effects of installing these tools is that
sshfs is installed and available at the Chronos shell. When I originally wrote this post I had to use
sshfs from inside the Crouton/Linux environment, but then it wasn't available for use in the ChromeOS file browser. But by mounting this way (
sshfs in the Chronos shell) the files are available in the ChromeOS file browser, and the performance is okay.
First - install the Chromium Dev Tools.
Second - use the ChromeOS file explorer to make a directory in your Downloads folder corresponding with the remote file system. Make as many of these directories as you need.
Third - in a Chronos shell you need to find the real directory corresponding to the Downloads folder. "cd" to
/home/chronos/u-########### -- this will be a long hex string.
Fourth - set up SSH keys for use from the Chronos shell to support passwordless login to the remote server
Fifth - type this command, plugging in your remote login credentials
$ sshfs -o idmap=user email@example.com:/path/to/directory ~/Downloads/mount-directory
-o option is necessary to fix up user ID's between local and remote ID's.
The rest is fairly obvious if you've used SSH before. The user name, host name (or IP address) of the remote machine, and the path within that machine.
Sixth - Use the ChromeOS file explorer to browse to that directory. Notice that the performance is lots lots better than with the Chrome SFTP file system app I recommended earlier.
Seventh - Make a text file somewhere to record the sshfs commands you'll be using for your remote servers. The process won't be automatable, but at least it can be scripted.
In the past I've tried both StackEdit and ShiftEdit and not been happy. It's been too long since I used either to remember just what the problem was. And in any case, those problems may have been fixed. In the Chrome app store both have very high ratings FWIW.
I am impressed by Koding. This is a service giving you a VPS hosted on Amazon AWS on which you can set up a development environment, and by paying them enough money you can have multiple VPS's. It includes a code editor for the files you've put on that VPS.
I've never tried Cloud9, but of course have heard good things about it. I see that it too offers a hosted development server in the cloud, and it appears to run using hosted Docker instances. hmmmm.... may have to try this.
However, what I need is an editor running on my Chromebook with which I can somehow edit files on my own VPS server(s) that are accessed over SSH/SFTP connections. If the SFTP filesystem was performant enough then Caret or Keypress would work well enough over the remote mounted filesystem.
Chrome/Browser based git?
Another idea I explored today is whether a local command line is needed at all. Maybe, I thought, a browser based git tool could check out a remote git repository, you edit it with Keypress or Caret, then push edits to a remote server, and you use FireSSH to keep a command line open on the server.
It's an interesting idea, but I didn't find anything suitable. The Chrome-app git clients in the app store appear to be in early prototype stages.
Chrome based graphics editing tools?
Of course we also need to produce graphics from time to time. These might be diagrams for documentation, or web site asset files.
For drawing diagrams I use draw.io. It produces vector based drawings, and can export SVG or PNG files. There's an extensive body of clipart that's built in, and it can import images.
For image editing I've been using Pixlr Editor. This is made by Adobe, and has some amazing capabilities for a tool that runs in the browser.
Canva is a widely recommended app - I've only diddled with it a little and don't know for myself how good it is. UPDATE: I've now used Canva a lot, and like it for certain kinds of creations. Each of these tools is suited to a different purpose. /UPDATE
These ideas aren't just for Chromebooks
Everything I've mentioned runs on Windows or Mac OS X or Linux because it all depends on the Chrome apps model. Chrome apps aren't just for ChromeOS systems, but for every desktop Chrome instance.