2

Heroku 应用程序的 rails 3.1 到 3.2.6 升级取得了很大进展。

我使用asset_sync 并将资产预编译到S3 上。我使用asset_sync.rb 初始化程序来配置我的S3 连接详细信息。

当我尝试运行时出现错误

RAILS_ENV=production bundle exec rake assets:precompile

AssetSync: using /Users/bob/work/myapp/config/initializers/asset_sync.rb
rake aborted!
could not connect to server: Permission denied
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

Tasks: TOP => environment
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/Users/bob/.rvm/rubies/ruby-1.9.3-p...]

这很奇怪。我检查了它是否按照在 MAC OS X 上被拒绝的 Postgres 权限来监听该问题和相关评论。

4

1 回答 1

1

这不是asset_sync的错误,而是资产预编译过程本身(特别是在heroku上)config.assets.initialize_on_precompile = false在您的生产或application.rb中尝试

这将确保您的应用程序代码不会被不必要地初始化,这在预编译时,您的 heroku 数据库可能不可用。

此外,我相信 Rails 3.2.6 但 3.2.x 也不是问题。

于 2012-06-17T15:19:32.867 回答