Ticket #78 (closed defect: fixed)

Opened 7 months ago

Last modified 2 months ago

Verbose Git Pulls Seem to timeout deployment

Reported by: BenHill Owned by: jweiss
Priority: major Milestone:
Component: component1 Version:
Keywords: Cc:

Description

So here is the deal:

I have my config set up for git to pull from a github repository.

Everything seems to go well, except every time the buffer refreshes, it shows a new percentage of completion:

** [out] remote: 2% (34/1691) done ** [out] remote: 3% (51/1691) done ** [out] remote: 4% (68/1691) done ** [out] remote: 5% (85/1691) done ** [out] remote: 6% (102/1691) done ** [out] remote: 7% (119/1691) done ** [out] remote: 8% (136/1691) done

...so it becomes very verbose and fills the buffer rapidly.

Then, around 5 seconds into it, the buffer stops refreshing and the deployment seems to just hang with the status spinner spinning.

My cap file:

load 'deploy'

# ================================================================ # ROLES # ================================================================

role :app, "frodo.revworks.biz"

role :db, "frodo.revworks.biz", {:primary=>true}

role :www, "frodo.revworks.biz"

# ================================================================ # VARIABLES # ================================================================

# Webistrano defaults

set :webistrano_project, "test_2" set :webistrano_stage, "dev"

set :apache_init_script, "/etc/init.d/apache2"

set :application, "test_2"

set :user, "XXXXXX"

set :deploy_to, "/var/www/test"

set :deploy_via, :checkout

set :mod_rails_restart_file, "XXXXX"

set :password, "XXXXX"

set :rails_env, "production"

set :repository, "git@…:RevWorks?/fringe_submit.git"

set :runner, "benhill"

set :scm, "git"

set :use_sudo, true

# ================================================================ # TEMPLATE TASKS # ================================================================

# allocate a pty by default as some systems have problems without default_run_options[:pty] = true

# set Net::SSH ssh options through normal variables # at the moment only one SSH key is supported as arrays are not # parsed correctly by Webistrano::Deployer.type_cast (they end up as strings) [:ssh_port, :ssh_keys].each do |ssh_opt|

if exists? ssh_opt

logger.important("SSH options: setting #{ssh_opt} to: #{fetch(ssh_opt)}") ssh_options[ssh_opt.to_s.gsub(/ssh_/, ).to_sym] = fetch(ssh_opt)

end

end

namespace :webistrano do

namespace :mod_rails do

desc "start mod_rails & Apache" task :start, :roles => :app, :except => { :no_release => true } do

as = fetch(:runner, "app") invoke_command "#{apache_init_script} start", :via => run_method, :as => as

end

desc "stop mod_rails & Apache" task :stop, :roles => :app, :except => { :no_release => true } do

as = fetch(:runner, "app") invoke_command "#{apache_init_script} stop", :via => run_method, :as => as

end

desc "restart mod_rails" task :restart, :roles => :app, :except => { :no_release => true } do

as = fetch(:runner, "app") invoke_command "touch #{mod_rails_restart_file}", :via => run_method, :as => as

end

end

end

namespace :deploy do

task :restart, :roles => :app, :except => { :no_release => true } do

webistrano.mod_rails.restart

end

task :start, :roles => :app, :except => { :no_release => true } do

webistrano.mod_rails.start

end

task :stop, :roles => :app, :except => { :no_release => true } do

webistrano.mod_rails.stop

end

end

# ================================================================ # CUSTOM RECIPES # ================================================================

Change History

Changed 7 months ago by jweiss

  • owner changed from somebody to jweiss

Is it the log output getting very very long? If so, are you using MySQL?

It could be, that you are experiencing #4

That means that the log ouput is longer than MySQLs TEXT

Changed 7 months ago by BenHill

Yes, we are using MySQL....and this issue looks quite similar.

Hmmm....so what's the workaround here? Changing the column to LongText??

Changed 7 months ago by jweiss

Yes, can you please test if this solves your problem?

Changed 7 months ago by BenHill

Ok, so I altered the deployments table to use longtext for the log column. Still no love. The buffer times out about 20 seconds into the update_code task.

Changed 7 months ago by BenHill

Yeah so with each percentage tick of the git clone it lists it in the refreshing buffer. 1%...2%....3%....4%

I was thinking that a hacky work-around may be running git in silent mode....

Changed 7 months ago by BenHill

yes...just ran this query on several of the records in the deployments table:

select length(log) from deployments

all of them seem to be around 8000 characters long (some a little less, some a little more).

This is happening even after I altered the "log" column to the longtext type.

Changed 7 months ago by jweiss

have you tried to pass git some 'quiet' flags?

Changed 7 months ago by BenHill

hmmm...trying to figure out the best way to do that. Would you say I should create a recipe to override the "update_code" task, and add the "-q" arg to the git clone command?

Btw...my compliments on the great app. I suspect it is going to explode soon. Can't wait to get it working.

Changed 7 months ago by jweiss

Yes, you creating a new update_code recipe should hopefully fix your problem.

Changed 7 months ago by BenHill

Ok, got it working by adding this recipe:

namespace :deploy do

task :update_code do

run "git clone -q #{repository} #{release_path}"

end

end

Thanks for your help! It's still not a beautiful log (has all the percentages still), but it does work.

Changed 7 months ago by BenHill

Added a line to include the branch checkout:

namespace :deploy do

task :update_code do

run "git clone -q #{repository} #{release_path}" run "cd #{release_path} && git checkout #{branch}"

end

end

Changed 7 months ago by jweiss

good to know that you got it working. You could supply a patch to Capistrano in order to make the -q a default.

Changed 2 months ago by jweiss

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.