nginx maintenance page for Docker based Rails app

Viewed 1833

I think I have a chicken-and-egg situation:

My Rails app is Docker based and I have several images for nginx, Rails, a Resque worker, Redis and MySQL.

My current implementation of deployment is (simplistically):

docker-compose build
docker-compose down
... compile assets
... migrate
docker-compose up

Which works great, but of course if I browse to the app during deployment I don't any response which isn't great user experience.

I know of setting a 'maintenance' page in nginx that is served while the site is in maintenance mode, but the nginx image is part of the docker-compose spec, so that will go down as well.

Having all the images in one docker-compose spec does make deployment easier - if anything changes in any image (including nginx), that will be deployed automatically. And especially because nginx, Rails, MySQL, etc. are all in the same net.

How could I keep serving a maintenance page while the app is redeploying if nginx is part of the docker-compose spec?

(If it makes a difference, I'm using gitlab and a gitlab-runner container on the host to do the deployment from the repo.)

Thanks

2 Answers
Related