mattbrictson/airbrussh

Empty console output

evserykh opened this issue · 9 comments

I'm using capistrano 3.8.1 with default settings. It means I don't set neither :format_options, nor :format. Everything is logged at log/capistrano.log but console output is empty. Here is some debug info from config/deploy.rb

p fetch(:format) # => :airbrussh 
p fetch(:format_options) # => nil

Interesting. Thanks for the report! The only thing I can think of is that maybe Airbrussh thinks your console is zero-width and is therefore truncating all output?

Could you post the output of cap production doctor (with sensitive information redacted) to help me troubleshoot?

Also, could you try setting this option to see if it helps?

set :format_options, truncate: false

set :format_options, truncate: false didn't help.
Now print looks like
p fetch(:format_options) # => {:truncate=>false}
but nothing has changed.

Here is "filtered" output of suggested command:

$ bundle exec cap production doctor
                                        
Environment                                                   

    Ruby     ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-darwin16]
    Rubygems 2.5.2
    Bundler  1.14.6
    Command  /Users/user/.rbenv/versions/2.3.4/bin/cap production doctor

Gems                                                                                                                                                                                                       [13/110]

    capistrano         3.8.1
    airbrussh          1.2.0
    rake               12.0.0
    sshkit             1.13.1
    net-ssh            4.1.0
    capistrano-bundler 1.2.0
    capistrano-rbenv   2.1.1
    capistrano-sidekiq 0.10.0

Variables                                                                                                                                                                                                   [2/110]

    :application                 FILTERED
    :branch                       "master"
    :bundle_bins               ["gem", "rake", "rails", "sidekiq", "sidekiqctl"]
    :bundle_flags              "--deployment --quiet"
    :bundle_jobs               10
    :bundle_path               FILTERED
    :bundle_roles                :all
    :bundle_servers           FILTERED
    :bundle_without            "development test"
    :chruby_map_bins        ["sidekiq", "sidekiqctl"]
    :default_env                  FILTERED
    :deploy_to                     FILTERED
    :format                        :airbrussh
    :git_environmental_variables FILTERED
    :git_shallow_clone           false
    :git_wrapper_path            FILTERED
    :keep_releases               5
    :linked_dirs                 ["log", "tmp/pids", "tmp/cache", "tmp/sockets", "vendor/bundle"]
    :linked_files                ["config/unicorn.yml"]
    :local_user                  FILTERED
    :log_level                   :debug
    :pty                             false
    :rbenv_map_bins              ["rake", "gem", "bundle", "ruby", "rails", "sidekiq", "sidekiqctl"]
    :rbenv_path                  "$HOME/.rbenv"
    :rbenv_prefix                "$HOME/.rbenv/bin/rbenv exec"
    :rbenv_roles                 :all
    :rbenv_ruby                  "2.3.4"
    :rbenv_ruby_dir              "$HOME/.rbenv/versions/2.3.4"
    :repo_url                       FILTERED
    :rvm_map_bins                ["sidekiq", "sidekiqctl"]
    :sidekiq_default_hooks       true
    :sidekiq_env                 :production
    :sidekiq_log                 FILTERED
    :sidekiq_options_per_process nil
    :sidekiq_pid                 FILTERED
    :sidekiq_processes           1
    :sidekiq_role                :app
    :sidekiq_timeout             10
    :sidekiq_user                nil
    :stage                       :production
    :tmp_dir                     "/tmp"

    :bundle_jobs is not a recognized Capistrano setting (/Users/user/.rbenv/versions/2.3.4/lib/ruby/2.3.0/delegate.rb:83)

Servers (1)

    FILTERED [:web, :app, :sidekiq]

Sorry, I am stumped. I don't see anything obvious in your config that might cause a problem like this.

Just to be clear, when you run cap production deploy:check, you get no output whatsoever? It just looks like this?

$ cap production deploy:check
$

Here are some things I would try, running cap production deploy:check after each experiment to see if it fixes the output:

  1. If you have any custom tasks defined, comment them out.
  2. Comment out third-party gems (e.g. require "capistrano/sidekiq") from your Capfile one at a time.
  3. Remove airbrussh from the equation by adding set :format, :pretty to deploy.rb.

You know, actually I didn't try deploy:check before. I have tried rbenv:validate and bundler:install only and it led me to this issue.

deploy:check with default settings gives me output, but rbenv:validate and bundler:install commands are silent. However, I can see their output if I use set :format, :pretty.

Maybe it's a problem of capistrano-bundler and capistrano-rbenv gems?

I still am unclear by what you mean by the "commands are silent". Can you paste exactly what you are seeing? Also post the corresponding :pretty output of the same command so I can better understand the difference. Thanks.

Here is output for default settings (this is what I mean by "silent", sorry for my stupid English):

$ bundle exec cap production bundler:install
$

Here is output with set :format, :pretty:

$ bundle exec cap production bundler:install
 DEBUG [c642accb] Running [ -d $HOME/.rbenv/versions/2.3.4 ] as user@server
 DEBUG [c642accb] Command: [ -d $HOME/.rbenv/versions/2.3.4 ]
 DEBUG [c642accb] Finished in 4.586 seconds with exit status 0 (successful).
 DEBUG [61690e64] Running if test ! -d /app/current; then echo "Directory does not exist '/app/current'" 1>&2; false; fi as user@server
 DEBUG [61690e64] Command: if test ! -d /app/current; then echo "Directory does not exist '/app/current'" 1>&2; false; fi
 DEBUG [61690e64] Finished in 0.596 seconds with exit status 0 (successful).
 DEBUG [15ed7e3c] Running $HOME/.rbenv/bin/rbenv exec bundle check --path /app/shared/bundle as user@server
 DEBUG [15ed7e3c] Command: cd /app/current && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.4" ; $HOME/.rbenv/bin/rbenv exec bundle check --path /app/shared/bundle )
 DEBUG [15ed7e3c]       The Gemfile's dependencies are satisfied
 DEBUG [15ed7e3c] Finished in 1.165 seconds with exit status 0 (successful).
$

Thanks for sharing the output! Can you also post your Capfile?

Of course. Here it is:

require 'rubygems'                                                                                                         
require 'bundler'                                                                                                          
                                                                                                                           
require 'capistrano/setup'                                                                                                 
require 'capistrano/deploy'                                                                                                
                                                                                                                           
require "capistrano/scm/git"                                                                                               
require 'capistrano/bundler'                                                                                               
require 'capistrano/rbenv'                                                                                                 
# require 'capistrano/sidekiq'                                                                                               
# require 'slackistrano/capistrano'                                                                                        
                                                                                                                           
install_plugin Capistrano::SCM::Git                                                                                        
                                                                                                                           
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } # actually here aren't any custom tasks    

cap production bundler:install should not produce any output if your Gemfile has not changed and all gems are already installed.

Airbrussh only outputs commands that are run via execute. In the case of bundle:install, Capistrano is using test (not execute) to run bundle check to see if the Gemfile is satisfied. If this command succeeds, there is no step to execute, and thus no output is printed.

This is explained in the README under the "what's not displayed" section here: https://github.com/mattbrictson/airbrussh#whats-not-displayed

If you'd like to see every individual action that Capistrano is performing, including tests, then I would suggest using the :pretty formatter instead of Airbrussh.