Aaron
Aaron

Reputation: 143

Cap Deploy Issues with Rails 3.1.1 and Site5

I have a Rails 3.1.1 app that I am trying to deploy via Capistrano. This is my first attempt at this and I have worked through several issues by doing a lot of research, but I have hit a wall that I can not figure out a way to scale.

I can run cap deploy:setup and cap deploy:check without incident. When I try and run cap deploy this is what I get see bottom (separated text concerning the rake 0.9.2.2 and the failed line at the bottom)

Aaron-Johnsons-Macbook-Pro:webd2 aaronjohnsonis$ cap deploy * executing deploy' * executingdeploy:update' ** transaction: start * executing deploy:update_code' updating the cached checkout on all servers executing locally: "git ls-remote [email protected]:webdsquared/webd2.git master" command finished in 2351ms * executing "if [ -d /home/webdsqua/apps/webd2/shared/cached-copy ]; then cd /home/webdsqua/apps/webd2/shared/cached-copy && git fetch origin && git fetch --tags origin && git reset --hard 28e67c5f7e1ed4612dffd2ac4fb287356f51ce3b && git submodule init && for mod ingit submodule status | awk '{ print $2 }'; do git config -f .git/config submodule.${mod}.urlgit config -f .gitmodules --get submodule.${mod}.url&& echo Synced $mod; done && git submodule sync && export GIT_RECURSIVE=$([ ! \"git --version\" \\< \"git version 1.6.5\" ] && echo --recursive) && git submodule update --init $GIT_RECURSIVE && git clean -d -x -f; else git clone --depth 1 [email protected]:webdsquared/webd2.git /home/webdsqua/apps/webd2/shared/cached-copy && cd /home/webdsqua/apps/webd2/shared/cached-copy && git checkout -b deploy 28e67c5f7e1ed4612dffd2ac4fb287356f51ce3b && git submodule init && git submodule sync && export GIT_RECURSIVE=$([ ! \"git --version\" \\< \"git version 1.6.5\" ] && echo --recursive) && git submodule update --init $GIT_RECURSIVE; fi" servers: ["webdsquared.com"] Password: [webdsquared.com] executing command ** [webdsquared.com :: out] HEAD is now at 28e67c5 initial commit command finished in 2428ms copying the cached version to /home/webdsqua/apps/webd2/releases/20111104183017 * executing "cp -RPp /home/webdsqua/apps/webd2/shared/cached-copy /home/webdsqua/apps/webd2/releases/20111104183017 && (echo 28e67c5f7e1ed4612dffd2ac4fb287356f51ce3b > /home/webdsqua/apps/webd2/releases/20111104183017/REVISION)" servers: ["webdsquared.com"] [webdsquared.com] executing command command finished in 2997ms * executingdeploy:finalize_update' triggering before callbacks for deploy:finalize_update' * executingdeploy:assets:symlink' * executing "rm -rf /home/webdsqua/apps/webd2/releases/20111104183017/public/assets &&\\n mkdir -p /home/webdsqua/apps/webd2/releases/20111104183017/public &&\\n mkdir -p /home/webdsqua/apps/webd2/shared/assets &&\\n ln -s /home/webdsqua/apps/webd2/shared/assets /home/webdsqua/apps/webd2/releases/20111104183017/public/assets" servers: ["webdsquared.com"] [webdsquared.com] executing command command finished in 1104ms * executing "chmod -R g+w /home/webdsqua/apps/webd2/releases/20111104183017" servers: ["webdsquared.com"] [webdsquared.com] executing command command finished in 119ms * executing "rm -rf /home/webdsqua/apps/webd2/releases/20111104183017/log /home/webdsqua/apps/webd2/releases/20111104183017/public/system /home/webdsqua/apps/webd2/releases/20111104183017/tmp/pids &&\\n
mkdir -p /home/webdsqua/apps/webd2/releases/20111104183017/public &&\\n mkdir -p /home/webdsqua/apps/webd2/releases/20111104183017/tmp &&\\n ln -s /home/webdsqua/apps/webd2/shared/log /home/webdsqua/apps/webd2/releases/20111104183017/log &&\\n ln -s /home/webdsqua/apps/webd2/shared/system /home/webdsqua/apps/webd2/releases/20111104183017/public/system &&\\n ln -s /home/webdsqua/apps/webd2/shared/pids /home/webdsqua/apps/webd2/releases/20111104183017/tmp/pids" servers: ["webdsquared.com"] [webdsquared.com] executing command command finished in 3136ms triggering after callbacks for deploy:update_code' * executingdeploy:assets:precompile' * executing "cd /home/webdsqua/apps/webd2/releases/20111104183017 && rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile" servers: ["webdsquared.com"] [webdsquared.com] executing command

** [out :: webdsquared.com] (in /home/webdsqua/apps/webd2/releases/20111104183017) ** [out >:: webdsquared.com] Could not find rake-0.9.2.2 in any of the sources command finished in 1108ms * [deploy:update_code] rolling back * executing "rm -rf /home/webdsqua/apps/webd2/releases/20111104183017; true" servers: ["webdsquared.com"] [webdsquared.com] executing command **command finished in 113ms failed: "sh -c 'cd /home/webdsqua/apps/webd2/releases/20111104183017 && rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'" on webdsquared.com**

My deploy.rb file looks like this...

set :application, "app"
set :repository, "[email protected]:webdsquared/app.git"

set :scm, "git"
set :deploy_to, "/home/username/apps/#{application}"

set :user, "username"
set :use_sudo, false
set :deploy_via, :remote_cache
set :keep_releases, 3
set :normalize_asset_timestamps, false
set :git_enable_submodules, 1
set :branch, "master"
set :git_shallow_clone, 1
set :scm_verbose, true

role :web, "webdsquared.com"                         
role :app, "webdsquared.com"                          
role :db,  "webdsquared.com", :primary => true                      

after "deploy", "deploy:restart"

namespace :deploy do
  task :start do ; end
  task :stop do ; end
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "touch #{File.join(current_path,'tmp','restart.txt')}"
  end
end

The Capfile looks like this...

load 'deploy' if respond_to?(:namespace) # cap2 differentiator

Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }

load 'config/deploy' # remove this line to skip loading any of the default tasks

Any advice would be most appreciated. Has anyone experienced the same thing and found a solution?

Thanks in advance.

Upvotes: 0

Views: 617

Answers (1)

sethvargo
sethvargo

Reputation: 26997

What version of capistrano are you running? Are you using bundler in your application? The problem is that capistrano is not using bundle exec when running commands... It should be running bundle exec rake... not just rake...

Upvotes: 0

Related Questions