【问题标题】:Trouble deploying my Rails app to Linode VPS无法将我的 Rails 应用程序部署到 Linode VPS
【发布时间】:2013-04-15 05:32:59
【问题描述】:

我正在尝试将我的 rails 应用程序部署到 Linode VPS,但是在我完成所有步骤之后 xxx@xxxx-desktop:~/myrailsapp$ cap deploy:cold

我收到以下错误:

failed: "env PATH=$HOME/.rvm/shims:$HOME/.rvm/bin:$PATH sh -c 'cd /home/deployer/apps/myrailsapp/releases/20130422101521 && bundle install --gemfile /home/deployer/apps/myrailsapp/releases/20130422101521/Gemfile --path /home/deployer/apps/myrailsapp/shared/bundle --deployment --quiet --without development test'" on xxx.xxx.xxx.xxx

完整日志如下:

xxx@xxx-desktop:~/myrailsapp$ cap deploy:cold
  * 2013-04-22 15:44:59 executing `deploy:cold'
  * 2013-04-22 15:44:59 executing `deploy:update'
 ** transaction: start
  * 2013-04-22 15:44:59 executing `deploy:update_code'
    updating the cached checkout on all servers
    executing locally: "git ls-remote git@bitbucket.org:myrailsapp/myrailsapp.git master"
    command finished in 5385ms
  * executing "if [ -d /home/deployer/apps/myrailsapp/shared/cached-copy ]; then cd /home/deployer/apps/myrailsapp/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 88641306c92790d13f95beb7a2826a072ab72df4 && git clean -q -d -x -f; else git clone -q git@bitbucket.org:myrailsapp/myrailsapp.git maste /home/deployer/apps/myrailsapp/shared/cached-copy && cd /home/deployer/apps/myrailsapp/shared/cached-copy && git checkout -q -b deploy 88641306c92790d13f95beb7a2826a072ab72df4; fi"
    servers: ["xxx.xxx.xxx.xxx"]
Password: 
    [xxx.xxx.xxx.xxx] executing command
    command finished in 5786ms
    copying the cached version to /home/deployer/apps/myrailsapp/releases/20130422101521
  * executing "cp -RPp /home/deployer/apps/myrailsapp/shared/cached-copy /home/deployer/apps/myrailsapp/releases/20130422101521 && (echo 88641306c92790d13f95beb7a2826a072ab72df4 > /home/deployer/apps/myrailsapp/releases/20130422101521/REVISION)"
    servers: ["xxx.xxx.xxx.xxx"]
    [xxx.xxx.xxx.xxx] executing command
    command finished in 951ms
  * 2013-04-22 15:45:22 executing `deploy:finalize_update'
    triggering before callbacks for `deploy:finalize_update'
  * 2013-04-22 15:45:22 executing `deploy:assets:symlink'
  * executing "rm -rf /home/deployer/apps/myrailsapp/releases/20130422101521/public/assets && mkdir -p /home/deployer/apps/myrailsapp/releases/20130422101521/public && mkdir -p /home/deployer/apps/myrailsapp/shared/assets && ln -s /home/deployer/apps/myrailsapp/shared/assets /home/deployer/apps/myrailsapp/releases/20130422101521/public/assets"
    servers: ["xxx.xxx.xxx.xxx"]
    [xxx.xxx.xxx.xxx] executing command
    command finished in 993ms
  * 2013-04-22 15:45:23 executing `bundle:install'
  * executing "cd /home/deployer/apps/myrailsapp/releases/20130422101521 && bundle install --gemfile /home/deployer/apps/myrailsapp/releases/20130422101521/Gemfile --path /home/deployer/apps/myrailsapp/shared/bundle --deployment --quiet --without development test"
    servers: ["xxx.xxx.xxx.xxx"]
    [xxx.xxx.xxx.xxx] executing command
 ** [out :: xxx.xxx.xxx.xxx] ERROR: Gem bundler is not installed, run `gem install bundler` first.
    command finished in 974ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/deployer/apps/myrailsapp/releases/20130422101521; true"
    servers: ["xxx.xxx.xxx.xxx"]
    [xxx.xxx.xxx.xxx] executing command
    command finished in 971ms
failed: "env PATH=$HOME/.rvm/shims:$HOME/.rvm/bin:$PATH sh -c 'cd /home/deployer/apps/myrailsapp/releases/20130422101521 && bundle install --gemfile /home/deployer/apps/myrailsapp/releases/20130422101521/Gemfile --path /home/deployer/apps/myrailsapp/shared/bundle --deployment --quiet --without development test'" on xxx.xxx.xxx.xxx

【问题讨论】:

    标签: ruby-on-rails deployment linode


    【解决方案1】:

    你得到了错误:

    Bundler is not installed
    

    在您的 linode 服务器之前,您必须安装捆绑器:

    gem install bundler
    

    另外,您必须在顶部添加您的deploy.rb

    require "bundler/capistrano"
    

    另外,你的问题是 rvm 没有被添加到 PATH:

    你可以看看这个问题:

    Ruby on Rails RVM $PATH issue

    问候!

    【讨论】:

    • 我已经在我的项目文件夹中安装了 gem install bundler 并且我在 deploy.rb 文件中添加了 require "bundler/capistrano" 但问题无法解决有人建议我执行以下操作:set :default_environment , { 'PATH' => "$HOME/.rvm/shims:$HOME/.rvm/bin:$PATH" } 是正确的代码吗,我的电脑和 Linode VPS 上都安装了 rvm?
    • 没有 rvm 已经安装在 .bashrc 的正确路径中,实际上有人建议我将 rvm 路径添加到 deploy.rb 文件,这样冷安装会找到 bundler,但我的问题仍然没有解决,你能检查一下吗?
    猜你喜欢
    • 2012-06-17
    • 1970-01-01
    • 2016-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-22
    • 1970-01-01
    相关资源
    最近更新 更多