title: How to update rails app on production with Docker and Fig with zero downtime?
body: <p>I am using Docker and Fig for my Rails/Postgres app.</p>
  
  <p>What is the best way to push <strong><em>updates</em></strong> to Rails app to production? Currently I am running the following script on production but it causes about 10 seconds of downtime:</p>
  
  <pre><code>sudo fig pull web
  sudo fig up -d web
  </code></pre>
  
  <p>I guess the downtime happens when Fig recreates the <code>web</code> container.</p>
  
  <p>Here is a <code>fig.xml</code> file I use on production.</p>
  
  <pre><code>db:
    image: postgres:9.3
    volumes_from:
      - db-data
    ports:
      - 5432
  web:
    image: myaccount/my_private_repo
    command: bundle exec unicorn -p 3000 -c ./config/unicorn.rb
    volumes_from:
      - gems-2.1
    ports:
      - "80:3000"
    links:
      - db
  </code></pre>
  
  <p>The demo of the app is here: <a href="https://github.com/evgenyneu/docker-rails-fig-sample" rel="nofollow">https://github.com/evgenyneu/docker-rails-fig-sample</a></p>