1

I am trying to deploy a rails 3.2 ruby 1.9.3 app to digital ocean. after doing cap deploy:setup, cap deploy:check, cap deploy, I get the following error:

$ gem install activerecord-postgresql-adapter
  * ←[33mexecuting "cd -- /home/deployer/apps/csd3/releases/20130724142600 && RA
ILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile"←[0m
    servers: ["192.241.141.56"]
    [192.241.141.56] executing command
 ** [out :: 192.241.141.56] rake aborted! 
 ** [out :: 192.241.141.56] Please install the postgresql adapter: `gem install
activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfil
e.)

I run gem install activerecord-postgresql-adapter on the server and it completes. However, when I do cap deploy, i get the same message. I found that problem may be in the database.yml file but it seems fine.

development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

test: 
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: postgresql
  encoding: unicode
  database: chodae_database
  host: 192.241.141.56
  pool: 5
  username: chodae
  password:

And Gemfile:

group :development do
  gem 'quiet_assets', '1.0.2'
  gem 'sqlite3', '1.3.7'
  gem 'thin', '1.5.0'
  gem 'better_errors', '0.7.0'
  gem 'binding_of_caller', '0.7.1'
  gem 'meta_request', '0.2.2'
  gem 'wirble', '0.1.3'
  gem 'hirb', '0.7.1'
  gem 'populator3', '0.2.7'
  gem 'faker', '1.1.2'
  gem 'localtunnel'
  gem 'capistrano'
end

group :production do
  gem 'pg', '0.15.1'
  gem 'pg_search', '0.6.2'
  gem "nginx", '0.0.2'
  gem "passenger", "~> 4.0.10"
end

How can I fix this?

4

1 回答 1

2

首先,最佳实践是对所有环境使用相同的数据库。
请问可以RAILS_ENV=production bundle exec gem install pg在服务器上运行吗?

问题似乎是运行时资产组中没有 pg gem

RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile
于 2013-07-24T15:47:43.707 回答