capistrano / passenger

Passenger support for Capistrano 3.x
MIT License
138 stars 44 forks source link

no tty present and no askpass program specified #31

Closed 9mm closed 9 years ago

9mm commented 9 years ago

Hey,

I'm trying to use the new Passenger restart method (I used to use touch.txt).

I am using Ubuntu, RVM, Nginx + Passenger module.

When I go with the 100% vanilla setup of capistrano/passenger, I get this:

SSHKit::Runner::ExecuteError: Exception while executing as deploy@xxxxxxxxxx: passenger-config exit status: 1
passenger-config stdout: Nothing written
passenger-config stderr: *** ERROR: You are not authorized to query the status for this Phusion Passenger instance. Please try again with 'rvmsudo'.

I set this option: set :passenger_restart_with_sudo, true

And then I get this:

SSHKit::Runner::ExecuteError: Exception while executing as deploy@xxxxxxxxxx: sudo exit status: 1
sudo stdout: Nothing written
sudo stderr: sudo: no tty present and no askpass program specified

Is there anything I can do without messing with the sudoers file? I have a lot of servers and don't really have the energy right now to change all that, if possible.

Capfile:

require 'capistrano/setup'
require 'capistrano/deploy'

require 'rvm/capistrano'

require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'capistrano/passenger'
require 'capistrano/sitemap_generator'

require 'whenever/capistrano'
require 'airbrake/capistrano3'

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each {|r| import r}

deploy.rb

lock '3.2.1'

set :application, 'XXXXXXXXX'
set :repo_url,    'git@github.com:XXXXXXXXXX/XXXXXXXXX.git'

set :rvm_type, :system
set :rvm_path, '/usr/local/lib/rvm'

set :passenger_restart_with_sudo, true

set :whenever_identifier, ->{ "#{fetch(:application)}_#{fetch(:stage)}" }
set :whenever_roles, [:app, :primary_production_worker]

set :linked_files, %w{config/database.local.yml config/secrets.local.yml}
set :linked_dirs, %w{log}

after 'deploy:published', 'foreman:export'
after 'deploy:published', 'foreman:restart'
after 'deploy:finished',  'airbrake:deploy'
betesh commented 9 years ago

What version of capistrano passenger is running on your server? If you can upgrade to 5.0.10 or higher, that would be the quickest fix

9mm commented 9 years ago

lol, it took me about 10 minutes to realize you meant passenger and not capistrano. I was like hmm.... lots of versions must have been released.

I see, my passenger is out of date. thanks!

betesh commented 9 years ago

My mistake. Glad you figured out what I meant.