Capistrano cannot find SVN client - capistrano

I have an SVN client locally and on the Solaris production server, and they are in my path, so when I type svn somethng the command is found (my PC and Solaris).
This is the error:
C:\dev\apps>cap deploy:migrations
* executing `deploy:migrations'
* executing `deploy:update_code'
executing locally: "svn info https://svn.domain.co.uk/svn/apps -rHEAD"
*** executable 'svn' not present or not in $PATH on the local system!
* executing "svn checkout -q -r6 https://svn.domain.co.uk/svn/apps /sites/r
ails-data/apps/releases/20100120114312 && (echo 6 > /sites/rails-data/apps/relea
ses/20100120114312/REVISION)"
servers: ["solaris001.ds.domain.com"]
Password:
[solaris001.ds.domain.com] executing command
** [solaris001.ds.domain.com :: err] ld.so.1: svn: fatal: libaprutil-1.so.
0: open failed: No such file or directory
** [solaris001.ds.domain.com :: err] Killed
command finished
failed: "sh -c 'svn checkout -q -r6 https://svn.domain.co.uk/svn/apps /sites/
rails-data/apps/releases/20100120114312 && (echo 6 > /sites/rails-data/apps/rele
ases/20100120114312/REVISION)'" on solaris001.ds.domain.com
In my PC and in Solaris I can successfully run the commands that Capistrano is unable it cannot find the library and the executable.
This is my recipe:
set :application, "apps"
set :user, 'me'
set :domain, "solaris001.ds.domain.com"
set :repository, "https://svn.domain.co.uk/svn/apps"
set :use_sudo, false
set :deploy_to, "/sites/rails-data/#{application}"
role :app, domain
role :web, domain
namespace :deploy do
task :start, :roles => :app do
run "touch #{current_release}/tmp/restart.txt"
end
task :stop, :roles => :app do
# Do nothing.
end
desc "Restart Application"
task :restart, :roles => :app do
run "touch #{current_release}/tmp/restart.txt"
end
end

The solution: http://riccardotacconi.blogspot.com/2010/01/rails-deployment-with-capistrano-and.html

Related

poky/meta/recipes-devtools/opkg-utils/opkg-utils_git.bb, do_unpack) failed with exit code '1'

I'm new in using yocto.
my environment is ubuntu 14.04,
Build Configuration:
BB_VERSION = "1.28.0"
BUILD_SYS "x86_64-linux"
NATIVELSBSTRING "Ubuntu-14.04"
TARGET_SYS "aarch64-fsl-linux"
MACHINE "ls1043aqds"
DISTRO "fsl-qoriq"
DISTRO_VERSION "2.0"
TUNE_FEATURES "aarch64"
TARGET_FPU ""
I get the following error when running :
bitbake fsl-image-minimal
(on every call to bitbake build )
=====================
DEBUG: Running export SSH_AUTH_SOCK="/run/user/1001/keyring-an3Qaa/ssh"; export PATH="/opt/disk1/LS1043-Install/SDK/QorIQ-SDK-V2.0-20160527-yocto/sources/poky/scripts:/opt/disk1/LS1043-Install/SDK/QorIQ-SDK-V2.0-20160527-yocto/build_ls1043aqds/tmp/sysroots/x86_64-linux/usr/bin/aarch64-fsl-linux:/opt/disk1/LS1043-Install/SDK/QorIQ-SDK-V2.0-20160527-yocto/build_ls1043aqds/tmp/sysroots/ls1043aqds/usr/bin/crossscripts:/opt/disk1/LS1043-Install/SDK/QorIQ-SDK-V2.0-20160527-yocto/build_ls1043aqds/tmp/sysroots/x86_64-linux/usr/sbin:/opt/disk1/LS1043-Install/SDK/QorIQ-SDK-V2.0-20160527-yocto/build_ls1043aqds/tmp/sysroots/x86_64-linux/usr/bin:/opt/disk1/LS1043-Install/SDK/QorIQ-SDK-V2.0-20160527-yocto/build_ls1043aqds/tmp/sysroots/x86_64-linux/sbin:/opt/disk1/LS1043-Install/SDK/QorIQ-SDK-V2.0-20160527-yocto/build_ls1043aqds/tmp/sysroots/x86_64-linux/bin:/opt/disk1/LS1043-Install/SDK/QorIQ-SDK-V2.0-20160527-yocto/sources/poky/scripts:/opt/disk1/LS1043-Install/SDK/QorIQ-SDK-V2.0-20160527-yocto/sources/poky/bitbake/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"; export HOME="/home/ymarko"; git -c core.fsyncobjectfiles=0 branch --set-upstream master origin/master
| DEBUG: Python function base_do_unpack finished
| DEBUG: Python function do_unpack finished
| ERROR: Function failed: Fetcher failure: Fetch command failed with exit code 128, output:
| fatal: the '--set-upstream' option is no longer supported. Please use '--track' or '--set-upstream-to' instead.
|
ERROR: Task 854 (/opt/disk1/LS1043-Install/SDK/QorIQ-SDK-V2.0-20160527-yocto/sources/poky/meta/recipes-devtools/opkg-utils/opkg-utils_git.bb, do_unpack) failed with exit code '1'
NOTE: Tasks Summary: Attempted 306 tasks of which 298 didn't need to be rerun and 1 failed.
Waiting for 0 running tasks to finish:
================================
Can you help please?
Try upgrading your version of git to 2.7.3. I was having the same problem and this fixed it
You need this patch in order to fix it.
Pay attention, you can't simply add "-to" as a suffix. The order of arguments also reversed.
Example how to use:
curl https://patchwork.openembedded.org/patch/145072/raw/ | git apply -v

