【发布时间】:2016-04-30 16:19:24
【问题描述】:
我想使用 capistrano 将我的 rails 应用程序部署到 AWS,我完全按照教程进行操作。
教程如下:http://www.sitepoint.com/deploy-your-rails-app-to-aws/
但是,无论我刷新多少次或运行“cap production deploy”,我的网站总是显示 nginx 默认页面。
事实上,每次我运行“cap production deploy”时,我都会收到这个错误:
DEBUG [81457789] An error occurred while installing pg (0.17.1), and
Bundler cannot continue.
DEBUG [81457789]
DEBUG [81457789] Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.
DEBUG [81457789]
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@52.27.237.141: bundle exit status: 5
bundle stdout: An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.
bundle stderr: Nothing written
SSHKit::Command::Failed: bundle exit status: 5
bundle stdout: An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.
bundle stderr: Nothing written
Tasks: TOP => deploy:updated => bundler:install
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deploy@52.27.237.141: bundle exit status: 5
bundle stdout: An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.
bundle stderr: Nothing written
宝石文件:
source 'https://rubygems.org'
gem 'rails', '4.2.2'
gem 'bcrypt', '3.1.7'
gem 'faker', '1.4.2'
gem 'carrierwave', '0.10.0'
gem 'mini_magick', '3.8.0'
gem 'fog', '1.36.0'
gem 'will_paginate', '3.0.7'
gem 'bootstrap-will_paginate', '0.0.10'
gem 'bootstrap-sass', '3.2.0.0'
gem 'sass-rails', '5.0.2'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '0.4.0', group: :doc
gem 'figaro'
gem 'puma'
gem 'capistrano-ssh-doctor', '~> 1.0'
gem 'pg', '0.17.1'
group :development, :test do
gem 'sqlite3', '1.3.9'
gem 'byebug', '3.4.0'
gem 'web-console', '2.0.0.beta3'
gem 'spring', '1.1.3'
gem 'capistrano', '3.4.0'
gem 'capistrano-rails', '~> 1.1', require: false
gem 'capistrano3-puma'
gem 'capistrano-bundler', require: false
gem 'capistrano-rvm'
end
group :test do
gem 'minitest-reporters', '1.0.5'
gem 'mini_backtrace', '0.1.3'
gem 'guard-minitest', '2.3.1'
end
group :production do
gem 'rails_12factor', '0.0.2'
end
我很确定 'gem install pg -v '0.17.1'' 确实成功了。我什至卸载并安装以说服自己。
我不知道问题是来自“上限生产部署”还是问题比这更深。
这是我第一次将网络应用程序部署到我自己的服务器上,我还没有完全了解部署和服务器的工作原理,希望有人能在这里帮助我,在此先感谢!
【问题讨论】:
-
您可以尝试从 aws 服务器运行此命令吗:
sudo apt-get install libgmp3-dev,然后执行gem install pg -
嗨 Abhinary,感谢您的评论,我刚刚尝试过。不幸的是,我仍然有同样的错误。
-
如果我说我的网络应用是一个非常简单的应用,它没有数据库会有帮助吗?
-
我不确定,即使您根本不使用 DB,它也不应该抛出此消息。
-
另外,你有没有在服务器上安装 Postgres 并在那里运行
bundle install?
标签: ruby-on-rails ruby ubuntu amazon-web-services nginx