So I’ve been flirting with the idea of using a Chromebook for development and relying on remote servers for the place to do all my development. This has lead me down the path of looking at many different browser based IDEs and it’s clear that Cloud9 and Eclipse Che are two of today’s winners.
And then I was inspired to see if I could get either of the IDEs running on Carina.
And then I did it - here’s how I did it:
Step 0: Get a Rackspace Carina account.
Go here and with simply an email address and phone number you can get a completely free account!
Step 1: Get Carina
Here are the instructions from Rackspace.
Or, for OS X:
brew install carina
Or for linux:
mkdir $HOME/bin curl -L https://download.getcarina.com/carina/latest/$(uname -s)/$(uname -m)/carina -o $HOME/bin/carina chmod u+x $HOME/bin/carina
Step 2: If you don’t have a Docker CLI installed, get one.
We’ll use dvm to just get the client since that’s all we need:
curl -sL https://download.getcarina.com/dvm/latest/install.sh | sh source $HOME/.dvm/dvm.sh dvm install 1.9.1 ln -s $HOME/.dvm/bin/docker/1.9.1/docker $HOME/bin/docker
Step 3: Launch a Carina Cluster
First we need your API key. To get it, go to the Carina Control Panel, click your username in the top-right corner, and then click API Key.
Next export the following variables:
export CARINA_USERNAME=the_email_you_use_to_login export CARINA_APIKEY=the_key_you_just_found
From here you should be able to list and see no clusters exist:
Now let’s create your first cluster:
carina create --wait project1
Now we can see it listed:
Now we can load the cluster’s Docker configuration:
eval $(carina env project1)
Now we can see our docker client is connected to our cluster:
docker info Containers: 8 Images: 3 Role: primary Strategy: spread Filters: health, port, dependency, affinity, constraint Nodes: 1 b83f6276-6d58-486c-92e9-bc388833d867-n1: 188.8.131.52:42376 └ Containers: 8 └ Reserved CPUs: 0 / 12 └ Reserved Memory: 0 B / 4.2 GiB └ Labels: executiondriver=native-0.2, kernelversion=3.18.21-1-rackos, operatingsystem=Debian GNU/Linux 7 (wheezy) (containerized), storagedriver=aufs CPUs: 12 Total Memory: 4.2 GiB
Step 4: Launch the Cloud9 container
docker run -P -e AUTH=user:pass -d flyinprogrammer/cloud9-with-carina
Grab the container’s public ip address via docker:
docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS a76af8681dc2 flyinprogrammer/cloud9-with-carina "/entrypoint.sh" 35 minutes ago Up 34 minutes 184.108.40.206:32777->80/tcp, 220.127.116.11:32776->3000/tcp
Note in this case we’d access it via: http://18.104.22.168:32777 and the username/password combination we set was
user for a username and
pass for a password.
Step 5: Setup Carina in our Cloud9 container
Because I’ve already installed carina and a docker client in the container, all we need to do is the following:
export CARINA_USERNAME=the_email_you_use_to_login export CARINA_APIKEY=the_key_you_just_found eval $(carina env project1)
And now we can build and run docker containers within our remote Cloud9 IDE!
Note when we launched the container we also expose port 3000. This provides us an inbound port we can bind the software we write in the IDE too when we start it up.
Additionally, if your software is built and runs in docker, we can simply deploy it to yet another Carina cluster which we can launch from within the IDE.
I tried getting this to work with Eclipse Che, but I couldn’t get it to work. It’d be cool if it did work though since Che is super duper Docker based.
Hope you find this as fun and cool as I do!