Last Updated: September 09, 2019
·
3.585K
· petems

Stop Capistrano default tasks for non-rails apps

I was getting errors when using I was using capistrano to deploy a non-rails app:

*** [err :: 192.168.33.22] find:
*** [err :: 192.168.33.22] `/home/petems/fakerepo/releases/20130227170824/public/images'
*** [err :: 192.168.33.22] : No such file or directory
*** [err :: 192.168.33.22]
*** [err :: 192.168.33.22] find:
*** [err :: 192.168.33.22] `/home/petems/fakerepo/releases/20130227170824/public/stylesheets'
*** [err :: 192.168.33.22] : No such file or directory
*** [err :: 192.168.33.22]
*** [err :: 192.168.33.22] find:
*** [err :: 192.168.33.22] `/home/petems/fakerepo/releases/20130227170824/public/javascripts'
*** [err :: 192.168.33.22] : No such file or directory
*** [err :: 192.168.33.22]

I forgot that Capistrano runs some tasks by default when you do a deploy

So a quick fix to change that:

# Override default tasks which are not relevant to a non-rails app.
namespace :deploy do
  task :migrate do
    puts "    Not doing migrate because we are not a Rails application."
  end
  task :finalize_update do
    puts "    Not doing finalize_update because we are not a Rails application."
  end
  task :start do ; end
  task :stop do ; end
  task :restart do ; end
end

And viola!

 ** [out :: 192.168.33.22]
command finished in 2539ms
Not doing finalize_update because we are not a Rails application.

If you want a more elegant solution, I've heard some good things about railsless-deploy, a dedicated gem for deploying non-rails apps with Capistrano.

3 Responses
Add your response

For Non rails app deploy, you could use Mina, might be a better fit. (it's probably also better for Rails deployment just as well..)

over 1 year ago ·

Cool, I'm using a few tools that have a dependancy on capistrano, but I like that mina can do simulated deploys! I'll give it a go, thanks @avnerner! :)

over 1 year ago ·
over 1 year ago ·