I use Capistrano 2.15 and Nginx running on DigitalOcean droplet.
Sometimes, especially, when I install new gems or run migrations I need to hard reset my droplet to take my changes into effect.
This does not apply, if I simply change code somewhere, when running
cap deploy:restart
is fine.
Also, when I log in into my machine and run
service nginx restart
it does not help to capture new migrations.
deploy.rb
require "rvm/capistrano"
set :rvm_ruby_string, 'default'
set :rvm_type, :user
require "bundler/capistrano"
server "xx.xx.xx.xx", :web, :app, :db, primary: true
set :application, "xxx"
set :user, "deployer"
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false
set :scm, "git"
set :repository, "git#bitbucket.org:xxx/#{application}.git"
set :branch, "master"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
after "deploy", "deploy:cleanup" # keep only the last 5 releases
namespace :deploy do
%w[start stop restart].each do |command|
desc "#{command} unicorn server"
task command, roles: :app, except: {no_release: true} do
run "/etc/init.d/unicorn_#{application} #{command}"
end
end
task :setup_config, roles: :app do
sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
run "mkdir -p #{shared_path}/config"
put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
puts "Now edit the config files in #{shared_path}."
end
after "deploy:setup", "deploy:setup_config"
task :symlink_config, roles: :app do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
desc "reload the database with seed data"
task :seed do
run "cd #{current_path}; bundle exec rake db:seed RAILS_ENV=#{rails_env}"
end
after "deploy:finalize_update", "deploy:symlink_config"
desc "Make sure local git is in sync with remote."
task :check_revision, roles: :web do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
before "deploy", "deploy:check_revision"
desc "tail production log files"
task :tail_logs, :roles => :app do
trap("INT") { puts 'Interupted'; exit 0; }
run "tail -f #{shared_path}/log/unicorn.log" do |channel, stream, data|
puts # for an extra line break before the host name
puts "#{channel[:host]}: #{data}"
break if stream == :err
end
end
end
namespace :assets do
task :symlink, roles: :web do
run ("rm -rf #{latest_release}/public/assets &&
mkdir -p #{latest_release}/public &&
mkdir -p #{shared_path}/assets &&
ln -s #{shared_path}/assets #{latest_release}/public/assets")
end
end
namespace :uploads do
desc <<-EOD
Creates the upload folders unless they exist
and sets the proper upload permissions.
EOD
task :setup, :except => { :no_release => true } do
dirs = [File.join(shared_path,'uploads' )]
run "#{try_sudo} mkdir -p #{dirs.join(' ')} && #{try_sudo} chmod g+w #{dirs.join(' ')}"
end
desc <<-EOD
[internal] Creates the symlink to uploads shared folder
for the most recently deployed version.
EOD
task :symlink, :except => { :no_release => true } do
run "rm -rf #{release_path}/public/uploads"
run "ln -nfs #{shared_path}/uploads #{release_path}/public/uploads"
end
desc <<-EOD
[internal] Computes uploads directory paths
and registers them in Capistrano environment.
EOD
task :register_dirs do
set :uploads_dirs, %w(public/uploads)
set :shared_children, fetch(:shared_children) + fetch(:uploads_dirs)
end
after "deploy:finalize_update", "uploads:symlink"
on :start, "uploads:register_dirs"
end
Here is unicorn_init:
http://pastebin.com/cm6NCupK
when you deploy you use cap:deploy?
you use unicorn or passenger?
please paste your code here deploy.rb unicorn.rb(if you use unicorn) and unicorn_init.sh(or your sh file you create symlink from)
last question you use before_fork after_fork?(for zero downtime deploy?)
Related
I have to build stop when unit test fail through docker file. I am using .NET Framework (not Dot.Net Core). I have to write command either in power shell script or Docker file (if Unit test fail then build should be stop before execute next line of docker file.
.NET Framework 4.7.2
Docker Window container only
Unit test project (Nunit)
Asp.Net WebForms (old)
Nunit test runner
Steps,
I have create project for Unit test + WebForm + Class library.
I have created powershell script for run unit test project using Nunit test runner.
I have added path for script in docker file.
I have attached Docker file and power-shell script .
Docker file code here
`# escape=`
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-20200512-windowsservercore-ltsc2019
WORKDIR /src
COPY ./POC.Web/POC.Web.csproj ./POC.Web/
COPY ./POC.Entites/POC.Entites.csproj ./POC.Entites/
COPY ./POC.Business.Layer/POC.Business.Layer.csproj ./POC.Business.Layer/
COPY ./POC.UnitTests/POC.UnitTests.csproj ./POC.UnitTests/
COPY ./POC.UnitTests/packages.config ./POC.UnitTests/
COPY ./MttcPoc.sln .
RUN nuget restore MttcPoc.sln
COPY . .
RUN msbuild POC.UnitTests/POC.UnitTests.csproj /p:OutputPath=c:/out/tests
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
# testResult variable using in shellscript to get the result of unit test
ENV testResult="Passed"
RUN nuget install NUnit.Runners
COPY ./startuptest.ps1 /
RUN /startuptest.ps1
#RUN IF $testResult == "Passed" EXIT 0 ELSE EXIT -1
RUN if [ "$testResult" = "Passed" ] ; then true ; else false; fi
ENTRYPOINT ["powershell", "/startuptest.ps1"]
#*****************************************************
#Below line should not execute if unit test fail
FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-20200512-windowsservercore-ltsc2019
ENV APP_ROOT=/inetpub/wwwroot `
CONNECTIONSTRINGS_CONFIG_MAP="" `
dockercomposeKey="From Docker file"
WORKDIR ${APP_ROOT}
RUN Import-Module WebAdministration; `
Set-ItemProperty -Path 'IIS:\AppPools\DefaultAppPool' -Name processModel.identityType -Value LocalSystem; `
New-WebApplication -Name 'app' -Site 'Default Web Site' -PhysicalPath $env:APP_ROOT
COPY ./startup.ps1 /
RUN /startup.ps1
#ENTRYPOINT ["powershell", "/startup.ps1"]
COPY --from=build c:/out/_PublishedWebsites/POC.Web ${APP_ROOT}
#************************************************************************`
Powershell script code here
$ProjectDir = "."
$OutDir = "$ProjectDir\testresults"
$testProjectPath = "c:\out\tests\POC.UnitTests.dll"
# Set nunit path test runner
$nunit_path = "$ProjectDir\NUnit.ConsoleRunner.3.11.1\tools\nunit3-console.exe"
# Run NUnit3 tests
& $nunit_path $testProjectPath --framework=net-4.7.2 --work=$OutDir
[XML]$resultDetails = Get-Content .\$OutDir\TestResult.xml
Write-Output $resultDetails
$string = "test-run"
Write-Output $resultDetails.$string.result
$env:testResult = $resultDetails.$string.result
#Passed
#Failed
#Below line added for if test fail then exit from docker build
If ($resultDetails.$string.result -eq 'Passed') {
Write-Output "Test passed"
Write-Output $env:testResult
return true
}else{
Write-Output "Test failed"
Write-Output $env:testResult
return -1
}
I use capifony with symfony 2.
My deploy.rb
set :application, "Name project"
set :domain, "My Ip"
set :deploy_to, "My folder"
set :app_path, "app"
set :repository, "git#bitbucket.org:dou/test.git"
set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, or `none`
set :model_manager, "doctrine"
# Or: `propel`
set :shared_files, ["app/config/parameters.yml"]
set :shared_children, [app_path + "/logs", web_path + "/uploads", web_path + "/media", "vendor"]
set :use_composer, true
#set :composer_options, "--prefer-source --no-interaction"
set :deploy_via, :copy
set :branch, "master"
set :user, 'user'
set :password, 'pass'
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 :use_sudo, false
set :update_vendors, true
# Be more verbose by uncommenting the following line
logger.level = Logger::MAX_LEVEL
#set :dump_assetic_assets, true
set :ssh_options, { :forward_agent => true }
default_run_options[:pty] = true
And it was all ok. But yesterday I had an error.
* 2013-12-10 11:51:23 executing `symfony:cache:warmup'
--> Warming up cache
* executing "sh -c 'cd /home/myproject/beta/releases/20131210094811 && php app/console cache:warmup --env=prod --no-debug'"
servers: ["IP"]
[IP] executing command
** [out :: IP] Warming up the cache for the prod environment with debug false
command finished in 18712ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/myproject/beta/releases/20131210094811; true"
servers: ["IP"]
[IP] executing command
command finished in 633ms
failed: "sh -c 'sh -c '\\''cd /home/myproject/beta/releases/20131210094811 && php app/console cache:warmup --env=prod --no-debug'\\'''" on IP
Capifony try clear cache for prod, but it can't.So Can I see somehow error, why it can't clear cache? It clear cache for dev, but for prod it fails without any error for me.
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, "git#github.com: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 git#github.com:haji/sommelier.git master"
command finished in 2798ms
* executing "git clone -q -b master git#github.com: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.
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
i'm trying to deploy a new site and i don't understand why i have some weird errors.
My first error is:
Users/Epok/.rvm/gems/ruby-1.9.3-p448/gems/capifony-2.2.10/lib/capifony_symfony1.rb:40:in `read': No such file or directory - config/databases.yml (Errno::ENOENT)
from /Users/Epok/.rvm/gems/ruby-1.9.3-p448/gems/capifony-2.2.10/lib/capifony_symfony1.rb:40:in `guess_symfony_orm'
from /Users/Epok/.rvm/gems/ruby-1.9.3-p448/gems/capifony-2.2.10/lib/capifony_symfony1.rb:27:in `block in load'
I don't understand why capifony asking me for database.yml which is a file for Symfony 1 (i think)
So i put : set:use_orm, false (as the documentation say for symfony1 project) and it works but now i have a new error which is :
* executing "sh -c 'cd /usr/share/nginx/www/stackexchange/releases/20130820143357 && php ./symfony cache:clear'"
servers: ["37.187.66.229"]
[37.187.66.229] executing command
** [out :: 37.187.66.229] Could not open input file: ./symfony
command finished in 255ms
*** [deploy:update_code] rolling back
* executing "rm -rf /usr/share/nginx/www/stackexchange/releases/20130820143357; true"
servers: ["37.187.66.229"]
[37.187.66.229] executing command
command finished in 113ms
failed: "sh -c 'sh -c '\\''cd /usr/share/nginx/www/stackexchange/releases/20130820143357 && php ./symfony cache:clear'\\'''" on 37.187.66.229
It's been a long time since i didn't use capifony but i never have this kind of error. I reuse the same file but i certainly miss something. Thanks in advance :)
My deploy file is like this :
# setup server
set :application, "Stackexchange Network"
set :domain, "37.187.66.229"
set :deploy_to, "/usr/share/nginx/www/stackexchange"
role :web, domain
role :app, domain
# git configuration
set :scm, :git
set :branch, "master"
set :repository, "file:///Applications/MAMP/htdocs/6.symfony_project/stackexchange"
set :deploy_via, :copy
ssh_options[:forward_agent] = true
# ssh log
set :user, "user"
set :password, "password"
set :use_sudo, false
set :keep_releases, 3
default_run_options[:pty] = true
# Symfony2 configuration
set :clear_controllers, true
set :controllers_to_clear, ['app_*.php']
set :model_manager, "doctrine"
set :use_orm, false
set :shared_files, ["app/config/parameters.yml"]
set :shared_children, ["app/logs", "app/cache"]
set :use_composer, true
set :update_vendors, true
set :dump_assetic_assets, true
set :writable_dirs, ["app/cache", "app/cache/prod", "app/cache/dev", "app/logs", "vendor"]
set :webserver_user, "www-data"
set :permission_method, :chown
set :use_set_permissions, true
before 'symfony:composer:update', 'symfony:copy_vendors'
after 'symfony:cache:warmup', 'deploy:cleanup'
namespace :symfony do
desc "Copy vendors from previous release"
task :copy_vendors, :except => { :no_release => true } do
if Capistrano::CLI.ui.agree("Do you want to copy last release vendor dir then do composer install ?: (y/N)")
capifony_pretty_print "--> Copying vendors from previous release"
run "cp -a #{previous_release}/vendor #{latest_release}/"
capifony_puts_ok
end
end
end
# logger.level = Logger::INFO
# Be more verbose by uncommenting the following line
logger.level = Logger::MAX_LEVEL
You probably generated the Capfile for symfony 1.x.
Symfony2 Capfile should look something like the following (this is what capifony 2.3.0 generated for me):
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
require 'capifony_symfony2'
load 'app/config/deploy'
If you want to start from the beginning, try forcing Symfony version when capifying your project:
capifony -s 2 .
i have problem with deploying symfony2 app to my server with capifony. I tried to pull with git directly to my server and that works.
here is my deploy.rb file
# Sylius default deployment configuration.
# Capifony documentation: http://capifony.org
# Capistrano documentation: https://github.com/capistrano/capistrano/wiki
# Be more verbose by uncommenting the following line
# logger.level = Logger::MAX_LEVEL
set :application, "myapp"
set :domain, "xx.xx.xx.xx"
set :deploy_to, "/home/user"
set :user, "user"
role :web, domain
role :app, domain
role :db, domain, :primary => true
set :scm, :git
set :repository, "user#xxx.xxx.xxx.xx:/var/www/user/user.git"
set :branch, "master"
set :deploy_via, :remote_cache
ssh_options[:forward_agent] = true
set :use_composer, true
set :update_vendors, true
set :dump_assetic_assets, true
set :writable_dirs, ["app/cache", "app/logs"]
set :webserver_user, "www-data"
set :permission_method, :acl
set :shared_files, ["app/config/parameters.yml", "web/.htaccess", "web/robots.txt"]
set :shared_children, ["app/logs"]
set :model_manager, "doctrine"
set :use_sudo, false
set :keep_releases, 3
before 'symfony:composer:update', 'symfony:copy_vendors'
namespace :symfony do
desc "Copy vendors from previous release"
task :copy_vendors, :except => { :no_release => true } do
if Capistrano::CLI.ui.agree("Do you want to copy last release vendor dir then do composer install ?: (y/N)")
capifony_pretty_print "--> Copying vendors from previous release"
run "cp -a #{previous_release}/vendor #{latest_release}/"
capifony_puts_ok
end
end
end
after "deploy:update", "deploy:cleanup"
after "deploy", "deploy:set_permissions"
and here is my error
failed: "sh -c 'if [ -d /home/user/shared/cached-copy ]; then cd /home/user/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard f90495dc7d5c62d1bc61415b5c10b762a7e96ee6 && git clean -q -d -x -f; else git clone -q -b master user#xx.xx.xx.xx:/var/www/user/user.git /home/user/shared/cached-copy && cd /home/user/shared/cached-copy && git checkout -q -b deploy f90495dc7d5c62d1bc61415b5c10b762a7e96ee6; fi'" on xxx.xxx.xxx.xxx
I also tried to run this on my server directly through ssh and that works well.
Any idea? thnx
You don't seem to have set your SSH password. Either put the setting in your deploy.rb (not recommended) or let capifony ask you for it:
#set :password, "password" # the ssh password
set(:password){ Capistrano::CLI.password_prompt("Type your SSH password for user \"#{user}\": ") }
It's easier to find what's causing your deployment to fail if you increase the log verbosity level using the logger.level setting in your deploy.rb.
# IMPORTANT = 0
# INFO = 1
# DEBUG = 2
# TRACE = 3
# MAX_LEVEL = 3
logger.level = Logger::MAX_LEVEL
( documentation )