Closed brenoperucchi closed 9 years ago
what if you add a within current_path do
method?
task :start do
on roles(:app) do
within current_path do
with rails_env: fetch(:rails_env) do
execute :bundle, :exec, :'script/mailman_daemon start', :args=> :start
end
end
end
end
Because I saw others mailman examples with this syntax. I tried to seek more information about this but I not found.
but you are not telling the task where to run it... the part that is commented in fact does a cd
before running bundle, that should work. But the within
directive does exactly that, prepends the cd
command to the execute command
If I running the second part was commented the show me the bundle not found
on roles(:app) do
with rails_env: fetch(:rails_env) do
# execute :bundle, :exec, :'script/mailman_daemon start'
execute "cd #{fetch(:deploy_to)}/current/; RAILS_ENV=#{fetch(:environment)} bundle exec script/mailman_daemon start", raise_on_non_zero_exit: false
end
end
$ cap mailman:start
DEBUG[bb9e603e] Running /usr/bin/env [ -d ~/.rbenv/versions/2.2.0 ] on gestor.imentore.com.br
DEBUG[bb9e603e] Command: [ -d ~/.rbenv/versions/2.2.0 ]
DEBUG[bb9e603e] Finished in 2.004 seconds with exit status 0 (successful).
INFO[239b7946] Running /usr/bin/env cd /home/app/current/; RAILS_ENV= bundle exec script/mailman_daemon start on gestor.imentore.com.br
DEBUG[239b7946] Command: cd /home/app/current/; RAILS_ENV= bundle exec script/mailman_daemon start
INFO[239b7946] Finished in 0.302 seconds with exit status 127 (failed).
DEBUG[239b7946] bash: bundle: command not found
INFO[239b7946] Finished in 0.302 seconds with exit status 127 (failed).
brenoperucchi at new-host-5 in ~/Google Drive/03 - Apps/gestor on master*
that is because you are passing the bundle command as a string, you need to pass it as a symbol in order for sshkit to be able to use the mapped bundle command.. (sshkit would call bundle with the absolute path)
Have you tried using the within
directive I mention earlier?? just wrap the with_env
directive with within current_path do
for what I see it should work.
I updated my last comment with the last code I used. Could you write the syntax that you mentioned?
It is in the first comment I made...here it is again
task :start do
on roles(:app) do
within current_path do
with rails_env: fetch(:rails_env) do
execute :bundle, :exec, :'script/mailman_daemon start', :args=> :start
end
end
end
end
thanks so much!
:+1:
Using rbenv gem 'capistrano', '~> 3.4.0' gem 'capistrano-rails', '~> 1.1.3' gem 'capistrano-bundler', '~> 1.1.4' gem 'capistrano-rbenv', '~> 2.0.3'
set :rbenv_type, :user # or :system, depends on your rbenv setup set :rbenv_ruby, "2.2.0" set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec" set :rbenv_map_bins, %w{rake gem bundle ruby rails} set :rbenv_roles, :all # default value
When I try execute mailman_daemon with capistrano I have this error. I'm with this for two days. The command "bundle exec mailman_daemon start" works on console