SlideShare a Scribd company logo
1 of 62
Ruby and
Muriel Salvan
X-Aeon Solutions
Feb 04th 2014
Riviera.rb

on Rails
Who am I?
Muriel Salvan
Freelance Developer
Founder of X-Aeon Solutions
Open Source advocate
Ruby / Rails expert
Co-founder of RivieraRB
@MurielSalvan
Github
SourceForge
My tech blog
Muriel@X-Aeon.com
Let's talk about cargo transport
(that's why you came here, right?)
"I want my piano to be delivered
from Nice to London"
"I also want my barrel of wine
delivered from Nice to London."
"Hey! Don't forget my bags of rice
too!"
How ?
"By train, plane, boat, truck, bus,
mule, or whatever!"
Do I worry about how goods interact
(e.g. coffee beans next to spices)

Can I transport quickly and smoothly
(e.g. from boat to train to truck)
A standard container that is loaded with virtually any
goods, and stays sealed until it reaches final delivery.

…in between, can be loaded and unloaded, stacked,
transported efficiently over long distances, and
transferred from one mode of transport to another
Static website

Do services and apps
User DB
Queue
interact appropriately?
Web frontend
Background workers

Development VM

Analytics DB
API endpoint

Production Cluster

Public Cloud
QA Can I migrate smoothly and
server
Disaster recovery Contributor’s laptop
quickly?
Customer Data Center
Production Servers
Static website

User DB

Queue

Analytics DB

Background workers

API endpoint

Web frontend
Production Cluster

QA server
Customer Data Center
Development VM

Disaster recovery
Production Servers

Contributor’s laptop
Public Cloud
So what does Docker bring?
1- File systems images
Structured in layers (storing diffs only)
● Layers are reused between images
●

Clever!
2- Processes run in a contained
environment (containers)
It's chroot on steroids!

Using images' file systems
(isolated like in chroot)
● In a separate process space
(using Linux containers)
● With a specific network interface
● Can run as root
●
3- A public repository of images
Pull and push images
● Build them from Github projects
● Be part of a great community!
●
"Is it a yet-another-virtualizationsolution?"
No.
Processes run by Docker
share the host Kernel
● No device emulation
● No boot sequence
● Architectures and platforms
between Host and containers
must match
●
"So where is the portability?"
●

Containers can be run on any Kernel

(>= 3.8, Linux 64b only for now)

Whatever the Linux distro
● If it runs on the Host, it can run from
a container
● Physical, virtual, cloud...
●
It's blazingly fast!!!
A few ms to load the container and run the
command
Use cases
Get running clusters on a single host
Awesome to test them!
Ensure the environment your process
runs in is the same in dev, test and
prod
Bring your environment along with your process.
Sandboxes everywhere!
You'll love that!
Deployments become sooo easy
Like "push"-and-"pull"-easy!
Lightweight virtualization too
"How do we create images?"
Docker files
Describe commands to be run to create an image
# Nginx
#
# VERSION

0.0.1

FROM
ubuntu
MAINTAINER Guillaume J. Charmes
<guillaume@dotcloud.com>
# make sure the package repository is up to date
RUN echo "deb http://archive.ubuntu.com/ubuntu precise
main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y inotify-tools nginx apache2
openssh-server
Docker file

docker build .
Image
"And how do we run a process in a
container?"
Image

docker run <image> <cmd>
Container
running <Cmd>
"I want to create a modified image"
Container

docker commit <container> <image name>

Image
"Hey! I want to deploy my image for
the world to see!"
Image

docker push <image>
Registry
Defaults to
http://index.docker.io
"And now my friend wants to get my
wonderful image to play with!"
Yeah, sure... whatever
Registry
docker search <image name>
docker pull <image>
Image
"Wasn't that supposed to be a Ruby
meetup?"
Let's simulate a Rails cluster with a
balancing Ruby proxy in front!
3000
Docker container
A

5000

5001

5002

5003

5004

3000

3000

3000

3000

3000

Docker container Docker container Docker container Docker container Docker container
B
B
B
B
B
1. Create a Ruby image:
murielsalvan/ruby
From ubuntu base image
● Using a Dockerfile
● Bonus: Upload it to index.docker.io via Github
●
# Ruby environment
#
# VERSION 0.2
FROM ubuntu
MAINTAINER Muriel Salvan <muriel@x-aeon.com>
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
ADD http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.0.tar.gz /tmp/
RUN cd /tmp && 
tar -xzf ruby-2.1.0.tar.gz && 
cd ruby-2.1.0 && 
./configure && 
make && 
make install && 
cd .. && 
rm -rf ruby-2.1.0 && 
rm -f ruby-2.1.0.tar.gz
2. Create a Rails server image:
murielsalvan/server
From murielsalvan/ruby base image
● Using an interactive bash in a container to install and
configure the Rails application
● Add a startup command: rails s
● Open default port 3000
●
3. Launch n docker containers from
murielsalvan/server
●

Map each container port 3000 to host ports 5000+i
4. Create a new image for the Ruby
proxy: murielsalvan/proxy
Based on murielsalvan/ruby
● Using an interactive bash to install and use em-proxy,
targetting servers on ports 5000+i
● Add a startup command: ruby -w balancing.rb
● Open port 3000
●
5. Launch 1 docker container from
murielsalvan/proxy
●

Map its guest port 3000 to host port 3000
6. Target localhost:3000
7. Profit!
Elapsed time (s) on Fibonacci computation

Sponsored by the
WTF effect!

50
45
40
35
30

Launch time
Execution time

25
20
15
10
5
0
Without Docker

With Docker
Memory consumption per container (kB)
180000
160000
140000
120000
Rails
Linux container

100000
80000
60000
40000
20000
0
RSS

VSZ

The Linux container memory is always the same whatever the process in the container:
1,5MB RSS and 32MB VSZ
NOT BAD
Links
Homepage
Index of Docker images
Dockerfile reference
Getting started
That's all, folks!

Source: xkcd

Thanks for attending!

More Related Content

What's hot

Docker with openstack
Docker with openstackDocker with openstack
Docker with openstackLiang Bo
 
Visualising Basic Concepts of Docker
Visualising Basic Concepts of Docker Visualising Basic Concepts of Docker
Visualising Basic Concepts of Docker vishnu rao
 
Introduction to Docker
Introduction  to DockerIntroduction  to Docker
Introduction to DockerJian Wu
 
Docker introduction for Carbon IT
Docker introduction for Carbon ITDocker introduction for Carbon IT
Docker introduction for Carbon ITyannick grenzinger
 
Docker and the Linux Kernel
Docker and the Linux KernelDocker and the Linux Kernel
Docker and the Linux KernelDocker, Inc.
 
docker installation and basics
docker installation and basicsdocker installation and basics
docker installation and basicsWalid Ashraf
 
Wso2 con 2014-us-tutorial-apache stratos-wso2 private paas with docker integr...
Wso2 con 2014-us-tutorial-apache stratos-wso2 private paas with docker integr...Wso2 con 2014-us-tutorial-apache stratos-wso2 private paas with docker integr...
Wso2 con 2014-us-tutorial-apache stratos-wso2 private paas with docker integr...Lakmal Warusawithana
 
Docker introduction
Docker introductionDocker introduction
Docker introductiondotCloud
 
Docker 101 - Getting started
Docker 101 - Getting startedDocker 101 - Getting started
Docker 101 - Getting startedMatheus Marabesi
 
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @GuidewireIntroduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @GuidewiredotCloud
 
Docker - The Linux Container
Docker - The Linux ContainerDocker - The Linux Container
Docker - The Linux ContainerBalaji Rajan
 

What's hot (20)

Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
Docker with openstack
Docker with openstackDocker with openstack
Docker with openstack
 
Visualising Basic Concepts of Docker
Visualising Basic Concepts of Docker Visualising Basic Concepts of Docker
Visualising Basic Concepts of Docker
 
Docker
DockerDocker
Docker
 
Introduction to Docker
Introduction  to DockerIntroduction  to Docker
Introduction to Docker
 
Learning Docker with Thomas
Learning Docker with ThomasLearning Docker with Thomas
Learning Docker with Thomas
 
Docker
DockerDocker
Docker
 
JOSA TechTalk: Introduction to docker
JOSA TechTalk: Introduction to dockerJOSA TechTalk: Introduction to docker
JOSA TechTalk: Introduction to docker
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Docker introduction for Carbon IT
Docker introduction for Carbon ITDocker introduction for Carbon IT
Docker introduction for Carbon IT
 
Intro To Docker
Intro To DockerIntro To Docker
Intro To Docker
 
Docker and the Linux Kernel
Docker and the Linux KernelDocker and the Linux Kernel
Docker and the Linux Kernel
 
docker installation and basics
docker installation and basicsdocker installation and basics
docker installation and basics
 
Wso2 con 2014-us-tutorial-apache stratos-wso2 private paas with docker integr...
Wso2 con 2014-us-tutorial-apache stratos-wso2 private paas with docker integr...Wso2 con 2014-us-tutorial-apache stratos-wso2 private paas with docker integr...
Wso2 con 2014-us-tutorial-apache stratos-wso2 private paas with docker integr...
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Docker 101 - Getting started
Docker 101 - Getting startedDocker 101 - Getting started
Docker 101 - Getting started
 
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @GuidewireIntroduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
 
Docker - The Linux Container
Docker - The Linux ContainerDocker - The Linux Container
Docker - The Linux Container
 

Viewers also liked

Ruby object model at the Ruby drink-up of Sophia, January 2013
Ruby object model at the Ruby drink-up of Sophia, January 2013Ruby object model at the Ruby drink-up of Sophia, January 2013
Ruby object model at the Ruby drink-up of Sophia, January 2013rivierarb
 
Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012rivierarb
 
Pry at the Ruby Drink-up of Sophia, February 2012
Pry at the Ruby Drink-up of Sophia, February 2012Pry at the Ruby Drink-up of Sophia, February 2012
Pry at the Ruby Drink-up of Sophia, February 2012rivierarb
 
DRb at the Ruby Drink-up of Sophia, December 2011
DRb at the Ruby Drink-up of Sophia, December 2011DRb at the Ruby Drink-up of Sophia, December 2011
DRb at the Ruby Drink-up of Sophia, December 2011rivierarb
 
Piloting processes through std IO at the Ruby Drink-up of Sophia, January 2012
Piloting processes through std IO at the Ruby Drink-up of Sophia, January 2012Piloting processes through std IO at the Ruby Drink-up of Sophia, January 2012
Piloting processes through std IO at the Ruby Drink-up of Sophia, January 2012rivierarb
 
Ruby and Twitter at the Ruby drink-up of Sophia, January 2013
Ruby and Twitter at the Ruby drink-up of Sophia, January 2013Ruby and Twitter at the Ruby drink-up of Sophia, January 2013
Ruby and Twitter at the Ruby drink-up of Sophia, January 2013rivierarb
 
Ruby 2.0 at the Ruby drink-up of Sophia, February 2013
Ruby 2.0 at the Ruby drink-up of Sophia, February 2013Ruby 2.0 at the Ruby drink-up of Sophia, February 2013
Ruby 2.0 at the Ruby drink-up of Sophia, February 2013rivierarb
 
The Dark Side of Programming Languages
The Dark Side of Programming LanguagesThe Dark Side of Programming Languages
The Dark Side of Programming LanguagesJean-Baptiste Mazon
 
Quines—Programming your way back to where you were
Quines—Programming your way back to where you wereQuines—Programming your way back to where you were
Quines—Programming your way back to where you wereJean-Baptiste Mazon
 

Viewers also liked (10)

Ruby object model at the Ruby drink-up of Sophia, January 2013
Ruby object model at the Ruby drink-up of Sophia, January 2013Ruby object model at the Ruby drink-up of Sophia, January 2013
Ruby object model at the Ruby drink-up of Sophia, January 2013
 
Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012
 
Pry at the Ruby Drink-up of Sophia, February 2012
Pry at the Ruby Drink-up of Sophia, February 2012Pry at the Ruby Drink-up of Sophia, February 2012
Pry at the Ruby Drink-up of Sophia, February 2012
 
DRb at the Ruby Drink-up of Sophia, December 2011
DRb at the Ruby Drink-up of Sophia, December 2011DRb at the Ruby Drink-up of Sophia, December 2011
DRb at the Ruby Drink-up of Sophia, December 2011
 
Piloting processes through std IO at the Ruby Drink-up of Sophia, January 2012
Piloting processes through std IO at the Ruby Drink-up of Sophia, January 2012Piloting processes through std IO at the Ruby Drink-up of Sophia, January 2012
Piloting processes through std IO at the Ruby Drink-up of Sophia, January 2012
 
Ruby and Twitter at the Ruby drink-up of Sophia, January 2013
Ruby and Twitter at the Ruby drink-up of Sophia, January 2013Ruby and Twitter at the Ruby drink-up of Sophia, January 2013
Ruby and Twitter at the Ruby drink-up of Sophia, January 2013
 
Ruby 2.0 at the Ruby drink-up of Sophia, February 2013
Ruby 2.0 at the Ruby drink-up of Sophia, February 2013Ruby 2.0 at the Ruby drink-up of Sophia, February 2013
Ruby 2.0 at the Ruby drink-up of Sophia, February 2013
 
The Dark Side of Programming Languages
The Dark Side of Programming LanguagesThe Dark Side of Programming Languages
The Dark Side of Programming Languages
 
Quines—Programming your way back to where you were
Quines—Programming your way back to where you wereQuines—Programming your way back to where you were
Quines—Programming your way back to where you were
 
Untitled talk at Riviera.rb
Untitled talk at Riviera.rbUntitled talk at Riviera.rb
Untitled talk at Riviera.rb
 

Similar to Ruby and Docker on Rails

Containing the world with Docker
Containing the world with DockerContaining the world with Docker
Containing the world with DockerGiuseppe Piccolo
 
Docker and OpenStack Boston Meetup
Docker and OpenStack Boston MeetupDocker and OpenStack Boston Meetup
Docker and OpenStack Boston MeetupKamesh Pemmaraju
 
Docker open stack boston
Docker open stack bostonDocker open stack boston
Docker open stack bostondotCloud
 
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...Jérôme Petazzoni
 
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12dotCloud
 
Application Deployment on Openstack
Application Deployment on OpenstackApplication Deployment on Openstack
Application Deployment on OpenstackDocker, Inc.
 
LXC, Docker, and the future of software delivery | LinuxCon 2013
LXC, Docker, and the future of software delivery | LinuxCon 2013LXC, Docker, and the future of software delivery | LinuxCon 2013
LXC, Docker, and the future of software delivery | LinuxCon 2013dotCloud
 
LXC Docker and the Future of Software Delivery
LXC Docker and the Future of Software DeliveryLXC Docker and the Future of Software Delivery
LXC Docker and the Future of Software DeliveryDocker, Inc.
 
Develop with linux containers and docker
Develop with linux containers and dockerDevelop with linux containers and docker
Develop with linux containers and dockerFabio Fumarola
 
Using Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsUsing Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsMicael Gallego
 
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsElasTest Project
 
Intro to Docker November 2013
Intro to Docker November 2013Intro to Docker November 2013
Intro to Docker November 2013Docker, Inc.
 
Docker for developers
Docker for developersDocker for developers
Docker for developersDrupalDay
 
Docker for developers
Docker for developersDocker for developers
Docker for developerssparkfabrik
 

Similar to Ruby and Docker on Rails (20)

Containing the world with Docker
Containing the world with DockerContaining the world with Docker
Containing the world with Docker
 
Docker & Daily DevOps
Docker & Daily DevOpsDocker & Daily DevOps
Docker & Daily DevOps
 
Docker and-daily-devops
Docker and-daily-devopsDocker and-daily-devops
Docker and-daily-devops
 
Docker intro
Docker introDocker intro
Docker intro
 
Docker and OpenStack Boston Meetup
Docker and OpenStack Boston MeetupDocker and OpenStack Boston Meetup
Docker and OpenStack Boston Meetup
 
Docker open stack boston
Docker open stack bostonDocker open stack boston
Docker open stack boston
 
OpenStack Boston
OpenStack BostonOpenStack Boston
OpenStack Boston
 
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
 
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
 
Application Deployment on Openstack
Application Deployment on OpenstackApplication Deployment on Openstack
Application Deployment on Openstack
 
LXC, Docker, and the future of software delivery | LinuxCon 2013
LXC, Docker, and the future of software delivery | LinuxCon 2013LXC, Docker, and the future of software delivery | LinuxCon 2013
LXC, Docker, and the future of software delivery | LinuxCon 2013
 
LXC Docker and the Future of Software Delivery
LXC Docker and the Future of Software DeliveryLXC Docker and the Future of Software Delivery
LXC Docker and the Future of Software Delivery
 
Docker
DockerDocker
Docker
 
Develop with linux containers and docker
Develop with linux containers and dockerDevelop with linux containers and docker
Develop with linux containers and docker
 
Using Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsUsing Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and Jenkins
 
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
 
Docker presentation
Docker presentationDocker presentation
Docker presentation
 
Intro to Docker November 2013
Intro to Docker November 2013Intro to Docker November 2013
Intro to Docker November 2013
 
Docker for developers
Docker for developersDocker for developers
Docker for developers
 
Docker for developers
Docker for developersDocker for developers
Docker for developers
 

Recently uploaded

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 

Recently uploaded (20)

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 

Ruby and Docker on Rails

  • 1. Ruby and Muriel Salvan X-Aeon Solutions Feb 04th 2014 Riviera.rb on Rails
  • 3. Muriel Salvan Freelance Developer Founder of X-Aeon Solutions Open Source advocate Ruby / Rails expert Co-founder of RivieraRB
  • 5. Let's talk about cargo transport (that's why you came here, right?)
  • 6. "I want my piano to be delivered from Nice to London"
  • 7. "I also want my barrel of wine delivered from Nice to London."
  • 8. "Hey! Don't forget my bags of rice too!"
  • 10. "By train, plane, boat, truck, bus, mule, or whatever!"
  • 11. Do I worry about how goods interact (e.g. coffee beans next to spices) Can I transport quickly and smoothly (e.g. from boat to train to truck)
  • 12.
  • 13. A standard container that is loaded with virtually any goods, and stays sealed until it reaches final delivery. …in between, can be loaded and unloaded, stacked, transported efficiently over long distances, and transferred from one mode of transport to another
  • 14.
  • 15. Static website Do services and apps User DB Queue interact appropriately? Web frontend Background workers Development VM Analytics DB API endpoint Production Cluster Public Cloud QA Can I migrate smoothly and server Disaster recovery Contributor’s laptop quickly? Customer Data Center Production Servers
  • 16. Static website User DB Queue Analytics DB Background workers API endpoint Web frontend Production Cluster QA server Customer Data Center Development VM Disaster recovery Production Servers Contributor’s laptop Public Cloud
  • 17. So what does Docker bring?
  • 18. 1- File systems images Structured in layers (storing diffs only) ● Layers are reused between images ● Clever!
  • 19. 2- Processes run in a contained environment (containers) It's chroot on steroids! Using images' file systems (isolated like in chroot) ● In a separate process space (using Linux containers) ● With a specific network interface ● Can run as root ●
  • 20. 3- A public repository of images Pull and push images ● Build them from Github projects ● Be part of a great community! ●
  • 21. "Is it a yet-another-virtualizationsolution?"
  • 22. No.
  • 23. Processes run by Docker share the host Kernel ● No device emulation ● No boot sequence ● Architectures and platforms between Host and containers must match ●
  • 24. "So where is the portability?"
  • 25. ● Containers can be run on any Kernel (>= 3.8, Linux 64b only for now) Whatever the Linux distro ● If it runs on the Host, it can run from a container ● Physical, virtual, cloud... ●
  • 26. It's blazingly fast!!! A few ms to load the container and run the command
  • 28. Get running clusters on a single host Awesome to test them!
  • 29. Ensure the environment your process runs in is the same in dev, test and prod Bring your environment along with your process. Sandboxes everywhere! You'll love that!
  • 30. Deployments become sooo easy Like "push"-and-"pull"-easy!
  • 32.
  • 33. "How do we create images?"
  • 34. Docker files Describe commands to be run to create an image
  • 35. # Nginx # # VERSION 0.0.1 FROM ubuntu MAINTAINER Guillaume J. Charmes <guillaume@dotcloud.com> # make sure the package repository is up to date RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list RUN apt-get update RUN apt-get install -y inotify-tools nginx apache2 openssh-server
  • 37. "And how do we run a process in a container?"
  • 38. Image docker run <image> <cmd> Container running <Cmd>
  • 39. "I want to create a modified image"
  • 41. "Hey! I want to deploy my image for the world to see!"
  • 42. Image docker push <image> Registry Defaults to http://index.docker.io
  • 43. "And now my friend wants to get my wonderful image to play with!" Yeah, sure... whatever
  • 44. Registry docker search <image name> docker pull <image> Image
  • 45.
  • 46. "Wasn't that supposed to be a Ruby meetup?"
  • 47. Let's simulate a Rails cluster with a balancing Ruby proxy in front!
  • 48. 3000 Docker container A 5000 5001 5002 5003 5004 3000 3000 3000 3000 3000 Docker container Docker container Docker container Docker container Docker container B B B B B
  • 49. 1. Create a Ruby image: murielsalvan/ruby From ubuntu base image ● Using a Dockerfile ● Bonus: Upload it to index.docker.io via Github ●
  • 50. # Ruby environment # # VERSION 0.2 FROM ubuntu MAINTAINER Muriel Salvan <muriel@x-aeon.com> RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list RUN apt-get update RUN apt-get upgrade -y RUN apt-get install -y build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev ADD http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.0.tar.gz /tmp/ RUN cd /tmp && tar -xzf ruby-2.1.0.tar.gz && cd ruby-2.1.0 && ./configure && make && make install && cd .. && rm -rf ruby-2.1.0 && rm -f ruby-2.1.0.tar.gz
  • 51. 2. Create a Rails server image: murielsalvan/server From murielsalvan/ruby base image ● Using an interactive bash in a container to install and configure the Rails application ● Add a startup command: rails s ● Open default port 3000 ●
  • 52. 3. Launch n docker containers from murielsalvan/server ● Map each container port 3000 to host ports 5000+i
  • 53. 4. Create a new image for the Ruby proxy: murielsalvan/proxy Based on murielsalvan/ruby ● Using an interactive bash to install and use em-proxy, targetting servers on ports 5000+i ● Add a startup command: ruby -w balancing.rb ● Open port 3000 ●
  • 54. 5. Launch 1 docker container from murielsalvan/proxy ● Map its guest port 3000 to host port 3000
  • 57.
  • 58. Elapsed time (s) on Fibonacci computation Sponsored by the WTF effect! 50 45 40 35 30 Launch time Execution time 25 20 15 10 5 0 Without Docker With Docker
  • 59. Memory consumption per container (kB) 180000 160000 140000 120000 Rails Linux container 100000 80000 60000 40000 20000 0 RSS VSZ The Linux container memory is always the same whatever the process in the container: 1,5MB RSS and 32MB VSZ
  • 61. Links Homepage Index of Docker images Dockerfile reference Getting started
  • 62. That's all, folks! Source: xkcd Thanks for attending!