Cloudmacs and getting to know Docker

TLDR: I'm running my spacemacs as a web service on my VPS, check it out too.

Since I've became hooked on emacs, I've been looking for ways to have same experience in my browser. Sometimes you have to use non-personal computers where it's not possible/undesirable to install desktop Emacs and Dropbox/Syncthing to access your personal data. So I've been looking for some cloud solution since I've got a VPS.

The closest tool to what I wanted was Filestash: it suports vim/emacs bindings and some org-mode goodies. However, it wasn't anywhere as convenient as emacs. Also after an update it somehow broke my Dropbox connection to the directory with org-mode notes, which rendered it useless for me. I'm also moving from Dropbox to Syncthing, so was planning to abandon Filestash anyway as it doesn't allow local files, only ftp or git.

Dropbox is not capable of previewing arbitrary text files let alone edit; and even if it could you obviously wouldn't get anything close to your usual emacs workflow.

And you could imagine that while elisp/vim style editing is fairly application agnostic, it's a thankless job to rewrire/port all the amazing emacs packages and features I'm used to like neotree, helm, refile, swoop, agenda, projectile, org-drill etc.

So I figured the only thing that would keep me happy is to run emacs itself over the web! Thankfully, due to its TUI interface that works surprisingly well.

It works really well with spacemacs/evil style SPC and comma bindings because they for the most part don't overlap with OS/browser hotkeys.

Also it's the first time I properly used Docker apart from running other people's containers so here are few non-obvious things I learnt which you might find useful:

  • Multistage build is a painless way to extend someone else's containers or combine several containers in one
  • build time variables is a nice way to make your container more amendable, e.g. you can avoid hardcoding versions if you use it
  • Perhaps the trickiest one: docker reuses the host kernel and as a consequence same user IDs, so if you built your container as root (which is normally the case if you pull from Docker Hub), your container will write back to mounted volumes as root too!

    To get around that there is a somewhat hacky asEnvUser script and custom docker-compose wrapper that take care of preserving user ID.