Capistrano error on rake assets:precompile:all but still working (using RVM)

I've made a new Rails 3.2 application. When i deploy it with Capistrano, I get an error when compiling assets. But the assets ARE compiled, and the application deployed as it should.
On the server I've installed RVM systemwide and then created:
User: skolemapicture (added to group rvm)
Deploy folder: /home/skolemapicture/site
.rvmrc in /home/skolemapicture/site/.rvmrc
My deploy.rb config looks like this (omitted lines that have nothing to do with the problem)
set :application, "skolemapicture"
set :deploy_to , "/home/skolemapicture/site"
set :user , "skolemapicture"
set :use_sudo , false
ssh_options[:forward_agent] = true
require "bundler/capistrano"
require "rvm/capistrano"
set(:ruby_version) { '1.9.3' }
set(:rvm_ruby_string) { "#{ruby_version}##{application}" }
set(:rvm_path) { "/usr/local/rvm" }
set(:rvm_type) { :system }
namespace :deploy do
task :precompile, :role => :app do
run "cd #{release_path}/ && bundle exec rake assets:precompile"
end
end
after "deploy:finalize_update", "deploy:precompile"
The error i get at "cap deploy" is:
* 2013-02-13 10:36:21 executing `deploy:precompile'
* executing "cd /home/skolemapicture/site/releases/20130213093619/ && bundle exec rake assets:precompile"
servers: ["web01.mapicture.com"]
[web01.mapicture.com] executing command
*** [err :: web01.mapicture.com] /usr/local/rvm/rubies/ruby-1.9.3-p374/bin/ruby /home/skolemapicture/site/shared/bundle/ruby/1.9.1/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
*** [err :: web01.mapicture.com]
But the assets ARE compiled. So why this error?
/ Carsten
It is probably actually precompiling the assets successfully with your custom deploy:precompile task.
It is failing on the capistrano default assets:precompile task.
You will notice that the failed command is
/usr/local/rvm/rubies/ruby-1.9.3-p374/bin/ruby /home/skolemapicture/site/shared/bundle/ruby/1.9.1/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
not your custom precompile task:
cd #{release_path}/ && bundle exec rake assets:precompile
Try removing your deploy:precompile task and adding
load 'deploy/assets'
to your Capfile if it is not already there.
If that doesn't fix it can you post your entire Capfile and deploy.rb?

correct way to create symlink in deploy.rb

I have an error when i deploy an application:
[neon.locum.ru] executing command
*** [err :: neon.locum.ru] find: `/home/hosting_grandinvest/projects/demo/releases/20130116145843/public/images /home/hosting_grandinvest/projects/demo/releases/20130116145843/public/stylesheets /home/hosting_grandinvest/projects/demo/releases/20130116145843/public/javascripts': Нет такого файла или каталога
command finished in 91ms
triggering after callbacks for `deploy:update_code'
* 2013-01-16 16:58:45 executing `make_images_link'
* executing "ln -s /home/hosting_grandinvest/projects/demo/shared/public/images /home/hosting_grandinvest/projects/demo/releases/20130116145843/public/images"
As you see it's because first it tries to find /public/images dir. and only then creates a symlink for that directory.
beggining of my deploy.rb
require 'bundler/capistrano'
after "deploy:update_code", :make_images_link
task :make_images_link, roles => :app do
images_dir = "#{shared_path}/public/images"
run "ln -s #{images_dir} #{release_path}/public/images"
end
the deploy finishes
Gem.source_index called from /home/hosting_grandinvest/projects/demo/shared/gems/ruby/1.8/gems/rails-2.3.15/lib/rails/gem_dependency.rb:21.
master process ready
worker=0 ready
reaped #<Process::Status: pid=18656,exited(0)> worker=0
master complete
in public/images dir are located some files used by css ( background: url(/images/front/logo.gif) no-repeat 0 0;) and they are Not displayed !but when i try to access these files directly
(http://hosting.net/images/front/logo.gif) i can see them!
Any suggestions on how to solve this error and make capistrano work?
UPDATE 1
I've included public/images/front in repo and after code deployment swap empty folder with a link
after "deploy:update_code", :make_images_link
task :make_images_link, roles => :app do
images_dir = "#{shared_path}/public/images"
realease_images = "#{release_path}/public/images"
run "rm -rf #{realease_images}"
run "ln -s #{images_dir} #{realease_images}"
end
When i deploy error still exists, but images appeared!
In the end i've included 'public'images' dir in my repository.
and as step 2 i run a callback that i've specified in update 1.

Rails: Queue Classic with Capistrano

I want to start Queue Classic (QC) within my Capistrano recipe:
namespace :queue_classic do
desc "Start QC worker"
task :start, roles: :web do
run "cd #{release_path} && RAILS_ENV=production bundle exec rake qc:work"
end
after "deploy:restart", "queue_classic:restart"
end
Capistrano runs the line correctly, so that the QC worker starts, but not as a daemon. As a result Capistrano won't continue to run the recipes.
How can I start the QC worker in the background and let Capistrano finish its tasks?
Thank you!
I use foreman for this:
after "deploy:update", "foreman:export" # Export foreman scripts
after "deploy:restart", "foreman:restart" # Restart application scripts
after "deploy:stop", "foreman:stop" # Restart application scripts
after "deploy:start", "foreman:start"
# Foreman tasks
desc 'Export the Procfile to Ubuntu upstart scripts'
task :export, :roles => :queue do
run "cd #{release_path}; #{sudo} $(rbenv which foreman) export upstart /etc/init -f ./Procfile -a #{application} -u #{user} -l #{release_path}/log/foreman"
end
desc "Start the application services"
task :start, :roles => :queue do
run "#{sudo} start #{application}"
end
desc "Stop the application services"
task :stop, :roles => :queue do
run "#{sudo} stop #{application}"
end
desc "Restart the application services"
task :restart, :roles => :queue do
run "#{sudo} stop #{application}"
run "#{sudo} start #{application}"
#run "sudo start #{application} || sudo restart #{application}"
end
Then in your Procfile put something like
worker: RAILS_ENV=production bundle exec rake qc:work
Use the & sign at the and and put process in background.
run "cd #{release_path} && RAILS_ENV=production bundle exec rake qc:work &"
Killin and restarting is than a bit tricky, but it could be done using ps, grep and kill.

capistrano fails on assets:precompile within cap deploy:cold

I am doing a cap deploy:cold
with the following config/deploy.rb
1 require 'bundler/capistrano'
2
3 set :application, "massiveapp"
4
5 set :scm, :git
6
7 set :repository, "git://github.com/deployingrails/massiveapp.git"
8
9 server "localhost", :web, :app, :db, :primary => true
10
11 ssh_options[:port] = 2222
12 ssh_options[:keys] = "~/.vagrant.d/insecure_private_key"
13
14 set :user, "vagrant"
15 set :group, "vagrant"
16 set :deploy_to, "/var/massiveapp"
17 set :use_sudo, false
18
19 set :deploy_via, :copy
20 set :copy_strategy, :export
21
22 namespace :deploy do
23 task :start do ; end
24 task :stop do ; end
25 desc "Restart the application"
26 task :restart, :roles => :app, :except => { :no_release => true } do
27 run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
28 end
29 desc "Copy the database.yml file into the latest release"
30 task :copy_in_database_yml do
31 run "cp #{shared_path}/config/database.yml #{latest_release}/config/"
32 end
33 end
34 #before "deploy:copy_in_database_yml"
35 before "deploy:assets:precompile", "deploy:copy_in_database_yml"
It all goes fine up to the following at which point it fails.
* executing "cd /var/massiveapp/releases/20120808053801 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
servers: ["localhost"]
[localhost] executing command
*** [err :: localhost] rake aborted!
*** [err :: localhost] (<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1
*** [err :: localhost]
*** [err :: localhost] Tasks: TOP => environment
*** [err :: localhost] (See full trace by running task with --trace)
command finished in 1196ms
*** [deploy:update_code] rolling back
* executing "rm -rf /var/massiveapp/releases/20120808053801; true"
servers: ["localhost"]
[localhost] executing command
command finished in 39ms
I am just learning capistrano and just don't know how to debug this to solve it.
Any help would be much appreciated.
rails 3.2.7 ruby 1.9.3 capistrano 2.12
Problem was caused by a tab character in the database.yml file.
The database.yml file is on the VM located at /var/massiveapp/shared/configs/database.yml.