TalkingQuickly / capistrano-3-rails-template

Template for deploying Rails applications with Capistrano 3
270 stars 149 forks source link

Error on deploy #27

Open Frank004 opened 10 years ago

Frank004 commented 10 years ago
       IfranK$cap production deploy:setup_config
       DEBUG[c72065e8] Running /usr/bin/env [ -f /etc/nginx/sites-enabled/default ] on host [name]
       DEBUG[c72065e8] Command: [ -f /etc/nginx/sites-enabled/default ]
       DEBUG[c72065e8] Finished in 2.661 seconds with exit status 1 (failed).
       No default Nginx Virtualhost to remove
       INFO[08d8c147] Running /usr/bin/env mkdir -p /home/hbquality/apps/HBM_production/shared/config on host [name]
      DEBUG[08d8c147] Command: /usr/bin/env mkdir -p /home/hbquality/apps/HBM_production/shared/config
      INFO[08d8c147] Finished in 0.418 seconds with exit status 0 (successful).
      DEBUGUploading /home/hbquality/apps/HBM_production/shared/config/nginx.conf 0.0% 
      INFOUploading /home/hbquality/apps/HBM_production/shared/config/nginx.conf 100.0%
      INFOcopying: #<StringIO:0x007ffaf1222420> to: /home/hbquality/apps/HBM_production/shared/config/nginx.conf
     DEBUGUploading /home/hbquality/apps/HBM_production/shared/config/log_rotation 0.0% 
     INFOUploading /home/hbquality/apps/HBM_production/shared/config/log_rotation 100.0%
     INFOcopying: #<StringIO:0x007ffaf189b518> to: /home/hbquality/apps/HBM_production/shared/config/log_rotation
    DEBUGUploading /home/hbquality/apps/HBM_production/shared/config/monit 0.0%
    INFOUploading /home/hbquality/apps/HBM_production/shared/config/monit 100.0%
    INFOcopying: #<StringIO:0x007ffaf10ab038> to: /home/hbquality/apps/HBM_production/shared/config/monit
   DEBUGUploading /home/hbquality/apps/HBM_production/shared/config/unicorn.rb 0.0%
   INFOUploading /home/hbquality/apps/HBM_production/shared/config/unicorn.rb 100.0%
   INFOcopying: #<StringIO:0x007ffaf1bbafc8> to: /home/hbquality/apps/HBM_production/shared/config/unicorn.rb
   DEBUGUploading /home/hbquality/apps/HBM_production/shared/config/unicorn_init.sh 0.0%             
    INFOUploading /home/hbquality/apps/HBM_production/shared/config/unicorn_init.sh 100.0%
    INFOcopying: #<StringIO:0x007ffaf1fa6880> to: /home/hbquality/apps/HBM_production/shared/config/unicorn_init.sh
   INFO[e9c0e486] Running /usr/bin/env chmod +x /home/hbquality/apps/HBM_production/shared/config/unicorn_init.sh on host [name]
   DEBUG[e9c0e486] Command: /usr/bin/env chmod +x /home/hbquality/apps/HBM_production/shared/config/unicorn_init.sh
   INFO[e9c0e486] Finished in 0.403 seconds with exit status 0 (successful).
   INFO[5a58fa1e] Running /usr/bin/env sudo ln -nfs /home/hbquality/apps/HBM_production/shared/config/nginx.conf /etc/nginx/sites-enabled/HBM_production on host [name]
   DEBUG[5a58fa1e] Command: /usr/bin/env sudo ln -nfs /home/hbquality/apps/HBM_production/shared/config/nginx.conf /etc/nginx/sites-enabled/HBM_production
   DEBUG[5a58fa1e]  [sudo] password for hbquality: 

   cap aborted!
    SSHKit::Runner::ExecuteError: Exception while executing on host [name]: sudo exit status: 1
    sudo stdout: Nothing written
    sudo stderr: Nothing written
    /Users/IfranK/Desktop/RailsApp/HBM                       Colaboracion/hbm/lib/capistrano/tasks/setup_config.rake:29:in `block (4 levels) in <top (required)>'
    /Users/IfranK/Desktop/RailsApp/HBM Colaboracion/hbm/lib/capistrano/tasks/setup_config.rake:28:in `each'
    /Users/IfranK/Desktop/RailsApp/HBM Colaboracion/hbm/lib/capistrano/tasks/setup_config.rake:28:in `block (3 levels) in <top (required)>'
    SSHKit::Command::Failed: sudo exit status: 1
    sudo stdout: Nothing written
    sudo stderr: Nothing written
    /Users/IfranK/Desktop/RailsApp/HBM Colaboracion/hbm/lib/capistrano/tasks/setup_config.rake:29:in `block (4 levels) in <top (required)>'
    /Users/IfranK/Desktop/RailsApp/HBM Colaboracion/hbm/lib/capistrano/tasks/setup_config.rake:28:in `each'
    /Users/IfranK/Desktop/RailsApp/HBM Colaboracion/hbm/lib/capistrano/tasks/setup_config.rake:28:in `block (3 levels) in <top (required)>'
    Tasks: TOP => deploy:setup_config
FaiqAdam commented 10 years ago

same error cap aborted! SSHKit::Runner::ExecuteError: Exception while executing on host [name]: sudo exit status: 1 sudo stdout: Nothing written

TalkingQuickly commented 10 years ago

Fairly sure that's failing because you've got passwordless sudo disabled and cap3 doesn't play that nicely with that configuration. I think the solution is probably to have a deploy user with passwordless sudo enabled and then a separate app user which doesn't have it enabled. Once I've got something stable I'll update the boom with it but will take a while because means retesting all code in the second half. In the meantime enabling passwordless sudo for the deploy user should fix it. On 31 Aug 2014 12:15, "Faiq Adam" notifications@github.com wrote:

same error cap aborted! SSHKit::Runner::ExecuteError: Exception while executing on host [name]: sudo exit status: 1 sudo stdout: Nothing written

— Reply to this email directly or view it on GitHub https://github.com/TalkingQuickly/capistrano-3-rails-template/issues/27#issuecomment-53984779 .

joassouza commented 10 years ago

I think this solution is quite good...

me@localhost $ ssh root@remote

Capistrano will use /var/www/....... where ... is the value set in

# :application, you can override this by setting the ':deploy_to' variable
root@remote $ deploy_to=/var/www/rails3-bootstrap-devise-cancan-demo
root@remote $ mkdir -p ${deploy_to}
root@remote $ chown deploy:deploy ${deploy_to}
root@remote $ umask 0002
root@remote $ chmod g+s ${deploy_to}
root@remote $ mkdir ${deploy_to}/{releases,shared}
root@remote $ chown deploy ${deploy_to}/{releases,shared}

more info about it in http://capistranorb.com/documentation/getting-started/authentication-and-authorisation/