Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build task 'deploy:migrations'

I'm trying to execute Capistrano deploy with migrations, but I've got the following error:

cap aborted!
Don't know how to build task 'deploy:migrations'
/Users/marya/.rvm/gems/ruby-1.9.3-p448/gems/capistrano-3.2.1/lib/capistrano/application.rb:15:in `run'
/Users/marya/.rvm/gems/ruby-1.9.3-p448/gems/capistrano-3.2.1/bin/cap:3:in `<top (required)>'
/Users/marya/.rvm/gems/ruby-1.9.3-p448/bin/cap:23:in `load'
/Users/marya/.rvm/gems/ruby-1.9.3-p448/bin/cap:23:in `<main>'
(See full trace by running task with --trace)

Gemfile:

# Use Capistrano to deploy on production server
group :development do
  gem 'capistrano',  '~> 3.2.0'
  gem 'capistrano-rails'
  gem 'capistrano-bundler'
  gem 'capistrano-rvm'
end

deploy.rb:

# config valid only for Capistrano 3.1
lock '3.2.1'

set :application, 'someapp'

set :scm, :git
set :repo_url, 'somerepo'

# Default branch is :master
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call

# Default deploy_to directory is /var/www/my_app
# set :deploy_to, '/var/www/my_app'

# Default value for :scm is :git
# set :scm, :git

# Default value for :format is :pretty
# set :format, :pretty

# Default value for :log_level is :debug
# set :log_level, :debug

# Default value for :pty is false
# set :pty, true

# Default value for :linked_files is []
# set :linked_files, %w{config/database.yml}

# Default value for linked_dirs is []
# set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}

# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }

# Default value for keep_releases is 5
# set :keep_releases, 5

namespace :deploy do

  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      # Your restart mechanism here, for example:
      execute :touch, release_path.join('tmp/restart.txt')
    end
  end

  after :publishing, :restart
end

capfile.rb:

# Load DSL and Setup Up Stages
require 'capistrano/setup'

# Includes default deployment tasks
require 'capistrano/deploy'

# Includes tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
#   https://github.com/capistrano/rvm
#   https://github.com/capistrano/rbenv
#   https://github.com/capistrano/chruby
#   https://github.com/capistrano/bundler
#   https://github.com/capistrano/rails
#
require 'capistrano/rvm'
# require 'capistrano/rbenv'
# require 'capistrano/chruby'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

If I execute 'cap production deploy' then everything works good. How can I fix it?

like image 450
malcoauri Avatar asked May 30 '14 08:05

malcoauri


1 Answers

There's no such task anymore, indeed. When you run deploy task, it will already run migration.

like image 129
filipebarcos Avatar answered Oct 18 '22 10:10

filipebarcos