简体   繁体   中英

Deploying rails app to AWS (Ubuntu Server) using Capistrano

I want to deploy my rails app to AWS using capistrano and I followed a tutorial exactly as it is.

Here's the tutorial: http://www.sitepoint.com/deploy-your-rails-app-to-aws/

However, my website is always showing the nginx default page no matter how many times i refreshed or run 'cap production deploy'.

In fact, each time i run 'cap production deploy', I get this error:

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

Gemfile:

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

I am very sure 'gem install pg -v '0.17.1'' did succeed. I even uninstall and install to convince myself.

I don't know if the problem is from 'cap production deploy' or the problem goes deeper than that.

Its my first time deploying a web app to a server on my own and I still haven't fully understand how deployment and server works, hope someone can help me out here, thanks in advance!

要为Ruby编译pg驱动程序,您需要在服务器上安装libpq-dev软件包。

Not the best answer but somehow it works.

I gave up trying, I decided to terminate my AWS instance and redo, however, I still have the same error as per question but using Abhinay's suggestion on the above comment works now.

"Consider checking out this question stackoverflow.com/questions/20754081/… and the related answers probably this one: stackoverflow.com/a/20754173/2545197"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM