'An error occurred when executing the "'cache:clear --no-warmup'" command' with capifony

1.6k views Asked by At

I am trying to deploy with capifony, but when I run

$ cap deploy

It returns an error

--> Updating code base with remote_cache strategy
Password: 
--> Creating cache directory................................✔
--> Creating symlinks for shared directories................✔
--> Creating symlinks for shared files......................✔
--> Normalizing asset timestamps............................✔
--> Updating Composer.......................................✔
--> Updating Composer dependencies..........................✘
*** [err :: som.info] 
*** [err :: som.info] [RuntimeException]
*** [err :: som.info] An error occurred when executing the "'cache:clear --no-warmup'" command.

*** [err :: som.info] Exception trace:
*** [err :: som.info] () at /home/yamaken/som.info/shared/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:182
*** [err :: som.info] Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::executeCommand() at /home/yamaken/som.info/shared/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:62

.....

This is my deploy.rb

set :application, "sommelier"
set :domain,      "som.info"
set :deploy_to,   "/home/yamaken/#{domain}"
set :app_path,    "app"

set :repository,  "[email protected]:haji/sommelier.git"
set :scm,         :git

set :default_shell,         "TERM=dumb sudo -u yamaken /bin/sh"

set :branch, "master"

set :scm_username, "haji"
set :scm_passphrase, "********"

set   :use_sudo,      false

set :user, 'yamaken'

set :model_manager, "doctrine"
# Or: `propel`

role :web,        domain                         # Your HTTP server, Apache/etc
role :app,        domain, :primary => true       # This may be the same as your `Web` server

set  :keep_releases,  3
set :shared_files,        ["app/config/parameters.yml"]
set :shared_children,     [app_path + "/spool",app_path + "/logs", web_path + "/uploads","vendor"]


set :writable_dirs,       ["app/cache", "app/logs","app/spool"]
set :permission_method,   :chown #
set :use_set_permissions, false

I have tried the code according to @nifr suggestion.

$ _DEBUG=1 cap deploy
Ruby Version                      => 1.8.7-p358
OpenSSL::Version                  => OpenSSL 0.9.8y 5 Feb 2013
Net::SSH::Version::CURRENT        => 2.6.8
Net::SSH -> Local platform        => unix
Password: 
Remote Whoami                     => yamaken
umask on Server                   => 0022
$SHELL                            => /bin/bash
$BASH_VERSION                     => 4.1.5(1)-release
Interactive Shell - Test: $PS1    => no
  * 2013-12-04 11:45:36 executing `deploy'
  * 2013-12-04 11:45:36 executing `deploy:update'
 ** transaction: start
  * 2013-12-04 11:45:36 executing `deploy:update_code'
    triggering before callbacks for `deploy:update_code'
--> Updating code base with checkout strategy
    executing locally: "git ls-remote [email protected]:haji/sommelier.git master"
    command finished in 2798ms
  * executing "git clone -q -b master [email protected]:haji/sommelier.git /home/yamaken/som.info/releases/20131204024539 && cd /home/yamaken/som.info/releases/20131204024539 && git checkout -q -b deploy 1ab8525ef883da0826b6b3d08a1c98da1904edd2 && (echo 1ab8525ef883da0826b6b3d08a1c98da1904edd2 > /home/yamaken/som.info/releases/20131204024539/REVISION)"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 24263ms
  * 2013-12-04 11:46:03 executing `deploy:finalize_update'
  * executing "chmod -R g+w /home/yamaken/som.info/releases/20131204024539"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 556ms
--> Creating cache directory
  * executing "sh -c 'if [ -d /home/yamaken/som.info/releases/20131204024539/app/cache ] ; then rm -rf /home/yamaken/som.info/releases/20131204024539/app/cache; fi'"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 374ms
  * executing "sh -c 'mkdir -p /home/yamaken/som.info/releases/20131204024539/app/cache && chmod -R 0777 /home/yamaken/som.info/releases/20131204024539/app/cache'"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 383ms
  * executing "chmod -R g+w /home/yamaken/som.info/releases/20131204024539/app/cache"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 365ms
  * 2013-12-04 11:46:05 executing `deploy:share_childs'
