加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

rails 4 mina部署失败

发布时间:2020-12-17 02:46:44 所属栏目:百科 来源:网络整理
导读:我正在部署使用mina部署的rails 4应用程序.我的部署脚本是 require 'mina/bundler'require 'mina/rails'require 'mina/git'require 'mina/rvm' # for rvm support. (http://rvm.io)set :domain,'someplace.com'set :deploy_to,'/home/deploy/projects/websit
我正在部署使用mina部署的rails 4应用程序.我的部署脚本是

require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'    # for rvm support. (http://rvm.io)

set :domain,'someplace.com'
set :deploy_to,'/home/deploy/projects/website'
set :repository,'git@github.com:someone/repo.git'
set :branch,'master'

set :identity_file,"#{ENV['HOME']}/.ssh/id_rsa"
set :user,'deploy'    # Username in the server to SSH to.

set :shared_paths,['config/database.yml','config/credentials.yml','log','tmp']

task :environment do
  invoke :'rvm:use[ruby-2.1.0@default]'
end

task :setup => :environment do
  queue! %[mkdir -p "#{deploy_to}/shared/log"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"]

  queue! %[mkdir -p "#{deploy_to}/shared/config"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"]

  queue! %[touch "#{deploy_to}/shared/config/database.yml"]
  queue  %[echo "-----> Be sure to edit 'shared/config/database.yml'."]

  queue! %[touch "#{deploy_to}/shared/config/credentials.yml"]
  queue  %[echo "-----> Be sure to edit 'shared/config/credentials.yml'."]
end

desc "Deploys the current version to the server."
task :deploy => :environment do
  deploy do
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    invoke :'rails:assets_precompile'

    to :launch do
      queue "touch #{deploy_to}/tmp/restart.txt"
    end
  end
end

当我部署为’mina deploy’时,我得到错误

...

Symlinking shared paths
$mkdir -p "./config"
$mkdir -p "."
$rm -rf "./config/database.yml"
$ln -s "/home/deploy/projects/website/shared/config/database.yml" "./config/database.yml"
$rm -rf "./config/credentials.yml"
$ln -s "/home/deploy/projects/website/shared/config/credentials.yml" "./config/credentials.yml"
$rm -rf "./log"
$ln -s "/home/deploy/projects/website/shared/log" "./log"
$rm -rf "./tmp"
$ln -s "/home/deploy/projects/website/shared/tmp" "./tmp"

-----> Installing gem dependencies using Bundler
$mkdir -p "/home/deploy/projects/website/shared/bundle"
$mkdir -p "./vendor"
$ln -s "/home/deploy/projects/website/shared/bundle" "./vendor/bundle"
$bundle install --without development:test --path "./vendor/bundle" --binstubs bin/ --deployment

...

Your bundle is complete!
Gems in the groups development and test were not installed.
It was installed into ./vendor/bundle

-----> Precompiling asset files
$RAILS_ENV="production" bundle exec rake assets:precompile RAILS_GROUPS=assets
rake aborted!
File exists @ dir_s_mkdir - /home/deploy/projects/website/tmp/build-138935597031149/tmp
/home/deploy/projects/website/tmp/build-138935597031149/vendor/bundle/ruby/2.1.0/gems/sprockets-2.10.1/lib/sprockets/cache/file_store.rb:25:in `[]='
/home/deploy/projects/website/tmp/build-138935597031149/vendor/bundle/ruby/2.1.0/gems/sprockets-2.10.1/lib/sprockets/caching.rb:34:in `cache_set'

解决方法

如果没有ssh进入服务器,请确保创建了shared / tmp目录

$mkdir /home/deploy/projects/website/shared/tmp

确保你也拥有正确的权限.drwxr-XR-X

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读