Trouble with emails, errors with [websocket ]and /cable
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
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.
Fabio dos Santos Wed 22 Apr 2020 10:16AM
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
/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!
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.
Fabio dos Santos Wed 22 Apr 2020 1:40PM
OK! Some adicional information (I've tried some things.)
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: 184.108.40.206, 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.
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.
Fabio dos Santos Thu 23 Apr 2020 1:56PM
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 [220.127.116.11]
<~ 250-SIZE 52428800
<~ 250-AUTH PLAIN LOGIN
<~ 250 HELP
~> AUTH LOGIN
<~ 334 VXNlcm5hbWU6
<~ 334 UGFzc3dvcmQ6
<~ 235 Authentication succeeded
~> MAIL FROM:<[email protected]>
<~ 250 OK
~> RCPT TO:<[email protected]>
<~ 250 Accepted
<~ 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
<~ 221 br150.hostgator.com.br closing connection
=== Connection closed with remote host.
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
# helper bot is the account which welcomes people to their groups.
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.
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: 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)
Fabio dos Santos Thu 23 Apr 2020 6:28PM
I first ran SWAKS from my personal computer, and that ran fine.
It ocurred to me to try the same command on the server where Loomio is installed. The same command failed. Still investigating.
Fabio dos Santos Fri 24 Apr 2020 12:36AM
Ok. Advancing slowly, but surely.
I checked with Linode, and here is what I found:
Linode blocks outbound mail for accounts after 2019Nov5 until you do a few things and put in a ticket.
I have the procedure. I will do that tomorrow.
Fabio dos Santos Fri 24 Apr 2020 2:17AM
Ok! I have contacted Linode. I the SWAKS now works on the Linode.
Still no success the Loomio config.
Here is what I am running on SWAKS, followed by the tet in the ENV:
./swaks --to [email protected] --from "[email protected]" --auth LOGIN --auth-user "[email protected]" --auth-password "WOULDNOTTELLYOUWHICH" --server mail.associacaomusicalsuzuki.com.br -tlsc
# smtp settings
# helper bot is the account which welcomes people to their groups.
loomio-worker | Sent mail to [email protected] (120.5ms)
loomio-worker | 2020-04-24T02:06:17.978Z pid=7 tid=ow347wr7n class=Sidekiq::Extensions::DelayedMailer jid=9123c511910aa9399f93804e elapsed=0.181 INFO: fail
loomio-worker | 2020-04-24T02:06:17.979Z pid=7 tid=ow347wr7n WARN: Net::SMTPFatalError: 550-Verification failed for <[email protected]>
Looking this error log, now, I see an email I did not know I needed to create. email@example.com. I'll go ahead and create that.
I also created a "[email protected]", which seemed logical, since it is the ENV. But that does not seem to be the cause of the error.
Advancing slowly. Please let me know your thoughts. Now I am sure SMTP Works on my server. It is definately something in Loomio!
Fabio dos Santos Fri 24 Apr 2020 2:47AM
I GOT IT TO WORK! Thanks for being pacient!
1) Make sure your server you can connect to your email server.
2) Create the necessary emails on your email server. Mainly "no-reply", and "notifications".
Things that could improve the experience of installing Loomio: 1) add a check to make sure that email server can be reached in install procedure. 2) add a check that all necessary emails have been created.
Still don't understand what the websocket or the /cable error is about. Should I be worried or add any specific change related to this?
Robert Guthrie Sat 25 Apr 2020 1:32AM
It's good to know it wasnt a Loomio issue after all. SMTP is quite troubling some times eh.
The cable errors.. They're not critical, at worst, live update of changes (see someone else's comment appear without reload) won't work. I'll fix it in the repo if I do find the problem there.
Fabio dos Santos Tue 28 Apr 2020 1:12PM
About the Webcables error, I found this thread on StackOverflow.
The error we are getting seems similar.
Rich Sun 10 May 2020 11:39AM
@Rob Guthrie I think you're wrong here, I'm pretty sure this is a Loomio problem as it requires [email protected] to exist. I've come across this as I'm seeing what sounds like the exact same problems. Unfortunately the 'fix' of adding [email protected] doesn't really work for me as the domain I'm using isn't only used for Loomio.
I've dug around in the code a little and seeing in
base_mailer.rb that there seemed to be a way to override this, I set the env var
[email protected]in the worker container. Loomio then thought it was successfully sending emails but actually our mail server was giving an error as it was trying to send from the address
Sorry if hijacking this thread isn't the right thing to do, I can start a new one if preferred.
Robert Guthrie Sun 10 May 2020 7:42PM
Happy to be wrong and consider alternatives. I'm not sure what the problem is exactly, though.
Loomio must send notifications from some address. Some mail servers require that sending addresses are setup as receiving addresses, or are registered to be able to send email, but that's a per mail server thing.
It's not a hard/formal SMTP requirement that you send mail from addresses that "exist", and it's not Loomio that's requiring it.
However I'm not sure that this is the root of the problem. Are you saying you would like to configure the from address for notifications? How would you solve the problem?
Rich Wed 13 May 2020 7:28PM
It seems there are 2 problems. The first is the one is that there's not enough documentation around hosting your own Loomio instance so the existence of the
NOTIFICATIONS_EMAIL_ADDRESS env var isn't easy to find. The only reference to it loomio that Google can find is from your response to a Github issue. I'd love to see this fixed by having proper documentation so you can see what's required of your mail server and how to work around an constraints, just like this.
The second issue is something I'm not sure about where to go with as it seems that somewhere between the ActionMailer config in Loomio and it actually trying to send it's messing up the SMTP username. My suspicion is that ActionMailer is assuming that the username is the first half of an email address. This is often the case but in my case the mail server we're using runs mails for multiple domains, so the username is of the form
[email protected] or
[email protected], etc. so the error I'm seeing is that the address
[email protected]@mailserver.domain doesn't meet the specs for an email address.
Fabio dos Santos · Mon 20 Apr 2020 7:49PM
Oops. Forgot to include the ENV file:
Here it is: https://pastebin.pl/view/8180aad9