我想将一个应用程序部署到我的本地服务器.我正在使用capistrano 3.
这是我的capfile
require 'capistrano/setup' require 'capistrano/deploy' require 'capistrano/rvm' require 'capistrano/bundler' require 'capistrano/rails' #require 'capistrano/rails/migrations' #require 'capistrano/rails/assets' # Loads custom tasks from `lib/capistrano/tasks' if you have any defined. Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
这是我的deploy.rb
# config valid only for Capistrano 3.1 lock '3.1.0' set :application,'ImpresaZiliani' set :repo_url,'francesco@10.0.1.8:repos/impresaziliani.git' set :branch,'master' # Default branch is :master # ask :branch,proc { `git rev-parse --abbrev-ref HEAD`.chomp } # Default deploy_to directory is /var/www/my_app set :deploy_to,'/home/francesco/impresaziliani' # Default value for :scm is :git set :scm,:git set :deploy_user,"francesco" set :rails_env,"production" 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 after :restart,:clear_cache do on roles(:web),in: :groups,limit: 3,wait: 10 do # Here we can do anything such as: # within release_path do # execute :rake,'cache:clear' # end end end end set :rvm_ruby_version,'2.1.1' set :default_env,{ rvm_bin_path: '~/.rvm/bin' } SSHKit.config.command_map[:rake] = "#{fetch(:default_env)[:rvm_bin_path]}/rvm ruby-# {fetch(:rvm_ruby_version)} do bundle exec rake"
我的database.yml是好的,因为如果我手动运行服务器上的迁移工作,我已经尝试取消注释capistrano / rails /迁移和资产的行,但没有任何改变:当我部署它运行良好,直到捆绑安装,然后没有任何警告或错误,跳到资产预编译器,并且不运行迁移.
我如何解决这个问题?
谢谢
解决方法
rake db:migrate在capistrano 3中自动部署 您只需要在Capfile中取消注释#require’capistrano / rails / migrations’