SlideShare une entreprise Scribd logo
1  sur  62
Télécharger pour lire hors ligne
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!

Contenu connexe

Tendances

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
 

Tendances (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
 

En vedette

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
 

En vedette (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
 

Similaire à 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
 

Similaire à 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
 
OpenStack Boston
OpenStack BostonOpenStack Boston
OpenStack Boston
 
Docker open stack boston
Docker open stack bostonDocker open stack boston
Docker open stack 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
 

Dernier

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 

Dernier (20)

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.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!