Setup to develop using elixir

Background

Recently I took upon a personal project to help someone very close to me. This project will be done in Elixir, but there is an issue - the machines I have access to are not strong enough to have a Linux VM (via VirtualBox or VMWare) on top of their installation and run Elixir.

I mention a VM, because I don’t want to install Elixir on the host, which most likely won’t even be my machine.

Options

The first thing that jumped to my mind was to use a cloud provider. However I have to pay them a monthly fee and I don’t feel comfortable with that idea.

The other option I can think of is using Docker. I have read some articles where people mention developer images for Elixir programmers. Ideally, I would be able to have all my code and environment in a docker image and then use an online editor to code and do the work.

Questions

But I have no experience with docker images for development. So naturally I have some questions:

  1. what is your current setup for developing elixir?
  2. Do you use a docker image for development?
  3. Do you install things directly into your machine?
  4. Do you recommend any cloud provider or online IDE that I could try?

What operating system is your host driven by? If it’s not Linux, you’ll end up installing a VM which runs the docker anyway…

3 Likes

I use docker extensively for my development environment, although it does not come without it’s own set of challenges.

Current setup: Linux (Ubuntu), Docker installed locally, running containers built from either images pulled from docker or custom-made and volumes (for data persistence)
Do I use it for dev: yes
Do I install things locally: with the exception of docker, no.
I can’t recommend a provider as I have not used one for dev, but I use vscode which supports docker and ssl

I do my elixir work directly on macOS, but I also work on a larger JVM-based project and we decided to do development on Google Cloud Platform.

We spin up a preemptible instance whenever we want to do work and use Mutagen to sync local files to the remote machine and to forward ports. We then edit files locally and use local web browsers to hit the local ports which get forwarded to the remote machine. An ansible script for setup and few simple bash scripts for starting and stopping everything keeps it all pretty simple.

A 4 CPU machine with 15GB RAM is USD$0.04 per hour (pro-rated to the minute and only accruing charges when the machine is running) which is pretty cheap especially if you’re not going to be using it 24x7. Google might choose to shut your machine down if they need it back (that’s the preemptible part, and the reason why it’s only 20% the price of a regular server) but because all of our work is written to our local disk before being synced up to the remote machine, there’s no risk of data loss.

3 Likes

I only have an available Windows machine, but I would prefer to stay away from installing anything on it. The other tool I can use is an iPad, a really old one.

I am aware that Docker is a VM, but it is at least an order of magnitude faster than VirtualBox or VMWare iirc.

Do you use VSCode online? Do you use any online IDEs?

Docker is not a VM!

But it runs in a linux VM if your host system is windows.

If you use docker4windows then the MS hypervisor is used, it will allocate the necessary memory for the VM on creation, and even if enough is available in the system, chance is that creation of the machine will fail. I had a lot of trouble using it. It never properly worked for me.

Docker Toolbox though uses VirtualBox and memory for the VM is allocated in a more host friendly way, and in general my experience using it was much better than with docker4windows.

So, your best bet is probably USB-boot into a Linux2Go.

This also solves your “I don’t want to install anything” problem.

3 Likes

This will work fine in a laptop, but I don’t see how it can work with an iPad.
Still, do you have any Linux images in mind you would recommend?

Who wants to work on such a thing anyway? Laptop is hard enough… Without my second monitor I’m only half as productive as usualy…

Take whatever linux you are confident with.

My old machines are really heavy and bulky. My idea is to dedicate time to this project at night before going to sleep, like reading a book. I would probably invest in a decent keyboard and stream the monitor to a TV or something. But yes, I don’t plan on programming with an iPad, only to use it as a machine I can connect to do work.

I knew a guy who developed on a remote machine on an iPad. Don’t know his setup, but probably something like this https://arslan.io/2019/01/07/using-the-ipad-pro-as-my-development-machine/

I don’t use an online IDE, but I do run vscode directly in the container, so perhaps with built-in support for ssh (sorry, not ssl d’uh) it might be possible.

I played with https://codenvy.io/ a while back which was promising, but I got no further than a few simple tests - I was however able to build a complete elixir/phoenix environment quite easily.

Docker is not a VM, absolutely! Have you looked at Windows Subsystem for Linux if you want to stay on Windows? It’s still a VM as such, but lightweight etc. You can read more about it here: https://devblogs.microsoft.com/commandline/announcing-wsl-2/

WSL2 would be the version you would want to aim for and there’s a blog about it’s use combined with Docker here: https://www.docker.com/blog/developing-docker-windows-app-wsl2/

I in person have absolutely no reason to boot into windows, except to host my development VM at work…

Sadly this is how it is at work. But a VM works better for me than WSL.

2 Likes