paratrooper icon indicating copy to clipboard operation
paratrooper copied to clipboard

Maintenance mode never comes on

Open ThisIsMissEm opened this issue 10 years ago • 2 comments

Hi, I've got a deploy.rake file that looks like that:

require 'paratrooper'

namespace :deploy do
  desc 'Deploy app in production environment'
  task :production do
    admin = Paratrooper::Deploy.new("nts-admin", maintenance: true)
    api = Paratrooper::Deploy.new("nts-api", maintenance: true)

    puts "Activating Maintenance Mode…"
    admin.activate_maintenance_mode
    api.activate_maintenance_mode

    puts "Deploying nts-admin…"
    admin.push_repo
    admin.run_migrations
    admin.app_restart

    puts "Deploying nts-api…"
    api.push_repo
    api.run_migrations
    api.app_restart

    puts "Deactivating Maintenance Mode…"
    admin.deactivate_maintenance_mode
    api.deactivate_maintenance_mode

    puts "Warming…"
    admin.warm_instance
    api.warm_instance

    puts "Notifying New Relic…"
    system 'curl -H [...] https://api.newrelic.com/deployments.xml > /dev/null 2>&1'
    system 'curl -H [...] https://api.newrelic.com/deployments.xml > /dev/null 2>&1'
  end
end

Everything works, apart from maintenance mode never switching on. (And yes, this is a single repo to multiple app deploy).

ThisIsMissEm avatar Dec 02 '14 12:12 ThisIsMissEm

Cool to see a slightly different use of paratrooper.

Off the top of my head I don't see a reason why maintenance mode would not work for you. With that being said, is there anything in your normal deploy (like a long running migration) that would cause the deploy to run longer than normal?

If not, there is no reason to run maintenance mode or warming a dyno. Heroku doesn't work in the same way as it did when I originally created paratrooper. I'm currently in the process of removing those things for the next version.

mattpolito avatar Dec 03 '14 19:12 mattpolito

I’ve since switched to a simple bash version:

#!/usr/bin/env bash
echo "Activating Maintenance Mode for Admin…"
heroku maintenance:on --app admin

git push nts-api master
heroku run rake db:migrate --app api
heroku ps:restart --app api

git push nts-admin master
heroku ps:restart --app admin

ecocho "Deactivating Maintenance Mode…"
heroku maintenance:off --app admin

echo "Notifying New Relic…"
curl -H “KEY" -d "deployment[app_name]=api" https://api.newrelic.com/deployments.xml > /dev/null 2>&1
curl -H “KEY" -d "deployment[app_name]=admin" https://api.newrelic.com/deployments.xml > /dev/null 2>&1

Essentially, I was using maintenance mode to prevent the admin panel from changing data whilst the API which runs the migrations was deploying. I probably don’t need the ps:restart on Admin there either.

On 3 Dec 2014, at 7:58 pm, Matt Polito [email protected] wrote:

Cool to see a slightly different use of paratrooper.

Off the top of my head I don't see a reason why maintenance mode would not work for you. With that being said, is there anything in your normal deploy (like a long running migration) that would cause the deploy to run longer than normal?

If not, there is no reason to run maintenance mode or warming a dyno. Heroku doesn't work in the same way as it did when I originally created paratrooper. I'm currently in the process of removing those things for the next version.

— Reply to this email directly or view it on GitHub.

ThisIsMissEm avatar Dec 04 '14 18:12 ThisIsMissEm