Rails 应用程序的 Digital Ocean 中的 cap deploy:cold 错误
Error with cap deploy:cold in Digital Ocean for Rails app
我真的很想部署一个应用程序,并且一直在关注 railstutorial Michael Hartl。现在,我即将在 Digital Ocean 中部署我的第一个应用程序,但我一直 运行 遇到很多问题。不管怎样,除了这个大的,大部分都已经完成了。
我遵循了 Hoang Pham 的 blog 和 [Andrew Gertig][3] 的教程。
无论如何,这是我第一次来这里。让我在 advance.Everytime 中表达我的感谢,我在 $ cap deploy:cold
,在我的本地机器上我总是得到这个错误。
failed: "rvm_path=$HOME/.rvm $HOME/.rvm/bin/rvm-shell 'default' -c
'cd /home/deployer/apps/tiangge/releases/20150123165947 && bundle
install --gemfile
/home/deployer/apps/tiangge/releases/20150123165947/Gemfile --path
/home/deployer/apps/tiangge/shared/bundle --deployment --quiet
--without development test'" on 128.199.74.8
而且我也注意到了这一点,这就是为什么我在 VPS
中再次做了 gem uninstall bundler
和 gem install bundler
[128.199.74.8] executing command ** [out :: 128.199.74.8] Unfortunately, a fatal error has occurred. Please see the Bundler **
[out :: 128.199.74.8] ** [out :: 128.199.74.8] troubleshooting
完整日志:
triggering load callbacks
* 2015-01-23 20:59:18 executing `deploy:cold'
* 2015-01-23 20:59:18 executing `deploy:update'
** transaction: start
* 2015-01-23 20:59:18 executing `deploy:update_code'
triggering before callbacks for `deploy:update_code'
* 2015-01-23 20:59:18 executing `sidekiq:quiet'
* executing "if [ -d /home/deployer/apps/tiangge/current ] && [ -f /home/deployer/apps/tiangge/shared/pids/sidekiq.pid ] && kill -0 `cat /home/deployer/apps/tiangge/shared/pids/sidekiq.pid`> /dev/null 2>&1; then cd /home/deployer/apps/tiangge/current && bundle exec sidekiqctl quiet /home/deployer/apps/tiangge/shared/pids/sidekiq.pid ; else echo 'Sidekiq is not running'; fi"
servers: ["128.199.74.8"]
deployer@128.199.74.8's password:
[128.199.74.8] executing command
** [out :: 128.199.74.8] Sidekiq is not running
** [out :: 128.199.74.8]
command finished in 1328ms
updating the cached checkout on all servers
executing locally: "git ls-remote git@bitbucket.org:bryanbenjamin/tiangge.git master"
command finished in 4069ms
* executing "if [ -d /home/deployer/apps/tiangge/shared/cached-copy ]; then cd /home/deployer/apps/tiangge/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard d87bdfba0860752edddcf6e8c021c1468367aa03 && git clean -q -d -x -f; else git clone -q -b master git@bitbucket.org:bryanbenjamin/tiangge.git /home/deployer/apps/tiangge/shared/cached-copy && cd /home/deployer/apps/tiangge/shared/cached-copy && git checkout -q -b deploy d87bdfba0860752edddcf6e8c021c1468367aa03; fi"
servers: ["128.199.74.8"]
[128.199.74.8] executing command
command finished in 10461ms
copying the cached version to /home/deployer/apps/tiangge/releases/20150123165947
* executing "cp -RPp /home/deployer/apps/tiangge/shared/cached-copy /home/deployer/apps/tiangge/releases/20150123165947 && (echo d87bdfba0860752edddcf6e8c021c1468367aa03 > /home/deployer/apps/tiangge/releases/20150123165947/REVISION)"
servers: ["128.199.74.8"]
[128.199.74.8] executing command
command finished in 1416ms
* 2015-01-23 20:59:49 executing `deploy:finalize_update'
triggering before callbacks for `deploy:finalize_update'
* 2015-01-23 20:59:49 executing `deploy:assets:symlink'
* executing "rm -rf /home/deployer/apps/tiangge/releases/20150123165947/public/assets && mkdir -p /home/deployer/apps/tiangge/releases/20150123165947/public && mkdir -p /home/deployer/apps/tiangge/shared/assets && ln -s /home/deployer/apps/tiangge/shared/assets /home/deployer/apps/tiangge/releases/20150123165947/public/assets"
servers: ["128.199.74.8"]
[128.199.74.8] executing command
command finished in 1290ms
* 2015-01-23 20:59:50 executing `bundle:install'
* executing "cd /home/deployer/apps/tiangge/releases/20150123165947 && bundle install --gemfile /home/deployer/apps/tiangge/releases/20150123165947/Gemfile --path /home/deployer/apps/tiangge/shared/bundle --deployment --quiet --without development test"
servers: ["128.199.74.8"]
[128.199.74.8] executing command
** [out :: 128.199.74.8] Unfortunately, a fatal error has occurred. Please see the Bundler
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:114:in ``'
** [out :: 128.199.74.8] :
** [out :: 128.199.74.8] Cannot allocate memory - git clone 'git://github.com/spree/spree_auth_devise.git' "/home/deployer/apps/tiangge/shared/bundle/ruby/2.1.0/cache/bundler/git/spree_auth_devise-68351354588ecb7fa5d7bc278ebd86436a50d33d" --bare --no-hardlinks --quiet
** [out :: 128.199.74.8] (
** [out :: 128.199.74.8] Errno::ENOMEM
** [out :: 128.199.74.8] )
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:114:in `block in git'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/shared_helpers.rb:62:in `call'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/shared_helpers.rb:62:in `with_clean_git_env'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:114:in `git'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:108:in `block in git_retry'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/retry.rb:38:in `call'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/retry.rb:38:in `run'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/retry.rb:28:in `attempt'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:107:in `git_retry'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:73:in `checkout'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git.rb:149:in `specs'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/lazy_specification.rb:53:in `__materialize__'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/spec_set.rb:88:in `block in materialize'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/spec_set.rb:85:in `map!'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/spec_set.rb:85:in `materialize'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/definition.rb:132:in `specs'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/definition.rb:121:in `resolve_remotely!'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/installer.rb:79:in `run'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/installer.rb:18:in `install'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/cli/install.rb:79:in `run'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/cli.rb:145:in `install'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/vendor/thor/command.rb:27:in `run'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/vendor/thor.rb:363:in `dispatch'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/vendor/thor/base.rb:440:in `start'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/cli.rb:9:in `start'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/bin/bundle:20:in `block in <top (required)>'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/bin/bundle:18:in `<top (required)>'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/bin/bundle:23:in `load'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/bin/bundle:23:in `<main>'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `eval'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `<main>'
** [out :: 128.199.74.8]
command finished in 56236ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/deployer/apps/tiangge/releases/20150123165947; true"
servers: ["128.199.74.8"]
[128.199.74.8] executing command
command finished in 1335ms
failed: "rvm_path=$HOME/.rvm $HOME/.rvm/bin/rvm-shell 'default' -c 'cd /home/deployer/apps/tiangge/releases/20150123165947 && bundle install --gemfile /home/deployer/apps/tiangge/releases/20150123165947/Gemfile --path /home/deployer/apps/tiangge/shared/bundle --deployment --quiet --without development test'" on 128.199.74.8
deploy.rb
require "bundler/capistrano"
require "rvm/capistrano"
require 'capistrano/sidekiq'
server "128.199.74.8", :web, :app, :db, primary: true
set :application, "tiangge"
set :user, "deployer"
set :port, 6000
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false
set :scm, "git"
set :repository, "git@bitbucket.org:bryanbenjamin/tiangge.git"
set :branch, "master"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
after "deploy", "deploy:cleanup" # keep only the last 5 releases
namespace :deploy do
%w[start stop restart].each do |command|
desc "#{command} unicorn server"
task command, roles: :app, except: {no_release: true} do
run "/etc/init.d/unicorn_#{application} #{command}"
end
end
task :setup_config, roles: :app do
sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
run "mkdir -p #{shared_path}/config"
put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
puts "Now edit #{shared_path}/config/database.yml and add your username and password"
end
after "deploy:setup", "deploy:setup_config"
task :symlink_config, roles: :app do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
after "deploy:finalize_update", "deploy:symlink_config"
desc "Make sure local git is in sync with remote."
task :check_revision, roles: :web do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
before "deploy", "deploy:check_revision"
end
我完成的步骤:
-重新安装捆绑器和
-在 deploy.rb
中尝试过 set :rvm_bin_path, "/usr/share/ruby-rvm/bin"
还有一些东西
宝石文件:
source 'https://rubygems.org'
ruby '2.1.3'
gem 'rails', '4.1.8'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
gem 'unicorn'
gem 'capistrano'
gem 'rvm-capistrano'
gem 'dotenv-rails'
gem 'capistrano-sidekiq'
gem 'spree', '2.4.2'
gem 'spree_gateway', github: 'spree/spree_gateway', branch: '2-4-stable'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-4-stable'
您遇到了 Cannot allocate memory
错误。这意味着您的部署机器上没有足够的 RAM 用于捆绑程序。
您可以添加交换分区来执行此操作,或者创建具有更大 RAM 的 DO 液滴 space。
关于向 DO 液滴添加交换的好教程https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-12-04
我在尝试在 Digital Ocean 上部署 Dokku 时遇到了类似的问题/Ubuntu。
在根数字海洋用户的 SSH 会话中使用 3 行代码 运行 轻松修复:
dd if=/dev/zero of=/swapfile bs=1024 count=1024000
mkswap /swapfile
swapon /swapfile
参考:http://dev.housetrip.com/2014/07/06/deploy-rails-and-postgresql-app-to-dokku/
我真的很想部署一个应用程序,并且一直在关注 railstutorial Michael Hartl。现在,我即将在 Digital Ocean 中部署我的第一个应用程序,但我一直 运行 遇到很多问题。不管怎样,除了这个大的,大部分都已经完成了。
我遵循了 Hoang Pham 的 blog 和 [Andrew Gertig][3] 的教程。
无论如何,这是我第一次来这里。让我在 advance.Everytime 中表达我的感谢,我在 $ cap deploy:cold
,在我的本地机器上我总是得到这个错误。
failed: "rvm_path=$HOME/.rvm $HOME/.rvm/bin/rvm-shell 'default' -c 'cd /home/deployer/apps/tiangge/releases/20150123165947 && bundle install --gemfile /home/deployer/apps/tiangge/releases/20150123165947/Gemfile --path /home/deployer/apps/tiangge/shared/bundle --deployment --quiet --without development test'" on 128.199.74.8
而且我也注意到了这一点,这就是为什么我在 VPS
中再次做了gem uninstall bundler
和 gem install bundler
[128.199.74.8] executing command ** [out :: 128.199.74.8] Unfortunately, a fatal error has occurred. Please see the Bundler **
[out :: 128.199.74.8] ** [out :: 128.199.74.8] troubleshooting
完整日志:
triggering load callbacks
* 2015-01-23 20:59:18 executing `deploy:cold'
* 2015-01-23 20:59:18 executing `deploy:update'
** transaction: start
* 2015-01-23 20:59:18 executing `deploy:update_code'
triggering before callbacks for `deploy:update_code'
* 2015-01-23 20:59:18 executing `sidekiq:quiet'
* executing "if [ -d /home/deployer/apps/tiangge/current ] && [ -f /home/deployer/apps/tiangge/shared/pids/sidekiq.pid ] && kill -0 `cat /home/deployer/apps/tiangge/shared/pids/sidekiq.pid`> /dev/null 2>&1; then cd /home/deployer/apps/tiangge/current && bundle exec sidekiqctl quiet /home/deployer/apps/tiangge/shared/pids/sidekiq.pid ; else echo 'Sidekiq is not running'; fi"
servers: ["128.199.74.8"]
deployer@128.199.74.8's password:
[128.199.74.8] executing command
** [out :: 128.199.74.8] Sidekiq is not running
** [out :: 128.199.74.8]
command finished in 1328ms
updating the cached checkout on all servers
executing locally: "git ls-remote git@bitbucket.org:bryanbenjamin/tiangge.git master"
command finished in 4069ms
* executing "if [ -d /home/deployer/apps/tiangge/shared/cached-copy ]; then cd /home/deployer/apps/tiangge/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard d87bdfba0860752edddcf6e8c021c1468367aa03 && git clean -q -d -x -f; else git clone -q -b master git@bitbucket.org:bryanbenjamin/tiangge.git /home/deployer/apps/tiangge/shared/cached-copy && cd /home/deployer/apps/tiangge/shared/cached-copy && git checkout -q -b deploy d87bdfba0860752edddcf6e8c021c1468367aa03; fi"
servers: ["128.199.74.8"]
[128.199.74.8] executing command
command finished in 10461ms
copying the cached version to /home/deployer/apps/tiangge/releases/20150123165947
* executing "cp -RPp /home/deployer/apps/tiangge/shared/cached-copy /home/deployer/apps/tiangge/releases/20150123165947 && (echo d87bdfba0860752edddcf6e8c021c1468367aa03 > /home/deployer/apps/tiangge/releases/20150123165947/REVISION)"
servers: ["128.199.74.8"]
[128.199.74.8] executing command
command finished in 1416ms
* 2015-01-23 20:59:49 executing `deploy:finalize_update'
triggering before callbacks for `deploy:finalize_update'
* 2015-01-23 20:59:49 executing `deploy:assets:symlink'
* executing "rm -rf /home/deployer/apps/tiangge/releases/20150123165947/public/assets && mkdir -p /home/deployer/apps/tiangge/releases/20150123165947/public && mkdir -p /home/deployer/apps/tiangge/shared/assets && ln -s /home/deployer/apps/tiangge/shared/assets /home/deployer/apps/tiangge/releases/20150123165947/public/assets"
servers: ["128.199.74.8"]
[128.199.74.8] executing command
command finished in 1290ms
* 2015-01-23 20:59:50 executing `bundle:install'
* executing "cd /home/deployer/apps/tiangge/releases/20150123165947 && bundle install --gemfile /home/deployer/apps/tiangge/releases/20150123165947/Gemfile --path /home/deployer/apps/tiangge/shared/bundle --deployment --quiet --without development test"
servers: ["128.199.74.8"]
[128.199.74.8] executing command
** [out :: 128.199.74.8] Unfortunately, a fatal error has occurred. Please see the Bundler
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:114:in ``'
** [out :: 128.199.74.8] :
** [out :: 128.199.74.8] Cannot allocate memory - git clone 'git://github.com/spree/spree_auth_devise.git' "/home/deployer/apps/tiangge/shared/bundle/ruby/2.1.0/cache/bundler/git/spree_auth_devise-68351354588ecb7fa5d7bc278ebd86436a50d33d" --bare --no-hardlinks --quiet
** [out :: 128.199.74.8] (
** [out :: 128.199.74.8] Errno::ENOMEM
** [out :: 128.199.74.8] )
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:114:in `block in git'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/shared_helpers.rb:62:in `call'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/shared_helpers.rb:62:in `with_clean_git_env'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:114:in `git'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:108:in `block in git_retry'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/retry.rb:38:in `call'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/retry.rb:38:in `run'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/retry.rb:28:in `attempt'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:107:in `git_retry'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:73:in `checkout'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git.rb:149:in `specs'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/lazy_specification.rb:53:in `__materialize__'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/spec_set.rb:88:in `block in materialize'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/spec_set.rb:85:in `map!'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/spec_set.rb:85:in `materialize'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/definition.rb:132:in `specs'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/definition.rb:121:in `resolve_remotely!'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/installer.rb:79:in `run'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/installer.rb:18:in `install'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/cli/install.rb:79:in `run'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/cli.rb:145:in `install'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/vendor/thor/command.rb:27:in `run'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/vendor/thor.rb:363:in `dispatch'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/vendor/thor/base.rb:440:in `start'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/cli.rb:9:in `start'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/bin/bundle:20:in `block in <top (required)>'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/bin/bundle:18:in `<top (required)>'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/bin/bundle:23:in `load'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/bin/bundle:23:in `<main>'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `eval'
** [out :: 128.199.74.8]
** [out :: 128.199.74.8]
** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `<main>'
** [out :: 128.199.74.8]
command finished in 56236ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/deployer/apps/tiangge/releases/20150123165947; true"
servers: ["128.199.74.8"]
[128.199.74.8] executing command
command finished in 1335ms
failed: "rvm_path=$HOME/.rvm $HOME/.rvm/bin/rvm-shell 'default' -c 'cd /home/deployer/apps/tiangge/releases/20150123165947 && bundle install --gemfile /home/deployer/apps/tiangge/releases/20150123165947/Gemfile --path /home/deployer/apps/tiangge/shared/bundle --deployment --quiet --without development test'" on 128.199.74.8
deploy.rb
require "bundler/capistrano" require "rvm/capistrano" require 'capistrano/sidekiq' server "128.199.74.8", :web, :app, :db, primary: true set :application, "tiangge" set :user, "deployer" set :port, 6000 set :deploy_to, "/home/#{user}/apps/#{application}" set :deploy_via, :remote_cache set :use_sudo, false set :scm, "git" set :repository, "git@bitbucket.org:bryanbenjamin/tiangge.git" set :branch, "master" default_run_options[:pty] = true ssh_options[:forward_agent] = true after "deploy", "deploy:cleanup" # keep only the last 5 releases namespace :deploy do %w[start stop restart].each do |command| desc "#{command} unicorn server" task command, roles: :app, except: {no_release: true} do run "/etc/init.d/unicorn_#{application} #{command}" end end task :setup_config, roles: :app do sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}" sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}" run "mkdir -p #{shared_path}/config" put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml" puts "Now edit #{shared_path}/config/database.yml and add your username and password" end after "deploy:setup", "deploy:setup_config" task :symlink_config, roles: :app do run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml" end after "deploy:finalize_update", "deploy:symlink_config" desc "Make sure local git is in sync with remote." task :check_revision, roles: :web do unless `git rev-parse HEAD` == `git rev-parse origin/master` puts "WARNING: HEAD is not the same as origin/master" puts "Run `git push` to sync changes." exit end end before "deploy", "deploy:check_revision" end
我完成的步骤:
-重新安装捆绑器和 -在 deploy.rb
中尝试过set :rvm_bin_path, "/usr/share/ruby-rvm/bin"
还有一些东西
宝石文件:
source 'https://rubygems.org'
ruby '2.1.3'
gem 'rails', '4.1.8'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
gem 'unicorn'
gem 'capistrano'
gem 'rvm-capistrano'
gem 'dotenv-rails'
gem 'capistrano-sidekiq'
gem 'spree', '2.4.2'
gem 'spree_gateway', github: 'spree/spree_gateway', branch: '2-4-stable'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-4-stable'
您遇到了 Cannot allocate memory
错误。这意味着您的部署机器上没有足够的 RAM 用于捆绑程序。
您可以添加交换分区来执行此操作,或者创建具有更大 RAM 的 DO 液滴 space。
关于向 DO 液滴添加交换的好教程https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-12-04
我在尝试在 Digital Ocean 上部署 Dokku 时遇到了类似的问题/Ubuntu。 在根数字海洋用户的 SSH 会话中使用 3 行代码 运行 轻松修复:
dd if=/dev/zero of=/swapfile bs=1024 count=1024000
mkswap /swapfile
swapon /swapfile
参考:http://dev.housetrip.com/2014/07/06/deploy-rails-and-postgresql-app-to-dokku/