--> Creating symlinks for shared directories
  * executing "mkdir -p /home/yamaken/som.info/shared/app/spool"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 370ms
  * executing "sh -c 'if [ -d /home/yamaken/som.info/releases/20131204024539/app/spool ] ; then rm -rf /home/yamaken/som.info/releases/20131204024539/app/spool; fi'"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 373ms
  * executing "ln -nfs /home/yamaken/som.info/shared/app/spool /home/yamaken/som.info/releases/20131204024539/app/spool"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 372ms
  * executing "mkdir -p /home/yamaken/som.info/shared/app/logs"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 369ms
  * executing "sh -c 'if [ -d /home/yamaken/som.info/releases/20131204024539/app/logs ] ; then rm -rf /home/yamaken/som.info/releases/20131204024539/app/logs; fi'"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 366ms
  * executing "ln -nfs /home/yamaken/som.info/shared/app/logs /home/yamaken/som.info/releases/20131204024539/app/logs"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 376ms
  * executing "mkdir -p /home/yamaken/som.info/shared/web/uploads"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 373ms
  * executing "sh -c 'if [ -d /home/yamaken/som.info/releases/20131204024539/web/uploads ] ; then rm -rf /home/yamaken/som.info/releases/20131204024539/web/uploads; fi'"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 401ms
  * executing "ln -nfs /home/yamaken/som.info/shared/web/uploads /home/yamaken/som.info/releases/20131204024539/web/uploads"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 375ms
  * executing "mkdir -p /home/yamaken/som.info/shared/vendor"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 375ms
  * executing "sh -c 'if [ -d /home/yamaken/som.info/releases/20131204024539/vendor ] ; then rm -rf /home/yamaken/som.info/releases/20131204024539/vendor; fi'"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 969ms
  * executing "ln -nfs /home/yamaken/som.info/shared/vendor /home/yamaken/som.info/releases/20131204024539/vendor"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 366ms
--> Creating symlinks for shared files
  * executing "mkdir -p /home/yamaken/som.info/shared/app/config"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 366ms
  * executing "touch /home/yamaken/som.info/shared/app/config/parameters.yml"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 378ms
  * executing "ln -nfs /home/yamaken/som.info/shared/app/config/parameters.yml /home/yamaken/som.info/releases/20131204024539/app/config/parameters.yml"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 393ms
--> Normalizing asset timestamps
  * executing "find /home/yamaken/som.info/releases/20131204024539/web/css /home/yamaken/som.info/releases/20131204024539/web/images /home/yamaken/som.info/releases/20131204024539/web/js -exec touch -t 201312040246.11 {} ';' &> /dev/null || true"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 383ms
    triggering after callbacks for `deploy:finalize_update'
  * 2013-12-04 11:46:12 executing `symfony:cache:warmup'
--> Warming up cache
  * executing "sh -c 'cd /home/yamaken/som.info/releases/20131204024539 && php app/console cache:warmup --env=prod --no-debug'"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 530ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/yamaken/som.info/releases/20131204024539; true"
    servers: ["som.info"]
    [som.info] executing command
    command finished in 536ms
failed: "TERM=dumb sudo -u yamaken /bin/sh -c 'sh -c '\\''cd /home/yamaken/som.info/releases/20131204024539 && php app/console cache:warmup --env=prod --no-debug'\\'''" on som.info

I have another quesion, there is the way for not doing the line below after deploy fails?

executing "rm -rf /home/yamaken/som.info/releases/20131204024539; true"

If I can remain the fils on the server. I can check the cause by manual operation.

1

There are 1 answers

3
Nicolai Fröhlich On BEST ANSWER

Debugging Capistrano deployments:

A little trick i came up with to ease debugging is to use an environment variable to switch verbose output and some extra information on and off.

You can add something like this to your deploy.rb (extend or shorten if you like)...

unless ENV['_DEBUG'].nil?
    puts "Ruby Version                      => #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
    puts "OpenSSL::Version                  => #{OpenSSL::OPENSSL_VERSION}"
    puts "Net::SSH::Version::CURRENT        => #{Net::SSH::Version::CURRENT}"
    puts "Net::SSH -> Local platform        => #{Net::SSH::Authentication::PLATFORM}"
    puts "Remote Whoami                     => #{capture 'whoami'}"
    puts "umask on Server                   => #{capture 'umask'}"
    puts "$SHELL                            => #{capture 'echo $SHELL'}"
    puts "$BASH_VERSION                     => #{capture 'echo $BASH_VERSION'}"
    puts "Interactive Shell - Test: $PS1    => #{capture 'if [ -z "$PS1" ]; then echo no; else echo yes; fi'}"

    logger.level =          Logger::MAX_LEVEL
    ssh_options[:verbose] = :debug 
end

Now execute:

_DEBUG=1 cap deploy