A Ubuntu 14.04 instance on google compute engine is supposed to host rails3 applications served via Passenger/nginx. The instance has sendmail installed. The GCE instance has firewall rule
Source Ranges: 0.0.0.0/0 Allowed Protocols or Ports: tcp:2525
established and is configured to send mail via sendgrid. telnet smtp.sendgrid.net 2525 does connect and allows to send e-mail via that connection. So traffic should flow.
However none of the following combinations don't hit a timeout. Nginx logs don't pick up the error, but the application's log does state the timeout being reached.
invocations:
ActionMailer::Base.smtp_settings =
config.action_mailer.smtp_settings =
followed by basic bloc
{
:user_name => 'user',
:password => 'aaabbbb',
:domain => 'domain.tld',
:address => 'smtp.sendgrid.net',
:port => 2525,
:authentication => :plain,
:enable_starttls_auto => true
}
atempted in each of environment.rb, application.rb, environments/development.rb
Adding, before or after the settings bloc, either of these or both blocs:
config.action_mailer.default_url_options = {
:host => 'smtp.sendgrid.net',
:port => 2525
}
config.action_mailer.delivery_method = :smtp
has no effect on overall behaviour. That's 8 combos that have the same behaviour. Not having access to GCE logs for handling these outgoing messages, I have no idea whether they are actually leaving the application properly.
Frankly, this impediment by GCE is somewhat of a showstopper, IMHO.
** Edit ** launching from console returns the following error stack:
Timeout::Error: execution expired
from /home/user/.rvm/rubies/ruby-1.9.3-p550/lib/ruby/1.9.1/net/smtp.rb:541:in `initialize'
from /home/user/.rvm/rubies/ruby-1.9.3-p550/lib/ruby/1.9.1/net/smtp.rb:541:in `open'
from /home/user/.rvm/rubies/ruby-1.9.3-p550/lib/ruby/1.9.1/net/smtp.rb:541:in `tcp_socket'
from /home/user/.rvm/rubies/ruby-1.9.3-p550/lib/ruby/1.9.1/net/smtp.rb:550:in `block in do_start'
from /home/user/.rvm/rubies/ruby-1.9.3-p550/lib/ruby/1.9.1/net/smtp.rb:550:in `do_start'
from /home/user/.rvm/rubies/ruby-1.9.3-p550/lib/ruby/1.9.1/net/smtp.rb:520:in `start'
from /home/user/app/shared/bundle/ruby/1.9.1/gems/mail-2.5.4/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
from /home/user/app/shared/bundle/ruby/1.9.1/gems/mail-2.5.4/lib/mail/message.rb:2129:in `do_delivery'
from /home/user/app/shared/bundle/ruby/1.9.1/gems/mail-2.5.4/lib/mail/message.rb:232:in `block in deliver'
from /home/user/app/shared/bundle/ruby/1.9.1/gems/actionmailer-3.2.18/lib/action_mailer/base.rb:415:in `block in deliver_mail'
from /home/user/app/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/notifications.rb:123:in `block in instrument'
[...]
Update
Thanks to marilu for pointing out /var/log/syslog.
It is not getting referenced at all by these actions. So yes, it is a rails configuration issue.