I am using Docker and Fig for my Rails/Postgres app.
What is the best way to push updates to Rails app to production? Currently I am running the following script on production but it causes about 10 seconds of downtime:
sudo fig pull web
sudo fig up -d web
I guess the downtime happens when Fig recreates the web
container.
Here is a fig.xml
file I use on production.
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
The demo of the app is here: https://github.com/evgenyneu/docker-rails-fig-sample
The normal way to approach this is to run the app on multiple servers behind a load balancer. Do a rolling upgrade where one server at a time is stopped, new version pulled, and new version runs so as to preserve uptime.