Monthly Archives: July 2014

Docker + Elixir + Phoenixframework

Just playing around docker and elixir. The followings are some notes about deploying sample phoenixframework application on docker.

Deploying using Vagrant is just adding the recipe to the chef.run_list.

config.vm.provision :chef_solo do |chef|
  ...
  chef.run_list = [
    "recipe[docker]",
    "recipe[chef-docker-spawn-viewer]"
  ]

Notes

Creating Eixir Container for Docker

https://github.com/parroty/docker-elixir/blob/master/Dockerfile

It’s just installing the erlang pack and then build elixir.

# Install base package
RUN apt-get update
RUN apt-get install -y wget git build-essential

# Install Erlang
RUN wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
RUN dpkg -i erlang-solutions_1.0_all.deb
RUN apt-get update
RUN apt-get install -y erlang

# Install Elixir
WORKDIR /tmp/elixir-build
RUN git clone https://github.com/elixir-lang/elixir.git
WORKDIR elixir
RUN git checkout v0.14.2 && make && make install

Creating Phoenix Application Container for Docker

https://github.com/parroty/docker-spawn-viewer

It’s about fetching git repo and comple and start with “mix run” with “–no-halt” option. I’ve used phoenix-docker-example as reference.

## Prerequisites ##
RUN mix do local.rebar, local.hex --force

## Fetch the phoenix application ##
WORKDIR /usr/local/lib
RUN git clone https://github.com/parroty/spawn_viewer.git

## Compile ##
WORKDIR spawn_viewer
RUN mix do deps.get, compile

CMD ["mix", "run", "-e", "SpawnViewer.Router.start", "--no-deps-check", "--no-compile", "--no-halt"]

EXPOSE 4000

Deploying Phoenix Application using Chef

https://github.com/parroty/chef-docker-spawn-viewer

chef-dooker makes it pretty easy to configure parameters for docker deployment.

# Pull latest image
docker_image 'parroty/docker-spawn-viewer'

# Run container exposing ports
docker_container 'parroty/docker-spawn-viewer' do
  detach true
  port '4000:4000'
end

Watching – Dockercon Keynotes

Dockercon Keynote: Ben Golub
Dockercon Keynote: Solomon Hykes

Watching keynotes from the Dockercon last month. The growth in their ecosystem is impressive. Along with the increase in number of partners (Rackspace, RedHat, Google, etc.), many new projects are coming out to assist the development and deployment on docker.

I can see many commits in the the following newly announced open-source repositories.

Also, the management layers like DockerHub are coming out, and sounds more and more interesting.