migrating a large code-base to containers by doug johnson and jonathan lozinski (sage)

Post on 07-Jul-2015

19.041 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Green field projects might be able to take advantage of containers from the start, but how can we take a monolithic existing code-base and make the move to Docker? We want to run our code as a collection of small collaborating containers, but we have a large existing code-base, and don’t want massive disruption to product releases. We’ll take a walk through some of the challenges we’ve faced, and techniques used to solve taking a set of large collaborating Rails applications into containers. In this process we’ve aimed to progressively move towards our ideal.

TRANSCRIPT

Migrating a large code-base to containers

@_dougjohnson @jlozinski

source “http://rubygems.org”

gem ‘rails’, ‘4.1.7’

gem ‘mysql2’

gem ‘jquery-rails’

FROM ruby

ADD . /var/www

RUN bundle install

CMD bundle exec rails s

FROM ruby

ADD Gemfile /var/www/Gemfile

ADD Gemfile.lock /var/www/Gemfile.lock

RUN bundle install

ADD . /var/www/

CMD bundle exec rails s

FROM app_base_with_gems

ADD Gemfile /var/www/Gemfile

ADD Gemfile.lock /var/www/Gemfile.lock

RUN bundle install

ADD . /var/www

CMD bundle exec rails s

source “http://rubygems.org”

source “https://private.server.com”

git “git@github.com:MyOrg/private.git” do

gem “private_gem”

end

docker run -v $(pwd):/var/www \

-v $HOME/.ssh:/root/.ssh \

my_base_ruby \

bundle install —path=/var/www/bundle

docker build -t myapp_base .

docker run -v $(pwd):/var/www \

-v $HOME/.ssh:/root/.ssh \

my_base_ruby \

bundle install —path=/var/www/bundle

docker build -t myapp_base .

docker run -v $(pwd):/var/www \

-v $HOME/.ssh:/root/.ssh \

my_base_ruby \

bundle install —path=/var/www/bundle

docker build -t myapp_base .

docker run -v $(pwd):/var/www \

-v $HOME/.ssh:/root/.ssh \

my_base_ruby \

bundle install —path=/var/www/bundle

docker build -t myapp_base .

docker build -t $TAG .

docker run --name=$TAG \

--link=runningdb:db \

$TAG \

sh -c ‘bundle exec rake app:prepare’

docker commit $TAG $TAG

docker rm $TAG

docker build -t $TAG .

docker run --name=$TAG \

--link=runningdb:db \

$TAG \

sh -c ‘bundle exec rake app:prepare’

docker commit $TAG $TAG

docker rm $TAG

#Restore original CMD

docker run -d --name=$TAG \

$TAG \

sh -c ‘bundle exec rails s’

docker commit $TAG $TAG

docker rm $TAG

?

https://github.com/navy-project

Thank You.

top related