部署 使用 Mina 1.0 碰到了点奇怪的问题,求助

ad583255925 · 2018年03月19日 · 最后由 ad583255925 回复于 2018年03月21日 · 856 次阅读

我新建了一个项目,然后安装了mina,版本是1.2.3的,在deploy.rb里面设置了如下参数

set :application_name, 'rails_deploy'
set :domain, 'ubuntu@u1c2g'
set :deploy_to, '/var/www/rails_deploy'
set :repository, 'https://github.com/jiyarong/rails-deploy.git'
set :branch, 'master'

ruby_version = "2.3.1"

task :remote_environment do
  invoke :"rvm:use", ruby_version
end

其他的都没改,都是默认设置,这样子mina setup mina deploy是没问题的 但是我想在shared_path里面再继续加入config里面的若干文件

set :shared_dirs, fetch(:shared_dirs, []).push('config')
set :shared_files, fetch(:shared_files, []).push('config/database.yml', 'config/secrets.yml', 'config/application.rb')

这样子跑deploy就会报错

Creating database
       rake aborted!
       LoadError: cannot load such file -- /var/www/rails_deploy/tmp/build-152143332714966/config/application
       /var/www/rails_deploy/tmp/build-152143332714966/Rakefile:4:in `require_relative'
       /var/www/rails_deploy/tmp/build-152143332714966/Rakefile:4:in `<top (required)>'
       /var/www/rails_deploy/tmp/build-152143332714966/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
       /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/bundler-1.16.1/lib/bundler/cli/exec.rb:75:in `load'
       /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/bundler-1.16.1/lib/bundler/cli/exec.rb:75:in `kernel_load'
       /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/bundler-1.16.1/lib/bundler/cli/exec.rb:28:in `run'
       /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/bundler-1.16.1/lib/bundler/cli.rb:424:in `exec'
       /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/bundler-1.16.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
       /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/bundler-1.16.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
       /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/bundler-1.16.1/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
       /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/bundler-1.16.1/lib/bundler/cli.rb:27:in `dispatch'
       /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/bundler-1.16.1/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
       /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/bundler-1.16.1/lib/bundler/cli.rb:18:in `start'
       Connection to u1c2g closed.

共收到 3 条回复

从报错看,试试检查下config/application.rb是不是存在,不单是源码里,share_dir里也需要存在

@ad583255925 我猜你的服务器上config/application.rb不存在,拷贝本地的config/application.rb到服务器上应该可以解决你的问题。你可以尝试通过下面两种任意一种方法解决:

  1. 利用scp命令上传本地application.rb到服务器对应的目录,scp /your_app_dir/config/application.rb your_user_name@your_server_ip:/app_dir/share_dir/config/application.rb
  2. ssh your_user_name@your_server_ip,然后在对应用share_dir手动创建application.rb,将本地的config/application.rb的内容复制进去,保存
qqerqqer 回复

确实是因为服务器上没有application.rb,问题解决了

ad583255925 关闭了讨论 03月21日 12:41
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册