Migration fails in heroku due to mailadmin

I am deploying the application in heroku and the application is on rails 3.2 and I have active admin gem installed.

When I run rake db: migration failed due to the following error

== DeviseCreateAdminUsers: migrating ========================================= -- create_table(:admin_users) -> 0.0823s Sent mail to admin@example.com (3228ms) rake aborted! An error has occurred, this and all later migrations canceled: Connection refused - connect(2) 

I wonder what I need to do to fix this. It seems that in Devise gem or ActiveAdmin you need to send mail during the migration process and because it cannot, if it fails.

+6
source share
2 answers

Try installing the Sendgrid addon:

 heroku addons:add sendgrid:starter 

If you are deploying to Aspen or Bamboo stacks this should work right away. If you are using the Cedar stack, you need to add an additional initializer:

 #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 

Taken from: http://devcenter.heroku.com/articles/sendgrid

+4
source

This bothers me a bit:

 Connection refused - connect(2) 

Do you have a mail setup? Are you using SendGrid or the like? Remember that Heroku does not provide email services directly.

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

0
source

Source: https://habr.com/ru/post/908716/


All Articles