Dockerize your rails app
Docker
An open platform for distributed applications for developers and sysadmins.
www.docker.com
- Build (linux) Images
- Run Containers from Images
- Decouple apps components (MySQL, Rails, Redis) into containers
- Docker deamon orchestrates and exposes container ports to outside
Docker Compose
... a tool for defining and running complex applications with Docker.
http://docs.docker.com/compose/
- Dockerfile (s) define images
- docker-compose.yml composes images (your app)
- docker-compose up starts app (your sandbox)
Dockerizing Rails
- Build a minimal Image
i.e. just Rails + Passenger with port 80 exposed
https://source.xing.com/jorge-dias/elpis
RUN apt-get update && apt-get install -y \
libicu-dev \
libxml2-dev
FROM xing-base-rails-web:latest
- Image with your gems minimal needed libraries
Dockerizing Rails
- Determine your Rails app components (containers)
e.g. jobs: MySQL, Redis, Memcached, RabbitMQ
check Docker Images Hub for more
<environment>:
database: <%= ENV['DB_DATABASE'] %>
username: <%= ENV['DB_USER'] %>
password: <%= ENV['DB_PASSWORD'] %>
host: <%= ENV['DB_HOST'] %>
port: <%= ENV['DB_PORT'] %>
- Configure Rails through Environment Variables
config/database.yml, AppConfig, etc
Status of jobs app
Already sailing on docker :-)
TODO
- Click around
- Find Problems
- 100% Decouple gems + app from components and server
Dockerize XING Sandboxes
https://source.xing.com/jorge-dias/elpis
Team
Jean Carlos Meninno
Jorge Dias
Joaquin Rivera Padron
Dockerize your rails app
By Joaquin Rivera Padron
Dockerize your rails app
How to run your rails app on Docker
- 1,798