Loomio
Sun 19 Apr 2020 10:48PM

Trouble with emails, errors with [websocket ]and /cable

FDS Fabio dos Santos Public Seen by 66

Hello everyone!

Loomio would be the perfect solution to our non-profits vote that will happen in the coming months.

My setup is a Linode Server ("nanode"). I have root access, IP Address, DNS is registered and a SMTP server configured on another machine that I know it runs.

I have been able to follow all the steps in Loomio-Deploy, with Docker, which no apparent problem. Loomio runs. Letsecrypt issues the SSL Certificate. I noticed that there are WEBSOCKET errors on the logs, and that the email fails to be sent.

I can load the Loomio's website on my host. But I cannot make the first account, as the email with the confirmatio number is never sent.

I'm assuming both issues are related. I am assuming it is an error with the websocket, and consequently the email is not sent out.

Below are the logs. I have tried some of the solutions posted on this forum, but could not solve the problem on my own.

I wonder if there is something in my setup which I am overlooking, or if it is some configuration that I did not complete. (In fact, I have not been able to find where the configurations are stored on the loomio-deploy directory!)

Help would be much appreciated, as Loomio would definitely solve many of or problems! I feel like there is a small tweak and it would work!

The website is running at loomio.associacaomusicalsuzuki.com.br.

Here is a PasteBin with the Logs: https://pastebin.pl/view/7bcfdc0f

FDS

Fabio dos Santos Mon 20 Apr 2020 7:49PM

Oops. Forgot to include the ENV file:

Here it is: https://pastebin.pl/view/8180aad9

RG

Robert Guthrie Wed 22 Apr 2020 7:16AM

Hi @Fabio dos Santos, have you tried using something like Swaks to confirm your SMTP settings? That can offer insight into the correct ENV config.

I'll have a think about how we can make this easier, it's nothing we at Loomio have written, I'm not sure why it seems so many people have trouble configuring Loomio/Rails to send mail.

FDS

Fabio dos Santos Wed 22 Apr 2020 10:16AM

Hi .

Thanks you so much for your response!I have been looking into this.

It seems like a conection error, and someone pointed how they needed to configure the Proxy correctly. So yesterday night, I looked into the jwilder/nginx page on Docker Hub. This particular bit of info from https://hub.docker.com/r/jwilder/nginx-proxy/ called my attention:

+++++++++++++++++++++++

Internet vs. Local Network Access

If you allow traffic from the public internet to access your nginx-proxy container, you may want to restrict some containers to the internal network only, so they cannot be accessed from the public internet. On containers that should be restricted to the internal network, you should set the environment variable NETWORK_ACCESS=internal. By default, the internal network is defined as 127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16. To change the list of networks considered internal, mount a file on the nginx-proxy at /etc/nginx/network_internal.conf with these contents, edited to suit your needs:

# These networks are considered "internal"
allow 127.0.0.0/8;
allow 10.0.0.0/8;
allow 192.168.0.0/16;
allow 172.16.0.0/12;

# Traffic from all other networks will be rejected
deny all;

When internal-only access is enabled, external clients with be denied with an HTTP 403 Forbidden

+++++++++++++++++++

My email server is not a container or even within the local network. I will try this as soon as I can. But maybe this is the answer: the "external" are not being accessed. That would explain the errors with the email setup.

I'm kind of new to this docker things. I think is amazing. I'm assuming that I need to create /etc/nginx/network_internal.conf with the appropriate IP numbers. If not, please let me know!

I can't tell you how grateful I am, for the software, and for the response. Thank you!

FDS

Fabio dos Santos Wed 22 Apr 2020 1:23PM

I created the file mentioned above, but no change.

Another thing that caught my eye was the SSL Backends config in NGINX. It could well be that it is trying to access website with HTTP, and the server does not authenticate because it should only contact through HTTPS, or port 443. I have just tried to add this to the env to see if it works.

VIRTUAL_PROTO=https
VIRTUAL_PORT=443

FDS

Fabio dos Santos Wed 22 Apr 2020 1:40PM

