2012-02-17 34 views
6

我正在将应用程序部署到heroku,并且该应用程序位于rails 3.2上,并且我安装了活动的admin gem。由于activeadmin邮件程序在heroku上迁移失败

当我运行耙分贝:迁移失败由于以下错误

== DeviseCreateAdminUsers: migrating ========================================= 
-- create_table(:admin_users) 
    -> 0.0823s 

Sent mail to [email protected] (3228ms) 
rake aborted! 
An error has occurred, this and all later migrations canceled: 

Connection refused - connect(2) 

想知道我需要做什么来解决这个问题。 Devise gem或ActiveAdmin似乎需要在迁移过程中发送邮件,并且因为如果失败则无法发送邮件。

回答

4

尝试安装插件Sendgrid:

heroku addons:add sendgrid:starter 

如果要部署到阿斯彭,竹stacks,它应该工作的时候了。如果您使用的是雪松堆栈,你需要添加额外的初始化:

#config/initializers/mail.rb 

ActionMailer::Base.smtp_settings = { 
    :address  => 'smtp.sendgrid.net', 
    :port   => '587', 
    :authentication => :plain, 
    :user_name  => ENV['SENDGRID_USERNAME'], 
    :password  => ENV['SENDGRID_PASSWORD'], 
    :domain   => 'heroku.com' 
} 
ActionMailer::Base.delivery_method = :smtp 

来自http://devcenter.heroku.com/articles/sendgrid

+0

我正在使用雪松,所以我想我只需要查看文档来设置它呢?谢谢你的提示。我试了一下之后会发布这篇文章吗? – mattwallace 2012-02-17 23:03:39

+0

增加发送网格固定的问题 – mattwallace 2012-02-18 00:54:06

0

这是混淆了我一点点:

Connection refused - connect(2) 

你有你的邮件设置?你使用SendGrid或类似的?请记住,Heroku不直接提供电子邮件服务。

http://devcenter.heroku.com/articles/smtp

+0

是啊,这是困惑,我也...仍然需要排查有点和看看是否需要设置SendGrid – mattwallace 2012-02-17 23:04:10