OK! Some adicional information (I've tried some things.)

Cable/Websocket errors:
Persist when I add the email server's IP address to etc/nginx/network_internal.conf

Cable/ Websocket cease:
When I add the SSL Config to the ENV. HOWEVER, then I have authentication problem to load the website.

Here is the error:

'loomio-nginx   | nginx.1    | 2020/04/22 13:34:04 [error] 85#85: *1 SSLdohandshake() failed (SSL: error:1408F10B:SSL routines:ssl3getrecord:wrong version number) while SSL handshaking to upstream, client: 177.194.12.130, server: loomio.associacaomusicalsuzuki.com.br, request: "GET / HTTP/2.0", upstream: "https://172.17.0.5:3000/", host: "loomio.associacaomusicalsuzuki.com.br"

In both cases, I still get this warning about loomio-mailin: Not sure if this is relevant.

loomio-mailin  | warn: Webhook http://app:3000/email_processor/ seems invalid or down. You may want to double check the webhook url.

There seems to be some conection with nginx-proxy, and its connections to the internet, and the containers, and it is does not seem to be a problem specific to the code-base, but rather in configs.

Thanks!

RG

Robert Guthrie Wed 22 Apr 2020 7:24PM

Are you trying to solve SMTP or Cable issues?

I think you should ignore the cable issues and focus on SMTP, the cable stuff is something that should just work given the config I've provided, and if not, I'll look into it. It works fine for the Loomio installs I support, but I'll review it.

SMTP is critical though, and I think you should confirm your SMTP config with swaks, then report back if loomio works or does not work with that config.

FDS

Fabio dos Santos Thu 23 Apr 2020 1:56PM

Good morning!

Sorry. I was not aware that they were different issues!

I got the email server to work with Swaks. I have received the email.

./swaks [email protected] --from "[email protected]" --auth LOGIN --auth-user "[email protected]"  --auth-password "RANDOMPASSWORD" --server mail.associacaomusicalsuzuki.com.br -tls

And the output:

=== Trying mail.associacaomusicalsuzuki.com.br:465...
=== Connected to mail.associacaomusicalsuzuki.com.br.
=== TLS started with cipher TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256
=== TLS no local certificate set
=== TLS peer DN="/C=BR/postalCode=88036-001/ST=Santa Catarina/L=Florianopolis/street=Rua Lauro Linhares, 589/O=Endurance Group Brasil Hospedagem de Sites LTDA/OU=PremiumSSL Wildcard/CN=*.hostgator.com.br"
<~  220-br150.hostgator.com.br ESMTP Exim 4.92 #2 Thu, 23 Apr 2020 10:35:00 -0300 
<~  220-We do not authorize the use of this system to transport unsolicited, 
<~  220 and/or bulk e-mail.
 ~> EHLO caliope.local
<~  250-br150.hostgator.com.br Hello caliope.local [177.194.12.130]
<~  250-SIZE 52428800
<~  250-8BITMIME
<~  250-PIPELINING
<~  250-AUTH PLAIN LOGIN
<~  250 HELP
 ~> AUTH LOGIN
<~  334 VXNlcm5hbWU6
 ~> bm8tcmVwbHlAYXNzb2NpYWNhb211c2ljYWxzdXp1a2kuY29tLmJy
<~  334 UGFzc3dvcmQ6
 ~> TDZnejhaRmZKNFh2RmJjdUY=
<~  235 Authentication succeeded
 ~> MAIL FROM:<[email protected]>
<~  250 OK
 ~> RCPT TO:<[email protected]>
<~  250 Accepted
 ~> DATA
<~  354 Enter message, ending with "." on a line by itself
 ~> Date: Thu, 23 Apr 2020 10:34:59 -0300
 ~> To: [email protected]
 ~> From: [email protected]
 ~> Subject: test Thu, 23 Apr 2020 10:34:59 -0300
 ~> Message-Id: <[email protected]>
 ~> X-Mailer: swaks v20190914.0 jetmore.org/john/code/swaks/
 ~> 
 ~> This is a test mailing
 ~> 
 ~> 
 ~> .
<~  250 OK id=1jRc0L-0036He-E7
 ~> QUIT
<~  221 br150.hostgator.com.br closing connection
=== Connection closed with remote host.
FDS

Fabio dos Santos Thu 23 Apr 2020 1:57PM

Will try to set this up on Loomio now.

FDS

Fabio dos Santos Thu 23 Apr 2020 5:02PM

Tried to following configuration, but still get a "fail" message for the email.
Here is what is in my env

# smtp settings
[email protected]
SMTP_AUTH=login
SMTP_DOMAIN=associacaomusicalsuzuki.com.br
SMTP_SERVER=mail.associacaomusicalsuzuki.com.br
SMTP_PORT=465
[email protected]
SMTP_PASSWORD=RANDOMPASSWORD
SMTP_USE_SSL=1
REPLY_HOSTNAME=associacaomusicalsuzuki.com.br
# helper bot is the account which welcomes people to their groups.
[email protected]
RAILS_ENV=production

I changed SMTP_AUTH to login.

I feel like that only information that is actually missing (when in compared to SWAKS) is TLS, which I don't know how to add to the env.

FDS

Fabio dos Santos Thu 23 Apr 2020 5:19PM

Here is the error log:

loomio-worker  | Sent mail to [email protected] (30011.6ms)
loomio-worker  | 2020-04-23T17:12:51.324Z pid=7 tid=gt6r05v7n class=Sidekiq::Extensions::DelayedMailer jid=68a10f59676f12141d512979 elapsed=30.099 INFO: fail
loomio-worker  | 2020-04-23T17:12:51.326Z pid=7 tid=gt6r05v7n WARN: {"context":"Job raised exception","job":{"retry":true,"queue":"loginemails","backtrace":true,"class":"Sidekiq::Extensions::DelayedMailer","args":["---\n- !ruby/class 'UserMailer'\n- :login\n- - 1\n  - 18\n"],"jid":"68a10f59676f12141d512979","createdat":1587661688.261439,"enqueuedat":1587661941.223482,"errormessage":"execution exp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bs5rxwUGe2iGpElDp1uXC63bCdqZ/Pw5a\nEx31ujbP7RrmzIHb7e9GUV/6Z+M8lq6khfHV6vzYRC7j+SysofwkeQKsdgJI\n9nD//Q8p1swh\n","retriedat":1587661849.721321},"jobstr":"{\"retry\":true,\"queue\":\"loginemails\",\"backtrace\":true,\"class\":\"Sidekiq::Extensions::DelayedMailer\",\"args\":[\"---\\n- !ruby/class 'UserMailer'\\n- :login\\n- - 1\\n  - 18\\n\"],\"jid\":\"68a10f59676f12141d512979\",\"createdat\":1587661688.261439,\"enqueuedat\":1587661941.223482,\"errormessage\":\"execution expired\",\"errorclass\":\"Net::OpenTimeout\",\"failedat\":1587661731.842505,\"retrycount\":2,\"errorbacktrace\":\"eJzNWNtymzAQ/ZU0L2lnamTAYDu/0umoAjZYNUhUEnbSr6+QcAI0tsEonb7Z\\nupyzl6Pdtb/do1oKVPCUFKigCRJ18oICL/aWiIFCslSVJ5LHKNw+Unb3gzKq\\nKCnob3i4/zrxLq+ATb+l0gpLnu5BTbi7sncTfXJ/pz9lHEtFxBUIRUvgtWoQ\\n/GVo2e3SFOqNuTiOsXfTtzffu5bULCsA5VBKVBJaLAJv7fkGrfna4By52KMM\\nCnoA8YJLUDueyVdwf7l9A8fNKpYgJeXDjDhgWtoA2AOfJuKX2iqSQ4MU+NH2\\nFMsT3Qy0eDnQhIW8gEhSpQPUAIFYRF7ghQbZLmO7jhIiDX50Bt+cu0JyAFlX\\nFRdqwHIA3G4gxhV9oilpqKWJc7zp81EmlahLYJfEcwsbekMGYUIZtrXggwi7\\n7o0mGZ+oaNMV6LX8jJSVIzW1yK96N6HwV+8ri/HjXD4BMq1JUhhf/LXh2ZEG\\nBMNzCpXJx8c4FfaycNkXSTPY018LXTO92DC0KwieFTBpZNoj7ei0AvHERXkT\\nfCV4qq3nBs/fxgYQniGtFeCfPHEAGnez+zm4K+AAhfzSJLo9eBNJSTN96kgE\\noHRHKDNc4V8148D3w1bexWdwFDpDKRZVqUm2miaMbY71FjZ7SOeWqU6VMK/4\\nZEjDG4Z9Ws1y6cnNIE05U4IXWgB4sGXsWMddReBWMUeqdviVVAmSfnxIAtva\\nrkRiYnpXy4npldo08bIQ5ABMFzk/1DOJGVGaBW2+gly0TaBj+/9h+kT8U8+6\\nGXbwageSnvNU+8hh3K0HcbceZFRWRKW7m1h0tdLiVKfy6xsWA+DC6KhrdOTM\\naKGLuZkHVtNKyMixw1ZyUwMEqSrbNja2DTYr8xl0OeAks8DrgQ9uGP6xD8EY\\n4DEJDeZVkYH+/K7+Vs7012MJovXpR5Ry8dKD3ksPnb70guc5tLFxGeggOjut\\nuKtOazum5AVPnFSnYDhAz7G0E1nbs5rxwUGe2iGpElDp1uXC63bCdqZ/Pw5a\\nEx31ujbP7RrmzIHb7e9GUV/6Z+M8lq6khfHV6vzYRC7j+SysofwkeQKsdgJI\\n9nD//Q8p1swh\\n\",\"retriedat\":1587661849.721321}"}
loomio-worker  | 2020-04-23T17:12:51.326Z pid=7 tid=gt6r05v7n WARN: Net::OpenTimeout: execution expired
loomio-worker  | 2020-04-23T17:12:51.327Z pid=7 tid=gt6r05v7n WARN: /usr/local/lib/ruby/2.6.0/net/smtp.rb:539:in `initialize'

(the email has been switched)

Load More